Mac Dude

1596 Reputation

17 Badges

14 years, 325 days

MaplePrimes Activity


These are replies submitted by Mac Dude

@John Fredsted While I haven't experienced your particular problem I have certainly had Maple hang on me many (too many) times. One particularly annoying class of freezes is when the Java front-end (i.e. the "Standard Worksheet") freezes up. In that case no amount of hitting the red bug is going to bring it back. In my cases (on Mac OS X) I often find the "Maple 17" process (which really is just the front-end) chewing up CPU while "mserver", the compute engine, does nothing.

Is it possible that Java chokes on the keys you (accidentally) hit? Is it even remotely possible that your keys bring up some kind of Java dialog that may be hidden?

If there is a Java log file it may be worth inspecting that.

Mac Dude

 

@acer Your contribution is maybe the most useful one in this thread as it gives the reader a scheme how to do this to whatever generality or not (s)he needs. Many thanks.

I actually wonder: Is there a way to "pin" this thread so it can be found quickly? Casting trig functions in certain forms are one of the aggravating issues with Maple (and probably all CAS); I certainly have repeatedly beat my head against the screen (figuratively speaking) trying to get Maple to do what is trivial on paper. The problem is often that one >needs< to get it done in Maple to be able to use the result in further computations, so just "knowing it" is not enough. Finding an old thread in MaplePrimes is unfortunately difficult-to-impossible and in most cases quite time consuming.

Just my $0.02

Mac Dude.

 

@ecterrab Edgardo, I will be able to check it on Maple 17 tomorrow.
The input that triggers the problem is kind-of lengthy so I wanted to spare people looking at a lenghty file, on the off-chance that someone (like you) might recognize from experience what is going on.

I do understand that the Physics package is updated constantly. I actually use relatively little of it so I do not, at this point, think it is a question of features; more likely one of either a bug, or equally likely of something I don't understand.

I'll be back.

Mac Dude

@acer 

I guess I should have been more persevering...

M.D.

@Carl Love Many  thanks. I am not in a position to test this right now, but will soon.

M.D.

@acer ER... not really. I was following Carl's suggestion (#1) which in fact got rid of the original error msg.

But it is still not working; can't get past the error I cite in my reply to Carl's suggestion.

M.D.

 

@Carl Love You are correct, and your fix#1 got me over this hurdle. There was another problem I ucovered (Ci is protected) so I changed that name. The call now reads

plots:-animate(Statistics:-Histogram,[dR*~'WindowN(RP0,Can,CangleWidth+Can)',ignore=true,view=[-0.5..0.2,0..10]],Can=-0.1 .. 0.1);

but now I am getting

Error, (in plots/animate) expected non-empty data set, received Vector(0, {})

(after some time so it clearly is dong something in between). I know the Histograms are for real over the whole range. I added viewing ranges to make sure at least frames are produced. CangleWidth is properly set (to 0.05).

WTF?? Sometimes Maple is driving me up the wall.

Thanks anyway,

M.D.

Not only is zeros[] undefined; you are also using n within the for i from... do loop without defining n. Should n be i??

As written, the output of the loop would just be listed and you'd have to plot "%" right after the closing "od", which seems a bit precarious.


Should "shanks" be a Vector?

Mac Dude.

@ Here is what I would do:

(frst and scnd are the expressions from your Maple worksheet)

U[int] is not zero for all t; but diff(U[int],t) can still be evaluated for all phi and all t, in particular for t = infinity:

limit(frst,t=infinity);

So frst can be 0 for infinite t only if phi=0 or Pi. If we plug phi =0 into frst we can look at different values for t:

simplify(subs(phi=0,frst));solve(%,[t],AllSolutions=true)[];

and find that t*90/Pi has to be an integer ≥0. (which is what _Z1~ is). in other words, you are looking at complete half-cycles (90 is the radial frequency omega, in your sheet). On close inspection that is what your plots are showing: for fractional cycles the flat spots (zero-condition for frst) shift slightly.

It remains to show that the 2nd derivative stays positive which can be trivially done by plugging in the above value for t. The value, for phi=0, of scnd becomes Pi*_Z1~/180, which is >0 for any t >0. For _Z1~=0 (=t=0) the behaviour is correct also: no curvature as at t=0 there is no accumulated difference regardless of phi.

You can do the math for phi=Pi and will find that scnd will become negative for t>0, i.e. you are looking at a maximum

So the condition of complete half-cycles (which follows from the long-time limit) allows to solve this problem also. I suspect removing that condition would make the problem very messy and maybe untractable except numerically. I have not tried that case.

M.D.

@Carl Love I won't argue with your assertion that lists work, but I had to do the convert to bring the data into a form that NonLinearfit would accept so I thought I'd hand that to the OP as well. Without the convert I got weird error msgs. Probably just ineptness on my part.

As for the initialvalues being all that is required: In my experience, specifying the fit parameters explicitly cuts down on a lot of stupid error messages. I usually do that before I spec. initialvalues as the latter is not always necessary. The message here is that nonlinear fitting algorithms are a bit finnicky and the user better know his/her problem well enough to specify these details and scrutinize the results for being sensible. And, by the way, I do not consider the observed behaviour (failure unless enough info is given to the algorithm) a bug. If it hangs, maybe (in my case it did not).

M.D.

@Axel Vogt This solution list is valid for t=1. If I understand the OP correctly, (s)he wants a solution for general t>0.

To the OP: The differential wrt. phi being 0 merely proves one has an extremum. It needs to be ensured that the 2nd differential is >0 to guarantee a minimum. For phi=0 and general t>0 this can be shown to be the case in a direct, straightforward manner (just do the differentiation wrt. phi & solve w/o assigning t; then do the 2nd diff for the first solution (t=0)) thus proving that phi=0 is a local minimum for all t>0. Showing that this is the only minimum (or the deepest one) is more complicated and is left as an exercise.

Mac Dude.

@Alejandro Jakubi It is an interesting command I did not know yet, but it does not do what I need. I need to be able to do something to some of the occurrences of q, but not others.

Thanks anyway,

M. D.

@Carl Love Yes, I did see it. Apologies for late reply, sometimes life gets in the way. I got sidetracked & aen't gotten back to this thing yet.

I actually was looking more for some function or proc that returns the operand numbers of the occurrences of q, maybe in a list, so that I can then do something to the occurrence I want to (e.g. using subsop). Your solution is cleverer in the sense that it looks for certain structures, I'll have to see whether that works also for the more complicated cases(or even better).

Thanks,

M.D.

@acer Oh boy, do I feel stupid now...:-)

But thanks; that is what I wanted.

M. D.

 

@Carl Love Well, as the name coeffs suggests, I expect the coefficient that these variables (x0 or xp0) are multiplied by. The coefficient can be a number, another name, or an expression. If either x0 or xp0 don't show up at all in the expression being tested (the rhs of X or XP), the coefficient of that particular variable is 0 and coeffs should return that.

In the specific example above I want 1 for coeffs(op(2,X),x0); and 0 for coeffs(op(2,XP),x0);.

Thanks,M.D.

First 29 30 31 32 33 34 35 Last Page 31 of 43