Preben Alsholm

MaplePrimes Activity


These are answers submitted by Preben Alsholm

I once asked Edgardo Cheb-Terrab (in this forum, I think) why the unknown function (here y(t)) had to be given when the series and laplace methods are used while it is not in general necessary otherwise.
In his answer he explained that the code for those two methods were not written by him, but by other people.

So probably the simple answer to your question is that those "other people" didn't implement the eval-variant.
If you try:

dsolve([ode,bc_form_1],y(t),method=laplace);

then you get a rather misleading error message:

Error, (in dsolve/inttrans/solveit) transform method can only be applied to linear ODE
 

 

 

 

Actually Maple 2018 comes up with the correct solution , {T(x, t) = x}, {V(x, t) = 1+cos(w*t)} ,

but Maple 2019 says no solution (i.e. NULL):

restart;
sys_Pde := diff(V(x, t), x, x) = 0, diff(T(x, t), x, x) = 0; 
BC := eval(diff(V(x, t), x), x = 1) = 0, eval(V(x, t), x = 0) = 1+cos(w*t), eval(T(x, t), x = 0) = 0, eval(T(x, t), x = 1) = 1;

res:=pdsolve({sys_Pde}); # General solution
pdsolve({BC, sys_Pde}); # 2018 OK, 2019 NOT OK.
## Check:
Vsol:=subs(res,V(x,t));
Tsol:=subs(res,T(x,t));
res1:=diff(Vsol,x)=0; # So _F3(t) = 0.
res2:=eval(Vsol,x=0)=1+cos(w*t); # So _F4(t) = 1 + cos(w*t).
res3:=eval(Tsol,x=0)=0; # So _F2(t)=0.
res4:=eval(Tsol,x=1)=1; # So _F1(t)+_F2(t)=0. Thus _F1(t) = 1.  (!)
sol:=eval(res,{res1,res2,res3,res4});  # Both missing that _F1(t)=1.
pdetest(sol,{BC, sys_Pde});                # Both missing that _F1(t)=1       

Which Maple version are you using?

OK, I see that the error that you report comes up in Maple 2017.

Notice that your procedure gra only works for the integers 1..200000 (nmax). It doesn't work for e.g. the float 88.0.
The easiest way out of that is to use plots/insequence:

plots:-display([seq(gra(h),h=0..200000,1000)],insequence=true);

 

I shall assume that E = R^3, so just do:
 

int(exp(-x^2-y^2/4-z^2/9),[x=-infinity..infinity,y=-infinity..infinity,z=-infinity..infinity]);

Answer: 6*Pi^(3/2)

If E is not R^3 you should tell us what it is.

@ALIKHADEMI Your boundary conditions (which you call ics) are incorrectly formed.
If I understand your intention then the bollowing would be the correct formulation:
 

bcs:=(D@@2)(ws)(a/2)-lambda=0,(D@@2)(ws)(-a/2)-lambda=0,(D@@3)(ws)(a/2)-lambda=0,(D@@3)(ws)(-a/2)-lambda=0;

Notice that I have left out your 'd' since it is just a factor in all 4 and doesn't depend on y.

With this change there is no solution.
That is not surprising since the general solution of eq9 is a polynomial of degree 5. After 2 differentiations the general solution has lost 2 arbitrary constants leaving us with 2 only, but with 4 requirements.
 

dsolve([eq9, bcs]); # NULL, i.e. no solution
sol:=dsolve(eq9);
collect(rhs(sol),y,factor); # Polynomial of degree 5.

Thus you need to reconsider your boundary conditions.

After the lines with assume and additionally try inserting the lines:
 

addressof(a);
addressof(b);

and you will see that both addresses have changed after addtionally. The assumptions create local variables printed with the tilde.
The global versions evaluate to the latest tilde local.
f and g were created when the second a and b locals were not born only the first.
h was created after additionally, so the b introduced on the right of h is the second local, whereas the b and a in f are still the first.

anames(user) reports the global names, but if you follow with %, you will see what they evaluate to.

You are forgetting a multiplication sign in eq2.
It should be:
 

eq2 := (-beta*x+1)*(-beta*y+1);

Moreover, there is no need for firstequation and secondequation to be functions.
If you want to anyway you should use unapply, otherwise your function only works as you expect if the arguments are literally (rho1,rho2) and that is useless.
 

Try this and you will see that the problem isn't really solved:
 

restart;
eq:=diff(u(x,t),t)+I*diff(u(x,t),x,x)=0;
ic:=u(x,0)=1+cosh(2*x);
sol:=pdsolve({eq,ic});
with(inttrans);
sol;
## Testing the solution given in the pdf file:
sol1:=u(x,t)=1+cosh(2*x)*exp(-4*I*t);
pdetest(sol1,[eq,ic]); # OK

I was using Maple 2018. Maybe Maple 2019 can do better. I don't have access to that.

You should take a look at the help page for evalf/Sum, where it states:


"In the case of infinite sums, Levin's u-transform is used, which has the additional effect that sums that formally diverge may return a result that can be interpreted as evaluation of the analytic extension of the series for the sum (see the examples below).
This behavior can be controlled through the use of the formal option or the _EnvFormal environment variable. If this variable is assigned the value false, or formal=false is specified, then this command will apply some (numeric) convergence tests to determine if the infinite sum in question is convergent, divergent, or otherwise non-convergent."

Try this:
 

S:=Sum((-1)^n*n^2/(n+1),n=1..infinity,formal=false);
evalf(S);

 

You could use:
 

sol1 := dsolve({DE1, DE2, ICs}, numeric, events = [[[x(t)-2, diff(x(t),t)<0], halt]]);

 

In Maple 8 this certainly works: [$65..95]; and I don't get any errors from running your worksheet.
I get the error you have if I try $[65..95];

Could your error message have been left from an earlier misplacement of the left bracket?
That the letter F shows up in the plot suggests that the answer to that question is "yes".

Suggestion:
Remove the error message from your worksheet. Then run the whole thing including restart once again.

You have a loop  running from i= 1 to i= nnp+1 and nnp is set to 10.
The ode system doesn't depend on any parameters including i, thus keep dsolve outside of the loop.
Handle dsolve first. There is indeed a problem with convertsys for some reason. (A bug I suppose).
You can get around that by solving for the derivatives first:

dvars:=indets({sys_ode},specfunc(anything,diff));
SYS:=solve({sys_ode},dvars):
sol:=dsolve(SYS union {ics},numeric,[sv(x),sh(x),L(x),Jir(x),u(x)],output=listprocedure);
SV,SH,LA,JIR,U:=op(subs(sol,[sv(x),sh(x),L(x),Jir(x),u(x)])):
plots:-odeplot(sol,[x,sv(x)],x=0..5000); # Just to see that dsolve/numeric works

Now do the (first) loop.

 

Replacing int with an approximate integrator and using LSSolve I find for the updated system this answer from LSSolve:
sol := [5.53989661895405, [d1 = -0.000305007492156158, d2 = 12.0947160055038, mu = -1894.38456773538]].
sol[1] is the sum of squares divided by 2. Thus Eq1^2+Eq2^2+Eq3^2 > 11 for the values found for d1, d2, and mu.
The signs of d1 and d2 are irrelevant since only their squares appear in the equations.
This doesn't prove that there is no solution, but it raises that suspicion.

An example of what I'm talking about is the following which uses a different integrator than I used for the result above:
 

RES_AP:=eval([Eq1, Eq2, Eq3],int=rcurry(Student:-Calculus1:-ApproximateInt,method=simpson,partition=51)):
sol:=Optimization:-LSSolve(RES_AP, variables={d1, d2, mu},iterationlimit=2000);
eval([Eq1, Eq2, Eq3],sol[2]);
IntegrationTools:-Expand(%);

The result here is
sol := [5.53989661896720, [d1 = -0.000973253903034116, d2 = -12.0947149137687, mu = -1894.38455370635]]
and the 3 residuals (i.e. Eq1,Eq2,Eq3)  are
[2.3533083414644, -2.3540885251539, -0.0005510445]

You could try a Riemann sum, i.e. replace the integral with one of the two sums

add( a2F[i]/w[i]*(w[i+1]-w[i]), i=1..N-1);
add( a2F[i]/w[i]*(w[i]-w[i-1]), i=2..N);

where N = 500.  As the final result you may choose the average of the two.
If the w-values are too far apart for that approch to make sense you could find a spline approximation for a2F using CurveFitting:-Spline. Then just integrate that approximation.

A home made example, where I construct my own data: W and F.
F is just sin applied to the values in W.

restart;
r:=rand(-0.01..0.01);
['r()'$5];
N1:=500:
W:=[seq(1..N1/10,0.1)] + ['r()'$N1-9]: 
N:=nops(W);
F:=sin~(W):
S1:=add(F[i]/W[i]*(W[i]-W[i-1]),i=2..N);
S2:=add(F[i]/W[i]*(W[i+1]-W[i]),i=1..N-1);
f:=CurveFitting:-Spline(W,F,w):
int(f/w,w=min(W)..max(W),numeric); # Takes a little while.
int(sin(w)/w,w=min(W)..max(W)); # For comparison.

 

In your worksheet Q is being defined as a function.
Try after the lines you have to write Q(t);
Then your integral is evaluated.
In Maple input (1D input and preferred by many) you could do:
 

restart;
P := t->r*Q[inf]/(2 + 2*cosh(-r*t + b));
int(P(s), s = 0 .. t);

Then you can try various simplifications.

1 2 3 4 5 6 7 Last Page 1 of 144