Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

My value for k was chosen so that my dt agreed with yours. Their difference seemed to be zero judging from the plot, simplify didn't do it, but I was satisfied. However, as you will notice, I kept using yours.

I had fun making an animation of the jump and catch:

@brian bovril Thanks for the reference. I have uploaded a worksheet. It doesn't use the parameters option in dsolve/numeric, since I seem to be getting inconsistent results using that option in this problem. At this point I don't understand why results are inconsistent.

'implicitplot' takes much longer, but plotting is just used for guidance. 

MonkeyAndCoconut.mw

Addendum:

The inconsistency results in the parameters version apparently is due to fsolve remembering results.

Below the problem is shown (in p1) together with two solutions to the problem (p2 and p3).

But first the simple problem is solved analytically.

In p2 X is a local variable, in p3 X is global, but the statement forget(fsolve); is inserted before fsolve gets to work.

The parameters version will work fine also for the the original problem e.g. by inserting the statement forget(fsolve); as below in p3.

restart;
eq := diff(x(t), t) = a*x(t);
dsolve({eq, x(0) = 1});
solve(rhs(%)=2,t);
#############################################
restart;
eq := diff(x(t), t) = a*x(t);
dsol := dsolve({eq, x(0) = 1}, numeric, output = listprocedure,parameters=[a]);
X:=subs(dsol,x(t));
p1:=proc(a) local tp;
   if not type(a,realcons) then return 'procname(_passed)' end if;
   dsol(parameters=[a]);
   tp:=fsolve(X(t) = 2, t);
   if not type(tp,numeric) then undefined else tp end if
 end proc:
plot(p1(a),a=0..50);
p1(10);
p1(200);
#############################################
restart;
eq := diff(x(t), t) = a*x(t);
dsol := dsolve({eq, x(0) = 1}, numeric, output = listprocedure,parameters=[a]);
p2:=proc(a) local tp,X;
   if not type(a,realcons) then return 'procname(_passed)' end if;
   dsol(parameters=[a]);
   X:=subs(dsol,x(t));
   tp:=fsolve(X(t) = 2, t);
   if not type(tp,numeric) then undefined else tp end if
 end proc:
plot(p2(a),a=0..50);
p2(10);
p2(200);
restart;
eq := diff(x(t), t) = a*x(t);
dsol := dsolve({eq, x(0) = 1}, numeric, output = listprocedure,parameters=[a]);
X:=subs(dsol,x(t));
p3:=proc(a) local tp;
   if not type(a,realcons) then return 'procname(_passed)' end if;
   dsol(parameters=[a]);
   forget(fsolve);
   tp:=fsolve(X(t) = 2, t);
   if not type(tp,numeric) then undefined else tp end if
 end proc:
plot(p3(a),a=0..50);
p3(10);
p3(200);

@brian bovril Thanks for the reference. I have uploaded a worksheet. It doesn't use the parameters option in dsolve/numeric, since I seem to be getting inconsistent results using that option in this problem. At this point I don't understand why results are inconsistent.

'implicitplot' takes much longer, but plotting is just used for guidance. 

MonkeyAndCoconut.mw

Addendum:

The inconsistency results in the parameters version apparently is due to fsolve remembering results.

Below the problem is shown (in p1) together with two solutions to the problem (p2 and p3).

But first the simple problem is solved analytically.

In p2 X is a local variable, in p3 X is global, but the statement forget(fsolve); is inserted before fsolve gets to work.

The parameters version will work fine also for the the original problem e.g. by inserting the statement forget(fsolve); as below in p3.

restart;
eq := diff(x(t), t) = a*x(t);
dsolve({eq, x(0) = 1});
solve(rhs(%)=2,t);
#############################################
restart;
eq := diff(x(t), t) = a*x(t);
dsol := dsolve({eq, x(0) = 1}, numeric, output = listprocedure,parameters=[a]);
X:=subs(dsol,x(t));
p1:=proc(a) local tp;
   if not type(a,realcons) then return 'procname(_passed)' end if;
   dsol(parameters=[a]);
   tp:=fsolve(X(t) = 2, t);
   if not type(tp,numeric) then undefined else tp end if
 end proc:
plot(p1(a),a=0..50);
p1(10);
p1(200);
#############################################
restart;
eq := diff(x(t), t) = a*x(t);
dsol := dsolve({eq, x(0) = 1}, numeric, output = listprocedure,parameters=[a]);
p2:=proc(a) local tp,X;
   if not type(a,realcons) then return 'procname(_passed)' end if;
   dsol(parameters=[a]);
   X:=subs(dsol,x(t));
   tp:=fsolve(X(t) = 2, t);
   if not type(tp,numeric) then undefined else tp end if
 end proc:
plot(p2(a),a=0..50);
p2(10);
p2(200);
restart;
eq := diff(x(t), t) = a*x(t);
dsol := dsolve({eq, x(0) = 1}, numeric, output = listprocedure,parameters=[a]);
X:=subs(dsol,x(t));
p3:=proc(a) local tp;
   if not type(a,realcons) then return 'procname(_passed)' end if;
   dsol(parameters=[a]);
   forget(fsolve);
   tp:=fsolve(X(t) = 2, t);
   if not type(tp,numeric) then undefined else tp end if
 end proc:
plot(p3(a),a=0..50);
p3(10);
p3(200);

@brian bovril 

I don't know where the expression dt came from, nevertheless I tried the following.

restart;
eq1 := diff(y(t), t, t) = -49/5-0.1350000000e-2*Pi*sqrt((diff(x(t), t))^2+(diff(y(t), t))^2)*diff(y(t), t);
eq2 := diff(x(t), t, t) = -0.1350000000e-2*Pi*sqrt((diff(x(t), t))^2+(diff(y(t), t))^2)*diff(x(t), t);
dsol := dsolve({eq1, eq2, x(0) = 0, y(0) = 0, D(x)(0) = V*cos(theta),D(y)(0) = V*sin(theta)}, numeric, output = listprocedure,parameters=[V,theta]);
#The version above didn't work in Maple 12, which I used for my original answer, but it works in Maple 16.
X,Y:=op(subs(dsol,[x(t),y(t)]));
dt := -(25/126)*ln(-(-2+exp(-(324/1625)*Pi+(27/1625)*Pi*yp)+2*sqrt(1-exp(-(324/1625)*Pi+(27/1625)*Pi*yp)))/exp(-(324/1625)*Pi+(27/1625)*Pi*yp))*sqrt(78)/sqrt(Pi);
x0 := 45:
EQ:=proc(V,theta) local tp,drpt;
   if not type([V,theta],list(realcons)) then return 'procname(_passed)' end if;
   dsol(parameters=[V,theta]);
   tp:=fsolve(X(t) = x0, t);
   if not type(tp,numeric) then return undefined end if;
   drpt := evalf(eval(dt,yp = Y(tp)));
   tp-drpt
end proc:
EQ(25,1.3);
plots:-implicitplot(EQ(V,theta),V=0..50,theta=0..Pi/2);
th:=fsolve(EQ(40,theta)=0,theta=0.2..0.3);
dsol(parameters=[40,th]):
plots:-odeplot(dsol,[x(t),y(t)],t=0..2);

@brian bovril 

I don't know where the expression dt came from, nevertheless I tried the following.

restart;
eq1 := diff(y(t), t, t) = -49/5-0.1350000000e-2*Pi*sqrt((diff(x(t), t))^2+(diff(y(t), t))^2)*diff(y(t), t);
eq2 := diff(x(t), t, t) = -0.1350000000e-2*Pi*sqrt((diff(x(t), t))^2+(diff(y(t), t))^2)*diff(x(t), t);
dsol := dsolve({eq1, eq2, x(0) = 0, y(0) = 0, D(x)(0) = V*cos(theta),D(y)(0) = V*sin(theta)}, numeric, output = listprocedure,parameters=[V,theta]);
#The version above didn't work in Maple 12, which I used for my original answer, but it works in Maple 16.
X,Y:=op(subs(dsol,[x(t),y(t)]));
dt := -(25/126)*ln(-(-2+exp(-(324/1625)*Pi+(27/1625)*Pi*yp)+2*sqrt(1-exp(-(324/1625)*Pi+(27/1625)*Pi*yp)))/exp(-(324/1625)*Pi+(27/1625)*Pi*yp))*sqrt(78)/sqrt(Pi);
x0 := 45:
EQ:=proc(V,theta) local tp,drpt;
   if not type([V,theta],list(realcons)) then return 'procname(_passed)' end if;
   dsol(parameters=[V,theta]);
   tp:=fsolve(X(t) = x0, t);
   if not type(tp,numeric) then return undefined end if;
   drpt := evalf(eval(dt,yp = Y(tp)));
   tp-drpt
end proc:
EQ(25,1.3);
plots:-implicitplot(EQ(V,theta),V=0..50,theta=0..Pi/2);
th:=fsolve(EQ(40,theta)=0,theta=0.2..0.3);
dsol(parameters=[40,th]):
plots:-odeplot(dsol,[x(t),y(t)],t=0..2);

@Markiyan Hirnyk Please see the proof added above.

@Markiyan Hirnyk Please see the proof added above.

@J4James If alpha > 0 and beta > 0  then the first root found by Maple is real and the next two are imaginary. This follows from the fact that the cube root appearing in all the 3 results is the cube root of a positive number, thus real.

alpha*x+beta*x^3=f2;
r:=solve(%,x);
r[1];
op([1,1],indets(r[1],`^`(anything,1/3)));
#This is greater than or equal to
eval(%,alpha=0);
simplify(%) assuming real;
#which is >= 0.

#Of course if beta=0 and alpha > 0 there is only one solution.

If beta <0 you will observe that the situation is more complicated:

animate(complexplot,[[eval(r,{alpha=1})],f2=-10..10,thickness=3],beta=-5..5);

@J4James If alpha > 0 and beta > 0  then the first root found by Maple is real and the next two are imaginary. This follows from the fact that the cube root appearing in all the 3 results is the cube root of a positive number, thus real.

alpha*x+beta*x^3=f2;
r:=solve(%,x);
r[1];
op([1,1],indets(r[1],`^`(anything,1/3)));
#This is greater than or equal to
eval(%,alpha=0);
simplify(%) assuming real;
#which is >= 0.

#Of course if beta=0 and alpha > 0 there is only one solution.

If beta <0 you will observe that the situation is more complicated:

animate(complexplot,[[eval(r,{alpha=1})],f2=-10..10,thickness=3],beta=-5..5);

You are referring to mbogo:

http://www.mapleprimes.com/questions/139205-Graphing-And-Parameter-Sensitivity-Analysis

I don't believe Maple can help you solve that type of problem.

You are referring to mbogo:

http://www.mapleprimes.com/questions/139205-Graphing-And-Parameter-Sensitivity-Analysis

I don't believe Maple can help you solve that type of problem.

@Adri vanderMeer van der Meer I think it is a floating point issue.

Consider the output from these lines:

restart;
f:=proc(theta::numeric) print(theta); csc(theta)^2 - cot(theta)^2 end proc;
plot(f, 0..2*Pi,numpoints=5,adaptive=false,style=point ,symbolsize=20);
plottools:-getdata(%);
A:=%[-1];
A[4,1];
f(%);
seq( evalf[n](f(A[4,1])),n=10..25);

@Adri vanderMeer van der Meer I think it is a floating point issue.

Consider the output from these lines:

restart;
f:=proc(theta::numeric) print(theta); csc(theta)^2 - cot(theta)^2 end proc;
plot(f, 0..2*Pi,numpoints=5,adaptive=false,style=point ,symbolsize=20);
plottools:-getdata(%);
A:=%[-1];
A[4,1];
f(%);
seq( evalf[n](f(A[4,1])),n=10..25);

How is mean(X(t)) defined? And what about V(t)?

Since there is only one independent variable (t) you don't have a pde.

To avoid that the best is to go to

Tools/Options/Display/Input display : Choose Maple Notation

after that I would also go to

Tools/Options/Interface/Default format for new worksheets : Choose Worksheet

Finally click on the button Apply Globally

To see that these are in effect, open a new worksheet and start writing.

These options can always be changed, if you don't like them.

First 191 192 193 194 195 196 197 Last Page 193 of 231