Preben Alsholm

13728 Reputation

22 Badges

20 years, 245 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

Any solution from dsolve that I can think of has an equation of the form y(x)=algebraic.
You could test {sol} for
hastype({sol},`=`);
If true you could go on with odetest.

The integral is divergent for two reasons each sufficient for divergence:

1. The singularity at x=10.69.

2. The integrand behaves asymptotically as 0.187549975/x.

To see the problems just do

int(x/(x^2-10.69^2),x=0..12);
int(x/(x^2-10.69^2), x=12..infinity);

Finally, you could try removing evalf:

n:=1+(2/Pi)*Int((x*0.187549975)/(x^2-10.69^2), x=0..infinity);
value(%);



Based on my previous remark that two of the rows in A are the same I did as follows:

La14:=lhs(La1)-lhs(La4); #This has 1 as the highest order of any derivative
La5:=diff(La14=0,t); #Differentiate
#Remove one of La1 and La4 and replace it by La5. I removed La4:
ff := dsolve({La1, La2, La3, La5, q1(0)=10,D(q1)(0)=0,q2(0)=30*Pi/180,D(q2)(0)=(Pi/18),q3(0)=2,D(q3)(0)=0,q4(0)=30*Pi/180,D(q4)(0)=0}, {q1(t),q2(t),q3(t),q4(t)}, type=numeric, output=listprocedure);
plots:-odeplot(ff,[t,q1(t)],0..250);


##Comment
You may wonder whether the set of equations {La1,La2,La3,La5} (together with the initial conditions) is equivalent to the set {La1,La2,La3,La4} (with the initial conditions).
That {La1,La2,La3,La4} implies {La1,La2,La3,La5} is obvious.
Now the converse:
Suppose we have solved {La1,La2,La3,La5}.
From La5 follows La14=lhs(La1)-lhs(La4) = constant = C. Thus since lhs(La1)=0 we have lhs(La4)=C.
To test if this constant C is actually (close to) zero we could plot La14:
odeplot(ff,[t,La14],0..100);
The value is indeed very small, i.e. C seems to be approximately zero so that L4 holds.
But that was no proof.
However, this is: We know La14 is a constant C. To find C we can evaluate La14 at t=0:
eval(convert(La14,D),t=0);
##We now use the initial conditions:
eval(%,{q1(0)=10,D(q1)(0)=0,q2(0)=30*Pi/180,D(q2)(0)=(Pi/18),q3(0)=2,D(q3)(0)=0,q4(0)=30*Pi/180,D(q4)(0)=0});
#returns 0, so indeed C = 0.



The error message comes from DEtools[convertsys].

Try with no initial conditions, the second argument ={}:
DEtools[convertsys]({La1, La2, La3, La4},{},[q1,q2,q3,q4],t);
#Same error as you got. Now try solving for the highest derivatives:
indets({La1, La2, La3, La4},specfunc(anything,diff));
hvars:=diff~({q1,q2,q3,q4}(t),t,t);
solve({La1, La2, La3, La4},hvars);
#returns NULL, i.e. nothing. So solve cannot solve for the highest derivatives.
There is a good reason for that. The system is linear in the second derivatives (that is good), but try:
A,b:=LinearAlgebra:-GenerateMatrix([La1,La2,La3,La4],[diff(q1(t), t, t), diff(q2(t), t, t), diff(q3(t), t, t), diff(q4(t), t, t)]);
LinearAlgebra:-Determinant(A);
#The determinant is zero. Thus either no solution or infinitely many.
So you got a purely algebraic problem as the equations are now.






Maple will just separate variables, when trying to solve analytically:

You can enter the equation in a number of ways (I have set hbar^2/2/m = 1)

S:=-VectorCalculus:-Laplacian(psi(x,y,z),[x,y,z])+U*psi(x,y,z)=E*psi(x,y,z);
#Alternatively:
S:=-add(D[i,i],i=1..3)(psi)(x,y,z)+U*psi(x,y,z)=E*psi(x,y,z);
#You can turn the D's into diff's if you prefer:
S:=convert(S,diff);
res:=pdsolve(S);

You can use the usual methods if you differentiate the ode, but remember that that adds an extra condition (eq below).

restart;
ODE := A*diff(h(t), t)^2+B*diff(h(t), t)*(h(t)+C)+E*h(t) = F*cos(diff(h(t), t)):
The following must be satisfied if  h(0) = 0 and we set D(h)(0)=y1.
eq:=subs(t=0,h(0) = 0,D(h)(0)=y1,convert(ODE,D));
ODE2:=diff(ODE,t);
res:= dsolve({ODE2, h(0) = 0,D(h)(0)=y1}, numeric,parameters = [y1,A, B, C, E, F]);
eval(eq,[A, B, C, E, F]=~[0,0,1,1,1]);
res('parameters'=[Pi/2,0,0,1,1,1]):
plots:-odeplot(res,[t,h(t)],0..3);
plots:-odeplot(res,[t,D(h)(t)],0..1);



Here is a solution done in the textbook manner of separating variables. Comments are few.

restart;
L:=1;
pde:= diff(u(x,t),t$2)+2*diff(u(x,t),t)-diff(u(x,t),x$2)=18*sin(3*Pi*x/L);
ic:={u(0,t)=0,u(L,t)=0,u(x,0)=0,D[2](u)(x,0)=0};
pdsolve(pde); #Just to see the situation
#We see from that that up is a particular solution:
pdetest(u(x,t)=A*sin(3*Pi*x),pde);
eval(%,A=2/Pi^2);
up:=2/Pi^2*sin(3*Pi*x);
#Boundary conditions and one initial condition also satisfied:
pdetest(u(x,t)=up,[pde,op(ic)]);
pde0:=lhs(pde)=0; #The homogeneous pde
ic0:={u(0,t)=0,u(L,t)=0,u(x,0)=-up,D[2](u)(x,0)=0}; #Conditions
pdsolve(pde0,HINT=f(x)*g(t));
ode_x,ode_t:=op(op([2,1],%));
res_f:=dsolve(ode_x) assuming _c[1]<0; #Condition needed for bcs.
S:=_c[1]=-n^2*Pi^2; #In fact this with n posint and no cosine
res_g:=dsolve(eval(ode_t,S)) assuming n::posint;
res_f:=eval(res_f,{S,_C1=1,_C2=0}); #No cosine
T:=eval(rhs(res_g),{_C1=b(n),_C2=a(n)})*rhs(res_f); #nth term
res:=Sum(T,n=1..infinity);
eval(res,t=0)=-up; #Initial condition 1
eval(diff(res,t),t=0)=0; # Initial condition 2
##The final solution:
resF:=simplify(subs(n=3,b(3)=a(3)/sqrt(9*Pi^2-1),a(3)=-2/Pi^2,T)) + up;
#Check:
pdetest(u(x,t)=resF,[pde,op(ic)]);
###########
## An animation:
plots:-animate(plot,[resF,x=0..L],t=0..5,frames=100);

As I recall it subs has existed a long time before this two argument version of eval: eval(.., eq) and eval(..,{eqs}). The one argument form of eval and the two argument form eval(.., n), n a positive integer, are probably as old as subs.
The newer version eval(.., eq) may have inherited the argument order from eval(.., n).

There may also be semantical reasons: substitute something into something else, evaluate something at something.

subs is by no means useless with eval around. Just two examples:

subs(x=a,a=9,f(a*x)); #Sequential substitution.

subs(a=9,proc(x) f(a*x) end proc);  #Substitution into a procedure

If you try any of these with eval (in the proper order of course), then you get an error in the first case and an unchanged procedure in the second.


Set the right hand sides equal to zero. Solve those two equations {eq1,eq2} for {s(t),m(t)}:
solve({eq1,eq2}, {s(t),m(t)});

You will see that there are 2 solutions.

If all constants are positive (0,0) is unstable (a saddle point), the other is asymptotically stable.

Instead of us speculating about what you might have done or can do why don't you upload a worksheet?

However, it seems that you are using Optimization:-Minimize on an expression, which doesn't make sense unless A and B are of type numeric.
Assuming that you are using something like
res:=dsolve(........,parameters=[A,B]);
and have some procedure p:
p:=proc(A,B) res(parameters=[A,B]); and the rest end proc

then clearly p(A,B); will result in an error if A and B are not of type numeric.

Using the operator input to Optimization:-Minimize might be the way to go.


You only have one ode and that has two functions differentiated, V and H.

Is H known? Do you just want to express V in terms of H?
In that case you could do
dsolve(ode,V(xi));

but notice that the output contains two unevaluated integrals (from the variation of parameters formula).

Secondly, what do you mean by "V(xi) tends to 2*xi^2 as xi tends to infinity".

I see two different interpretations:

limit(V(xi)/xi^2,xi=infinity)=2;

limit(V(xi)-2*xi^2,xi=infinity)=0;

Without knowledge of H you are not getting anywhere though. If you know H the question is can the integrals be found?.

Simple example with H(xi)=constant, so that H'(xi) = 0 all xi:
The condition limit(V(xi)/xi^2,xi=infinity)=2 will give you this equation in two unknowns _C1 and _C2:
(2*sqrt(Pi)*_C2*E-2*k1*n*X+2*_C1*E+2*k2*E+2*E)/E = 2


The syntax for plot3d is:

plot3d(x*y,x=0..1,y=0..1);

Either use map as done by Kitonum in his answer or use elementwise application of log10 and `^`. Elementwise application is not available in Maple 12 and earlier.

evalf(log10~([25,5,1,10,4,20]));
10^~(%);

The first (and here the only) argument should have all the equations as a set or list:

de := (1-x^2)*diff(y(x), x$2)-2*x*(diff(y(x), x))+12*y(x) = 0;
Y := dsolve({de, y(-1) = -1, y(1) = 1});

I had a brief look at Douglas Meade's Shoot package, to which you gave a link.

It appears that in the procedure process_required_args, which is local to the module Shoot, isolate is being used like this in line 7:

ode := map(isolate,ode,diff);

Here in your case ode:=convert(ODE,list);

The problem is that the success of this isolate command depends on each differential equation not having more than one function differentiated.
Notice that your first equation does not satisfy that requirement.
The solution is to solve for the derivatives:
sys:=op(solve(ODE,diff~([F,H,f,g,u,v](eta),eta))); #Doesn't work in Maple 12
#In Maple 12:
sys:=op(solve(ODE,map(diff,[F,H,f,g,u,v](eta),eta)));
Two other problems:
1. Don't use gamma since that is Euler's constant in Maple. Change it to gm or similar.
2. FNS has H(), it obviously should be H(eta).

Then do
shoot(sys, IC, BC, FNS, [alpha = 0, gm = 0, z = -.2, Q = 0]);

But you don't get success with the guess you have.
However, following the suggestion in my comment "Shooting using dsolve/parameters" you could shoot from eta=L also when using Douglas Meade's 'shoot'. It is quite like I wrote in the comment.
Use
ICSL:={F(L) = 0, H(L) = 2, f(L) = fL, g(L) =-fL, u(L) = 0,v(L)=vL};
and then
res:=shoot(sys, ICSL, {f(0)=0,u(0)=1}, FNS, [fL=0.4,vL=0]);







First 70 71 72 73 74 75 76 Last Page 72 of 160