acer

32727 Reputation

29 Badges

20 years, 91 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@awass This might be a clue.

When editing normally within an Execution Group, pressing the <Enter> key executes the statements and pressing <Shift><Enter> inserts a new line and moves the cursor down.

Your problematic examples are in Execution Groups that appear in the .mw file as two adjacent separate XML Equation substructures, which I don't recall seeing before to represent a single statement.

Normally, when one pastes in code containing newlines (LF, \n, U+000A) then all is ok. For example, in the last attempt in your attached worksheet there is such a newline after the Q:=proc(x) and before the sin(x)

But I suspect that something else is getting pasted in, after the sin(x), that may be causing interpretation by the GUI as two separate statements. (I don't mean a hidden semi-colon, as that seems to come as a consequence of further conversion to 1D, not the original cause.) And this seems to cause the GUI to send the first and second portion to the kernel separately.

The first portion being like,

Q:=proc(x)
  sin(x)

and the second portion being,

end proc;

There was a post a month (or several) ago, in which a Mac OSX user was having trouble due to an unexpected character in a text file. I am wondering whether your issue might be similar. For example, something to do with a difference between a carriage return and a newline.

I have never seen anyone report this problem before. On the one hand, there is some evidence that were some changes to the 2D parser in Maple 2018, but on the other hand this situation doesn't seem a general problem. As a guess, I suspect that it might be a Mac OSX specific issue, with something (CR, LF, etc) being misinterpreted and causing an unintended statement split.

If my guess is right, then diagnosing the problem might require examining the original plaintext (if you copied from that, with the mouse), or examining the file, or knowing which key strokes were using in writing it.

@Joe Riel Oh, right, sure, I would believe that. I just meant that the whole topic relates to kernel-based parameter processing in general, (including, but not only) what happens in the debugger.

@José Goulart I figured that you were using an older version, and that for some reason you wanted to keep it a secret.

I've now changed the header on the Question, to denote the Produce as Maple 18. (You could do that too, in future.)

@Joe Riel I changed it to an Answer, as I too was preparing to mention _npassed .

@José Goulart Your last shows 2D Input (which just happens to be in red), in an Execution Group. That's not 1D Input. (You would also have to use F5 or the toggle to switch to 1D input mode, if it's not your default.)

The following is 2D Input. Here I'm using the prefix form of the inert `%*` operator, rather than infix form as was previously showed with 1D input.

restart

kernelopts(version)

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

interface(imaginaryunit = I)

Ke := `%*`(2*I*E/l^3, `<,>`(`<|>`(6, 3*l, -6, 3*l), `<|>`(3*l, 2*l^2, -3*l, l^2), `<|>`(-6, -3*l, 6, -3*l), `<|>`(3*l, l^2, -3*l, 2*l^2)))

`%*`(2*I*E/l^3, Matrix(%id = 18446883719466239510))

value(Ke)

Matrix(%id = 18446883719466230238)

InertForm:-Display(Ke, inert = false)

0, "%1 is not a command in the %2 package", _Hold, Typesetting

 

Download inert_star.mw

@awass I am not sure that Mapleprimes allows a ( .maple file name extension) workbook to be uploaded directly. But .zip files work.

However, I'd be interested in seeing the original .mw , rather than a workbook .maple file which is a container for .mw Worksheets/Documents.

It would also be interesting to see what you get with the Maple 2018.2 update.

It sounds like you are copying plaintext and pasting it in (where the source is a text file?). But, sorry, the exact steps aren't clear to me.

@Kitonum The result from rsolve could be simplified prior to unapplying, and the result from this new operator could also be evala'd (simplified). It seems a bit faster to use add on the binomial expansion, say if m::posint .

If the operator "Tm" is going to be called multiple times with the same arguments then it could also get, say, option remember, system (sure, I realize that's the recursive procedure originally had it for a finesse on that).

It's hard to compete with the performance of the original recursive procedure, though, which is very fast. So this is mostly in fun.

restart;

Tf := unapply('evala'(evala(rsolve({Tm(t,m)=2*t*Tm(t,m-1)-Tm(t,m-2),
                                    Tm(t,0)=1, Tm(t,1)=t}, Tm(t,m)))),
              [t,m]);

proc (t, m) options operator, arrow; evala((1/2)*(t-(t^2-1)^(1/2))^m+(1/2)*(t+(t^2-1)^(1/2))^m) end proc

Tf(3,4);

577

Alt := (t,m::posint) -> add((t^2-1)^k*binomial(m, 2*k)*t^(m-2*k), k = 0 .. m):

Alt(3,4);

577

Tr := unapply('evala'(evala(rsolve({Tm(t,m)=2*t*Tm(t,m-1)-Tm(t,m-2),
                                    Tm(t,0)=1, Tm(t,1)=t}, Tm(t,m)))),
              [t,m], proc_options=[remember, system]):

Tr(3,4);

577

Altr := proc(t,m::posint)
          option remember, system;
          add((t^2-1)^k*binomial(m, 2*k)*t^(m-2*k), k = 0 .. m);
        end proc:

Altr(3,4);

577

 

Download Tm.mw

@awass It is not helpful to not upload a worksheet that exhibits the problem, and to not tell us exactly which Maple version (major and minor number) you are using.

@danyheatley Another choice is the command SolveEquations from the (free) DirectSearch add-on package.

But note that can act more like an optimizer than a root-finder. By this I mean that it can return a set of values that minimizes the residuals in the case that an actual root does not exist. Sometimes people want that, though, because the rounding of float coefficients in the equations are why the minimum residuals cannot be attained closer to zero.

@aalho What old version do you have? Note that there is no need for this in any version later than Maple 18 (eg, Maple 18, Maple 2015, Maple 2016, Maple 2017, and Maple 2018).

In those versions, 2D plotting can use the size option.

@Kitonum I don't doubt that you are right, so I vote up.

I was answering the Question body as asked, and over-hastily discounted the title entirely as "parametrics" is an awkward construct that I wouldn't normally expect to see (and he hadn't yet posted his later Question about arrows and parametric curves). Not the first time I've made that flavor of mistake.

[edited] Upon further reflection, I retract my concession above. It would be a perfectly fine question to ask whether the path of a moving object (parametrized by time, say) intersected with the path of another at the same time value. A sensible question could be whether they are ever in the same place at the same time, in which case the original formulation is ok. So far, the OP has not provided any clear indication whether the question is about whether two parametrized curves ever cross, or whether they ever cross at the same parameter value(s).

It could well be that Kitonum's interpretation happens to be correct. But there is, so far, not evidence that it must be so.

@Glowing Yes, I know it is possible to create very advanced computations, highly "modularized" (encapsulation being achieved procedures or modules) that allow for multiple computations and re-use with varying parameter values. People do it often with Maple, with the procedure/modules sometimes stored within the worksheet or workbook, or in standalone plaintext .mpl files, or stored in .mla Library archives. Maple has a great deal of robust machinery for accomplishing that.

I deliberately avoided mention the command DocumentTools[RunWorksheet] before, because I think that it is the wrong way to solve this kind of problem. It's not nearly as computationally efficient, nor nearly as robust, as the other things mentioned. It fosters the existence of suboptimally organized worksheets.

@DanielRe Here is a minor revision which utilizes uses statements within the procedure bodies, instead of calling with at the top level (or calling with inside the procedures, as in your original, which is problematic).

GaußKronrodQuadraturFehlerbehandlung_ac2.mw

I had another look at plots:-dualaxisplot, and noticed that it doesn't seem to allow the two vertical axes to get their own separate legends, using separate legendstyle and location options. I find that a pity, since it is often not obvious which curve relates to which vertical axis. The earlier worksheet I uploaded used two vertical axis labels, which corresponded to the two legend items, whose colored lines corresponded to the two colored curves. But that requires one's sight to bounce between three things, which I find suboptimal. Here's one example:

In this new attachment I've tried to use a color shading of the vertical axes, and axes labels, to get a visual cue that only requires switching one's sight between two things.

This is basic programming. If you've written several hundred lines of code without organizing the flow by using procedures, and you want it to be re-usable in the sense of varying parameter values, then you've gone wrong.

That's true in every effective modern programming language, not just Maple (though the implementation and naming of "procedure" varies, of course).

Once the code is organized well it should be straightforward to re-use it like you want.

It is not very helpful to not supply the code in an uploaded worksheet here. A few hundred lines is not long.

(ps. I am not trying to sound harsh. This is not a rare situation. And with the material provided there's a good chance that you can get help with it.)

You've forgotten to show the examples of calling your procedure. You didn't show us what its argument would be.

Look, upload a worksheet that provides all the code to reproduce both plots of which you write. Use the green up-arrow in the Mapleprimes editor to upload (and don't forget to actually Insert it from the popup dialog, and click its OK button).

You should not call with from within a proc. It'd be better to have your procedure return an expression sequence of both plots, instead of printing them.

First 238 239 240 241 242 243 244 Last Page 240 of 599