Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@nm You can use combine followed by collect:
 

restart;
f := x->3*cos(42*x*Pi);
g :=(x,t)->exp(3*t)*cos(17*x*Pi);
pde := diff(u(x, t), t)= (diff(u(x, t), x, x)) + g(x, t);
bc := (D[1](u))(0, t) = 0, (D[1](u))(1, t) = 0;
ic:= u(x, 0) = f(x);
sol:=pdsolve([pde, ic, bc]);
##
combine(sol);
collect(%,exp,factor);

 

@panke The code works just the same in Maple 12 (I don't have Maple 13 available).
The line

SOL(eventfired=[1]);

can be left out if you wish. It just shows the same result basically.

@panke I did the following in Maple 2018:
 

restart; 
ode := diff(y(x), x) = 1/(y(x)+1); 
event := [[abs(y(x)+1)-0.1e-1, halt]];
SOL := dsolve([ode, y(0) = 0], numeric, output = listprocedure, range = -10 .. 10, events = event);
SOL(-2);
SOL(eventfired=[1]);
tlast := rhs(SOL[1](last));

 

@9009134 You have a line mentioning casesplit and I tried that. From only considering the general case I ran into a contradiction with your boundary conditions:
 

restart;
L:=0.75e-4:
eq1:=0.2079268293e-3*(diff(psi(x), x, x))-101.2059621*(diff(u(x), x, x))-101.2059621*(diff(w(x), x))*(diff(w(x), x, x));
##
eq2:=0.2079248162e-3+29.57317072*psi(x)-29.57317072*(diff(w(x), x))-1.996189024*10^(-9)*(diff(psi(x), x, x))-1.996189024*10^(-9)*(diff(w(x), x, x, x));
##
eq3:=151.8089432*(diff(w(x), x))^2*(diff(w(x), x, x))+101.2059621*(diff(u(x), x, x))*(diff(w(x), x))+101.2059621*(diff(u(x), x))*(diff(w(x), x, x))-0.2079268293e-3*(diff(psi(x), x, x))*(diff(w(x), x))-0.2079268293e-3*(diff(w(x), x, x))*(diff(psi(x), x))+29.57317070*(diff(w(x), x, x))-29.57317072*(diff(psi(x), x))-1.996189024*10^(-9)*(diff(psi(x), x, x, x))-1.996189024*10^(-9)*(diff(w(x), x, x, x, x))-p*(diff(w(x), x, x));
sys:={eq1,eq2,eq3}:
bcs:=psi(0) = 0, psi(L) = 0, D(psi)(0) = 0, w(0) = 0, w(L) = 0, D(w)(0) = 0, D(w)(L) = 0, u(0) = 0, u(L) = 0;
with(DEtools):
res:=casesplit(convert(sys,rational),[u,w,psi]):
nops([res]); # 5
for i from 2 to 5 do res[i] end do; #Special cases (of interest?)
SYS:=op(1,res[1]); #The general case
indets(SYS,specfunc(diff)); #Out of curiosity
indets(sys,specfunc(diff));   #Out of curiosity
## The following leads to a contrdiction:
eval[recurse](convert(SYS[1..2],D),{x=0,bcs});

The output incudes the equation 0 = 27224/3872072675.

@digerdiga Don't expect to be enlightened by the information from infolevel[int] unless you already know quite a lot about methods for indefinite integration. If you are really interested there is a book by Manuel Bronstein, Symbolic Integration I, dealing with this topic. He also has a short tutorial: https://www-sop.inria.fr/cafe/Manuel.Bronstein/publications/issac98.pdf

The freezing that goes on is just a Maple technicality, which doesn't go to the essence of what is really going on.

@digerdiga To get some insight into what is going on try setting infolevel[int]:=5 as done here:
 

restart;
f := ((1/2-I*t)^(-s)-(1/2+I*t)^(-s))/(2*I);
fc:=evalc(f);
infolevel[int]:=5:
F:=int(f,t) assuming s>1, t>0;
Fc:=int(fc,t) assuming s>1, t>0;

It appears that the paths to the results F and Fc are quite different.

@Fabio92 Sorry, I have no experience with actually using this option.

@digerdiga That I cannot reproduce the error for ftoc and ftocms for f probably just means that I made a mistake when I wrote in my answer that " For f the "successful" methods are ftoc and ftocms as for fc, but in addition the correct meijerg.".
Whas I take back is the claim that ftoc and ftocms gives the same results for f and fc.

The results from ftoc and ftocms for fc are equal and wrong.
You use Maple 2015 I see. Also there the results for f are correct for all the three metods ftoc, ftocms, and meijerg as is shown by the result of
 

int(f,t=0..infinity,method=_RETURNVERBOSE) assuming s>1;

which is

@digerdiga FTOC: Suppose F is an antiderivative of the continuous function f on an interval I=[a,b], i.e. F'(x) = f(x) for all x  in I. Then int(f(x),x=a..b) = F(b)-F(a).
Basically I believe that is the method used: Find F and evaluate at the ends of the interval.
But the function F actually found by Maple may not be an antiderivative on all of the given interval (here [a,b] ), but only piecewise so. Thus Maple (or you) will have to change this F into a continous F1 as illustrated in this example:

f:=1/(cos(x)+2);
F:=int(f,x);
simplify(diff(F,x)); # OK generically
plot(F,x=-3*Pi..3*Pi,discont=true); # discontinuous
F1:=int(f,x=0..xx) assuming xx>Pi;
plot(F1,xx=0..3*Pi);

Another problem is that F may not be defined at one or both endpoints of the interval. Thus eval(F, x=a) must be replaced by limit(F, x=a, right) and similarly at the other end point.
An example of that is:

f:=1+ln(x);
int(f,x=0..2);
F:=int(f,x);
eval(F,x=0); #Error
limit(F,x=0,right);# Fine


 

@Carl Love Surely you are aware of the following special behavior of evalf, but I shall use the opportunity to point it out nevertheless.
evalf accepts a sequence if not actually typed in as arguments one at a time.

seq(Pi^k,k=1..7);
evalf(%); #OK
evalf(seq(Pi^k,k=1..7)); #OK
evalf(seq(Pi^k,k=1..0,-1)); #OK 
seq(Pi^k,k=1..0,-1);
evalf(%); #OK
evalf(Pi,1); # the old alternative to evalf[1](Pi)
evalf(1,2,3,4); # Error


 

@Carl Love The wrong integral has fc as integrand. So you ought to add the corresponding lines for fc. But the result is indeed correct:
 

fc:=evalc(f); # Your f
int(fc, t= 0..infinity) assuming s > 1, r > 0:
simplify(eval(%, r= 1/2));

 

@digerdiga The problem here is that the indefinite integral of fc is wrong. That surprised me.
 

restart;
f := ((1/2-I*t)^(-s)-(1/2+I*t)^(-s))/(2*I);
fc:=evalc(f);
## Checking that fc = f for s=2 on t=0..5:
plot(eval(f-fc,s=2),t=0..5); #OK zero
##
Fc:=int(fc,t) assuming s>1, t>0;
Fcdiff:=diff(Fc,t);
## Now Fcdiff and fc ought to be equal:
plot(eval(Fcdiff-fc,s=2),t=0..5); # Not zero
## ftoc and ftocms uses the Fundamental Theorem of Calculus.
## Thus the erroneous result is due to Fc being wrong:
limit(Fc,t=infinity) - limit(Fc,t=0,right) assuming s>1;
simplify(%);

 

The following session where printlevel is just the default 1 also makes the result 0:
 

restart; 
interface(typesetting=extended); 
debug(`shake/shake`);
evalf(frac(Pi^20)); # 0
printlevel; # 1

Also here the result is 23 if typesetting = standard instead.

Since the second session shows an error from Typesetting:

Error, (in j) invalid subscript selector

<-- ERROR in \`shake/shake\` (now in \`evalr/shake\`) = unexpected result from Typesetting}

I tried suppressing output as in
 

restart;
interface(typesetting=extended);
printlevel:=40:
evalf(frac(Pi^20)):
%;

The error didn't show up and the result was 23.

@farah adanan I tried your worksheet as given in the link. I used Maple 18.1. I found no problem.
I also checked Maple 15, 16, and 17.
The only problem appeared in Maple 15. It didn't like the local declaration at the start. That feature wasn't introduced yet.
The way you and Kitonum are using parameters via e.g. eval(eq1, fixedparameter1), the local declaration can be left out anyway since gamma is being replaced by the value 1 given in fixedparameter1.

First 44 45 46 47 48 49 50 Last Page 46 of 231