Preben Alsholm

13728 Reputation

22 Badges

20 years, 247 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

DEtools[linearsol] finds (according to its help page) "solutions of a first order linear ODE". Thus you shouldn't expect any success since your ode1 is 2nd order.

However, dsolve finds solutions for ode1 as well as for the one obtained by your proposed change of variables:

ode1 := diff(y(x),x$2) + (lambda-x^2)*y(x) = 0;
eval(ode1,y(x)=exp(-x^2/2)*y1(x));
isolate(%,diff(y1(x),x,x));
ode2:=simplify(%);
dsolve(ode2);
dsolve(ode1);

If for some reason you only have the plot then you can use plottools:-getdata to get the data as in this example.

res:=dsolve({diff(y(t),t)=x(t),diff(x(t),t)=-y(t),x(0)=0,y(0)=1},numeric);
p:=plots:-odeplot(res,[x(t),y(t)],0..2*Pi):
p;
plottools:-getdata(p);
M:=%[-1];
plot(M,style=point);
M[1..5,1..2];

Notice, however, that from this plot in the phase plane you don't have information about the times the points were visited. If you need to save data it is clearly best not to extract from plots but do as shown by Georgios in his answer. 

I have uploaded an answer to your previous question in the form of a worksheet. It is by no means perfect, but does give results in reasonable time it seems to me.

MaplePrimes12-09-21F.mw

As a start try the somewhat unrelated loop:

eps:=.0001:
for N from 1 while abs(evalf(ln(1+1/N))) >=eps do end do:
N;

Notice that no job is done between "do" and "end do".

What type do the elements have? If they are floats or rational numbers there ought not be a problem. But if not huge symbolic expressions could easily build up.

Did you not use double quotes? As in

printf("The expected value is %12.8f",evalf[20](Pi));

When f is a known function of 6 variables you can define the procedure Z2 by
Z2:= subs(Eq75,f(t,phix(t), phiy(t), phiz(t), thetax(t), thetay(t))):

Then you can try Z2(ts);

There are a lot of programs out there. But here is a simple start.

All you need to do is change the definition of f and define any relevant constants, in the example below that would be k, x0, xm, N.
The first plots using complexplot accept real as well as complex data.

restart;
with(plots):
f:=x->k-x^2;
k:=0.7+.2*I:
#k:=1.42:
x0:=.5: #Initial value
xm:=5: #Maximal abs(x) allowed
S:=x0:
N:=200: #Number of iterations
to N while abs(x0)    x0:=evalf(f(x0));
   S:=S,x0;
end do:

Ns:=nops([S]):
complexplot([S],style=point,symbol=solidcircle,symbolsize=15);
display(seq(complexplot([S[1..n]],
style=point,symbol=solidcircle,symbolsize=15),n=1..Ns),insequence=true);

#For real data only:
display(plot(ListTools:-FlattenOnce([seq([[S[i-1],S[i]],[S[i],S[i]]],i=2..Ns)])),
plot([f(x),x],x=min(S[1..Ns])..max(S[1..Ns]),color=[red,blue]));
pf:=plot([f(x),x],x=min(S[1..Ns])..max(S[1..Ns]),color=[red,blue]):
pa:=display(seq(plot(ListTools:-FlattenOnce([seq([[S[i-1],S[i]],[S[i],S[i]]],i=2..n)])),n=2..Ns),insequence=true):
display(pa,pf);

I had success with this in Maple 16:

restart;
V:=Vector(datatype=float[8]);
for i to 300 do V(i):=evalf(Pi/i) end do:
V;
W:=Vector(datatype=anything);
for i to 300 do W(i):=cat("Entry #",i) end do:
W;
W(300);

but mserver.exe stopped working when in a fresh worksheet I tried

restart;
W:=Vector(datatype=string);
for i to 5 do W(i):=cat("Entry #",i) end do:

 

I have been using &* for that purpose:

a&*LinearAlgebra:-RandomMatrix(2,2);
eval(%,`&*`=`*`);

It could as well have been &p or &m or &. or whatever you like. See the help:
?&

If you extend 'value' like this:

`value/&*`:=proc() `*`(args) end proc:

then you can do like this:

p:=a&*LinearAlgebra:-RandomMatrix(2,2);

value(p);

Edited: The problem is theta[f]. f is also the name of one of the dependent variables. Change theta[f] to e.g. theta[F].

In my first response I thought I saw a theta without index, but now I see that there isn't one. Had there been one the first answer would have been relevant (I let it stand here):
It is never a good idea to use a name and a corresponding indexed one as you do. You use theta, theta[s], theta[p], theta[f]. Maple sees theta as one 'thing'. Use other names, e.g. thetas, thetap, thetaf in addition to theta.

Besides that you have too few boundary conditions as Maple will tell you. What about theta[p]?

The code runs but no such triangles are found by that code. Your loops for x1, x2, y2, z2 starts from 1. If you change those so they run from 0 a nonempty list L is found.

The statement ListTools[Categorize]: doesn't do anything.

 

Since B = G and Nb = Nc it follows from eq3 that eq1 only has the dependent variable f. Thus you can use my answer to J4James, who asked that same question:

http://www.mapleprimes.com/questions/137367-Contourplot-Of-An-Ode

I'm not sure what you actually want. But is it something like solving de1 for each x in an interval and then plotting the resulting function of two variables?
If so you could try the following:

restart:with(plots);alpha:=1:

de1:=alpha*diff(f(y),y$4)+(diff(f(y),y$2)*diff(f(y),y$3)^2+diff(f(y),y$4)*diff(f(y),y$2)^2);

bc1:= f(1+sin(x)) = .95, f(-.1-.1*sin(x)) = -.95, (D(f))(1+sin(x)) = -1, (D(f))(-.1-.1*sin(x)) = -1;

plot([1+sin(x),-.1-.1*sin(x)],x=0..10);

p:=proc(x) local res,F,R1,R2; global de1,y,f;
option remember;
if not type(x,numeric) then return 'procname(x)' end if;
R1:=evalf(-.1-.1*sin(x));
R2:=evalf(1+sin(x));
res:=dsolve({de1,f(R2) = .95, f(R1) = -.95, D(f)(R2) = -1, D(f)(R1) = -1},numeric,output=listprocedure,maxmesh=1024);
F:=subs(res,f(y));
F
end proc:

p(1)(0.5);
#With the settings as they are the following returns a result, but p(3.1999)(0) does not:
p(3.199,0);

plot3d(p(x)(y),x=0..3,y=-1..2,axes=boxed);
contourplot(p(x)(y),x=0..3,y=-1..2);

First 117 118 119 120 121 122 123 Last Page 119 of 160