awass

301 Reputation

10 Badges

19 years, 136 days

MaplePrimes Activity


These are questions asked by awass

I am trying to understand the use of "events" in solving ode's, specifically the possible actions.
From the help pages:

Events are specified by the events=[event1,event2,...] option in the call to dsolve[numeric], where each event is a list of [trigger,action] pairs, where the trigger describes the trigger of the event, and the action describes the action to perform when the event is triggered.

It then goes on to list possible actions, for example,

u(t) = -u(t): execute statement when triggered
– [u(t) = -u(t), y(t) = -y(t)]: execute statements when triggered
[If(y(t) < 0, y(t) = -y(t), halt)]: execute statements conditionally when triggered

I tried to use the first one unsuccessfully several ways:
This works:dsolve({eq, y(0) = 1, (D(y))(0) = -1}, numeric, events = [[x+y(x) = 15, halt]])

but dsolve({eq, y(0) = 1, (D(y))(0) = -1}, numeric, events = [[y(x) = 0,[ 'print("Yes'")', halt]]]) does not

nor does any variant of that using print.

Also, I cannot get at the result of any assingment, e.g.,

dsolve({eq, y(0) = 1, (D(y))(0) = -1}, numeric, events = [[y(x) = 0, [z = diff(y(x), x), halt]]]) does not work either; z does not have a value. What commands can be executed as actions after an event is triggered?

 

 

 

 


I want to use a variant of the arctangent function in odeplot but I run into various problems. Here is the variant called at
> at := proc (x::realcons, yy)

if 0 < x then arctan(yy/x) elif x < 0 then Pi+arctan(yy/x) elif x = 0 then (1/2)*Pi end if end proc;


It would be nice to know if this is really what I want so I try to plot at  values for which I know the answer
> plot(at(-cos(-t), sin(t)), t = 0 .. 3.14);


Error, invalid input: at expects its 1st argument, x, to be of type realcons, but received -cos(t)


I have seen this problem before so I use single quotes with success:
plot('at(-cos(-t), sin(t))', t = 0 .. 3.14);

I get the desired plot;

Now I want to use this procedure in a plot of a numerical solution to an ODE.
The ODE is quite complicated but returns a procedure ,nans, that i use to visualize solutions via commands such as


> odeplot(nans, [[y, f(y)]], y = 0 .. 6);
No problem with any of that,

The problem arise when I define theta below
> theta := at(f(y)-(1/2)*Pi, diff(f(y), y));
and try to use it in odeplot, for example,
> odeplot(nans, [[y, theta]], y = 0 .. 6);
or
> theta1:=y->at(f(y)-Pi/(2),diff(f(y),y));


> odeplot(nans, [[y, theta1(y) ]], y = 0 .. 6);


Maple's complains about theta and theta1 and all of my attempts to fix the problem:


Error, (in plots/odeplot) curve 1 is not fully specified in terms of the ODE solution, found additional unknowns {Theta1}
or
Error, (in Theta1) invalid input: at expects its 1st argument, xx, to be of type realcons, but received f1(y)-(1/2)*Pi  or


Error, (in Theta1) invalid input: diff received HFloat(0.001), which is not valid for its 2nd argument


I supect there is an easy fix. If I give up on at and just use arctan I get an ugly jump in my plot but otherwise everything works.


I am looking for a high accuracy plot, however, and the jump obscures important features.

Please help!

I want(ed) to plot a surface gievn by f(x,y,z),g(x,y,z),h(x,y,z) where k(x,y,z) =0. I suspect that is not possble but I thought I might ask.

 

thanks

Maple does not evaluate

>Re( (2-I*X)^4) ),  assuming((X, realcons)

or

>assume(X, realcons);

> Re( (2-I*X)^4) );

Why do these simple expression return unevealuated?

 

When I call up a Help page I see mostly boxes with question marks inside. If I copy the page into Word I get a badly formatted document in Canbria font. On other pages I get a font drop down box that indicates the page is in DejaVu Sans font and if I then change that to some font on my system (MAC 10.12.1) I get a perfectly readable document. Is there some preference, startup code or setting I can change to fix this annoyance?

3 4 5 6 7 8 9 Page 5 of 10