acer

32343 Reputation

29 Badges

19 years, 328 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@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.

@mehdi jafari What is wrong is that your syntax is incorrect. Here is the call to int from your second example.

'int((exp(-32.74123792568-0.8916456579806e-1*ln(4.852623952*10^9*v^2)), numeric)
     *exp(-v^2/(2*T))*v^3, v = 2 .. 100)';

int((exp(-32.74123792568-0.8916456579806e-1*ln(4852623952.*v^2)), numeric)*exp(-(1/2)*v^2/T)*v^3, v = 2 .. 100)

 

The integrand that you entered has an expression sequence multiplied by a call to exp. What is that supposed to mean?

You write that you, "put numeric option in the middle of the integration". Do you really believe that putting an option word in the middle of a multiplication, as part of an expression sequence, makes sense?

The expression sequence is done in by `simplify`, where simplify((a,b)*c) returns a*c. I might call that GIGO.

How could the integral be computed numerically with the integrand depending on the unassigned name T?

How do the expressions for assigned to M, Mc, Nc, V, and Vc contribute? Were they used for the procedures H,L,G,K? It might help us, if you made your process more clear. Don't ever copy & paste. How did you arrive at the expressions inside thse procedures? Are you sure that those procedures' are correct, and you didn't omit anything (like plus signs for addition, etc)?

Have you tried using rationals instead of floats like 0.5?  How about using evalc, Re, and Im (perhaps on numerators and denominators of the longer combinations) and do simplification? It may benefit. And then you could consider writing it as a larger DE.

I suggest that you uses Tools->Options from the main menubar and change the following pair of related GUI preferences:

 - Under the Display tab, change the drop-menu item Input display to Maple Notation for input (ie. 1D plaintext) instead of 2D Math Notation (ie. marked up typeset math, aka 2D Input)

 - Under the Interface tab, change the Default format for new worksheets to Worksheet (ie. execution groups, which should seem more familiar) instead of Document (ie. paragraphs and document blocks).

Then hit the Apply Globally button in the popup dialog.

There have been many reports over the years on this site of users tripping up on 2D Input, partly because it's buggy and partly because it's not WYSIWYG. Really , they are two different languages, with different parsing rules, bugs aside. Having a space denote multiplication implicitly is a common issue. It's even worse if you get implicit multiplication without a visible space.

Adjusting the two preferences above makes the Java GUI behave more like the old (Classic) GUI from pre-2000.

First 231 232 233 234 235 236 237 Last Page 233 of 592