Mac Dude

1122 Reputation

16 Badges

7 years, 265 days

MaplePrimes Activity


These are replies submitted by Mac Dude

@fatemeh1090 I looked at the LaTeX output and it looks sensible to me (I didn't try to typeset it since I don't have a LaTeX doc handy I could paste it into). The expression fills two pages on my screen, so the LaTeX output expression is relatively large (potentially leading to memory problems). 

I don't have my copy of MathType on this computer so that has to wait until tomorrow. I also see that Maple 2015 on this computer may be less powerful w.r.t. outputting expressions in different formats than the newr versions. I do have to say that I have never attempted to put such a large expression into any document; the size alone may cause problems even if we find a way to get it into MSWord.

Stay tuned, but be patient.

M.D.

I would love to use MapleSim, but I find the price (something like 5  or 6 k$, in addition to about $2k for the Maple license) prohibitive, even to ask my employer for it. Esp. given that MapleSim is based on Modelica, which in itself is open source. Of course since I don't use it I don't know wether the interface Maplesoft has built around Modelica is worth the money. Presumably for some applications (automotive, car design?) it is.

M.D.

@Rouben Rostamian  

Programmatically, the debugger can be invoked by issuing

stopat(f1);

before calling f1. It will drop you into the debugger, cracking a window where f1 halts at the first executable statement. You can then push buttons like "next", "step" and others to single-step through the code, examine variables and such.

The trickiness lies in the various forms of single-stepping: step at the level you are at, which means subroutines get executed; step into a subroutine and other variants. The debugger definitely has a learning curve, and with only one window examining variables means you can quickly lose track of where you are, but it has its benefits, too. Personally, I would find it more useful if it had a window showing (dynamically) the values of the local variables, in the same fashion the Maple GUI has it.

Often, though, I just sprinkle a few print statements in the code to figure out where the issues are.

M.D.

I have seen crap like this before. Typically, I will first try the recalculate button to flush out everything (and you do begin your sheet with restart;, don't you?). In sticky cases I have had to close down Maple and start anew. I never had this in a reproduceable manner; but then, I don't use 2-d input mode unless I am writing a book or report.

You can also disable any .mapleinit intilazition file you may have.

FWIW

M.D.

It depends a bit on the details. A sum with a numeric range (e.g. 1..10) will often get expanded to an expression of type +; then you may be able to use op(n,xpr) to get at the nth summand. If the range is not numeric I think your option is to use op() to get at the arguments in the sum and substitute whatever you want for the index.

Why don't you upload an example?

M.D.

For a long time, plots:-display() would have trouble with log plots when gridlines are on & I submitted SCRs and even had exchanges with Maplesoft Tech Support on this issue. Often I had to turn the gridlines off to get at least a proper log plot.

It appears that Maple2019 has at least improved the situation: I was pleasantly surprised today to get a correct log plot, with the correct gridlines. I haven't done exhaustive testing, but that particular code does not plot the log gridlines on Maple 2018.

Kudos for fixing this!

Mac Dude.

 

@Mac Dude 

In my .mapleinit I pre-pend my own directory where I keep my packages in libname to Maple's directory (on macOS that happens to be "/Library/Frameworks/Maple.framework/Versions/2018/lib"). So my libname usually looks like this:

"/Users/uli/Maple/My_Maple_Libraries", "/Library/Frameworks/Maple.framework/Versions/2018/lib"

When I remove the first entry (my own directory) then all is well.

This actually is an issue: I need this so Maple loads my packages. Even the actual code where I ran into this problem needs this. I thought I could be smart and use PDEtools:-Solve, but no such luck: same error. Trying infolevel[pdsolve]:=3: It prints the expected when it works; when it doesn't there is no print-out whatsoever.

Trying trace(pdsolve), I get:

pdsolve(PDE);
{--> enter pdsolve, args = [diff(f(x, xp), x) = -(1/2)*(L*xp+2*x)*kl, diff(f(x, xp), xp) = -(1/4)*kl*L*(L*xp+2*x)]

zz := [], [[diff(f(x, xp), x) = -(1/2)*(L*xp+2*x)*kl, diff(f(x, xp), xp) = -(1/4)*kl*L*(L*xp+2*x)]]
<-- ERROR in pdsolve (now at top level) = too many arguments; some or all of the following are wrong: %1, [{f(x, xp)}, handlenonrationalfunctionsofdependentvariables = false]}
Error, (in pdsolve/sys) too many arguments; some or all of the following are wrong: [{f(x, xp)}, handlenonrationalfunctionsofdependentvariables = false]

When it works, I get a second entry into pdsolve with different arguments and build=true and it runs.

The short-term way out appears to be to reverse the order in libname: put my own directory after Maple's. This does not quite sound right as in general one wants the user-specific directory first, to be followed by the main one.

The bottom line is that there appears to be a naming conflict: something I have must be (unintentionally) masking something in Maple's libraries.

Is there a general way to track down such naming conflicts? I suppose I can try the debugger on pdsolve; but that seems to be going down a rabbit-hole fast (meaning I lost track where I was).

M.D.

 

@ecterrab and all others.

I now tried on my work machine (using the file I uploaded and running Maple 2018) and I get exactly the same error as I got at home on my laptop.

Since I appear to be the only person in the (Maple-) world who is running into this error I will scrutinize my .mapleinit file, even though I nowadays only have things like changing plot parameters in there... If I learn something I'll report back.

Rouben is correct, this particular system can be solved by hand (and I did so, getting the same answer as Rouben and tomleslie got [they are the same even if they look different]); but I gave a mwe; the real case has twice as many equations and variables and is more messy... beyond what I want to do manually.

Puzzled, but thanks again.

Mac Dude

 

It appears quadratic interpolation, which ignores the initial value, may be used. Check the docs on NLPsolve. You can specify a different method. As an aside, specifying the initial point at the end of the range is not a good strategy. I'd pick some point more in the middle.

You are not providing enough detail to go beyond these generalities. If your cost function should not go negative, the function should be written in a way that it cannot.

M.D.

@ 

Not really. G has everything; the rest is just to make it more explicit.

You do need to be aware of the assumptions Maple puts on the generated variables _Z2 and _B2, which you get using about(_Z2) and about(_B2). In this case, _Z2 is assumed to be an integer; _B2 is assumed to be 0 or 1.

M.D.

Read the Maple Programming Guide (can be found on Maplesoft's Manuals' page).

Program whatever it is you want to program.

If it works and is fast/accurate enough, you are done.

If not, come back and post the code you want to improve.

Mac Dude

 

Hi, have you tried printing the workbook to pdf (i.e doing it the old-fashioned way before ebooktools came along)? I have done this extensively and the only issue I could not fix was that the plots came out relatively large. But they never overlapped or such nonsense.

Mac Dude

@acer Many thanks for this exhaustive analysis. I actually was not all that aware of the floatPi kernelopt. The behaviour of evalf is a bit counterintuitive to say the least.

But it is good to have a better idea of what is going on.
 

Thanks again,

M.D.

@acer Ah, an oversight. Here is the file (with your name but modified). I did not touch your kernelopts. And as downloaded your original sheet evaluates exacly the same on my Maple as on yours even though I run 2015.1 and you run 2015.2.

M.D.

floatPiEqnLabel2.mw

@acer Ah, I had forgotten about trace... maybe I wasn't even aware that trace can trace Maple's library functions like sin... anyway, I played with your file & I think I get why evalf() changes your result (4):

evalf(sin(2*Pi*(4)));
execute sin, args = 704000000.*Pi
{--> enter sin, args = 704000000.*Pi
                                      8
                         7.04000000 10
                               0.
                               0
                               0
<-- exit sin (now at top level) = 0}
                               0.


so sin() gets a (-n integer) number times Pi as an argument and presumably knows that that is always 0.

The use of the variable (R in your file) prevents this and sin() gets passed the floating point argument so a round-off error appears.

Why are these different?

M.D.

 

1 2 3 4 5 6 7 Last Page 1 of 37