Quantcast
Channel: MaplePrimes - Questions and Posts tagged with pdsolve
Viewing all 445 articles
Browse latest View live

How to find polynomial type solutions using 'pdsol...

$
0
0

This is my original question, but I can't ask, so I put it here.

I have a system of pde, and it's hard to solve.

But I want to find the type of solutions which are polynomials of degree n of the several independent variables.

Is it possible using 'pdsolve'? Or there are some other commands in Maple to do that?

Thanks!


Solving PDEs with initial and boundary conditions: Sturm-Liouville problem with RootOf eigenvalues

$
0
0


 

Solving PDEs with initial and boundary conditions:

Sturm-Liouville problem with RootOf eigenvalues

 

Computer algebra systems always failed to compute exact solutions for a linear PDE with initial / boundary conditions when the eigenvalues of the corresponding Sturm-Liouville problem cannot be solved exactly - that is, when they can only be represented at most abstractly, using a RootOf construction.

 

This post illustrates then a new Maple development, to tackle this kind of problem (work in collaboration with Katherina von Bülow), including testing and plotting the resulting exact solution. To reproduce the computation below in Maple 2018.1 you need to install the Maplesoft Physics Updates (version 134 or higher).

 

As an example, consider

pde := diff(u(x, t), t) = k*(diff(u(x, t), x, x)); iv := u(x, 0) = 1-(1/4)*x^3, eval(diff(u(x, t), x), x = 0) = 0, eval(diff(u(x, t), x), x = 1)+u(1, t) = 0

diff(u(x, t), t) = k*(diff(diff(u(x, t), x), x))

 

u(x, 0) = 1-(1/4)*x^3, eval(diff(u(x, t), x), {x = 0}) = 0, eval(diff(u(x, t), x), {x = 1})+u(1, t) = 0

(1)

This problem represents the temperature distribution in a thin rod whose lateral surface is insulated over the interval 0 < x and x < 1, with the left end of the rod insulated and the right end experiencing a convection heat loss, as explained in George A. Articolo's Partial Differential Equations and Boundary Value Problems with Maple, example 3.6.4.

 

The formulation as a Sturm-Liouville problem starts with solving the PDE by separating the variables by product

pdsolve(pde, HINT = `*`)

PDESolStruc(u(x, t) = _F1(x)*_F2(t), [{diff(_F2(t), t) = k*_c[1]*_F2(t), diff(diff(_F1(x), x), x) = _c[1]*_F1(x)}])

(2)

Substituting this separation by product into the last two (out of three) initial/boundary conditions (iv), the original pde and these conditions are transformed into an ODE system with initial conditions

{_F1(1)+(D(_F1))(1) = 0, diff(_F2(t), t) = -k*_c[1]*_F2(t), diff(_F1(x), x, x) = -_c[1]*_F1(x), (D(_F1))(0) = 0}

{_F1(1)+(D(_F1))(1) = 0, diff(_F2(t), t) = -k*_c[1]*_F2(t), diff(diff(_F1(x), x), x) = -_c[1]*_F1(x), (D(_F1))(0) = 0}

(3)

This is a problem in actually three variables, including _c[1], and the solution can be computed using dsolve

dsolve({_F1(1)+(D(_F1))(1) = 0, diff(_F2(t), t) = -k*_c[1]*_F2(t), diff(diff(_F1(x), x), x) = -_c[1]*_F1(x), (D(_F1))(0) = 0}, {_F1, _F2, _c[1]})

{_c[1] = 0, _F1(x) = 0, _F2(t) = _C5}, {_c[1] = _C2, _F1(x) = 0, _F2(t) = _C5/exp(k*_C2*t)}, {_c[1] = RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2, _F1(x) = _C4*cos((RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2)^(1/2)*x), _F2(t) = _C5/exp(k*RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2*t)}

(4)

We are interested in a solution of the form u(x, t) = _F1(x)*_F2(t) and _F1(x)*_F2(t) <> 0, so discard the first two in the above and keep only the third one

solution_to_SL := ({_c[1] = 0, _F1(x) = 0, _F2(t) = _C5}, {_c[1] = _C2, _F1(x) = 0, _F2(t) = _C5/exp(k*_C2*t)}, {_c[1] = RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2, _F1(x) = _C4*cos((RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2)^(1/2)*x), _F2(t) = _C5/exp(k*RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2*t)})[3]

{_c[1] = RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2, _F1(x) = _C4*cos((RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2)^(1/2)*x), _F2(t) = _C5/exp(k*RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2*t)}

(5)

If we were able to express _c[1] in closed form, with a formula depending on an integer parameter identifying one of the roots of the expression, the rest of the method is straightforward, the product u(x, t) = _F1(x)*_F2(t) is a solution that by construction satisfies the boundary conditions in (1) , and we have one of them for each value of _c[1](for each root of the expression within the RootOf construction). The first condition in iv is used to adjust the remaining constant (combine _C4 times _C5 into one) using orthogonality properties , and by linearly superimposing these different solutions we construct an infinite series solution. All this is explained in standard textbooks.

 

The problem is what to do when _c[1] cannot be expressed in closed form, as in the example above. To understand the situation clearly, remove that RootOf and plot its contents:

RootOf(tan(_Z)*sqrt(_Z^2)-1) = lambda[n]

RootOf(tan(_Z)*(_Z^2)^(1/2)-1) = lambda[n]

(6)

DEtools[remove_RootOf](RootOf(tan(_Z)*(_Z^2)^(1/2)-1) = lambda[n])

tan(lambda[n])*(lambda[n]^2)^(1/2)-1 = 0

(7)

This equation has infinitely many roots. For instance between -2*Pi and 2*Pi, NULL

plot(lhs(tan(lambda[n])*(lambda[n]^2)^(1/2)-1 = 0), lambda[n] = -2*Pi .. 2*Pi)

 

A closed form solution to represent these values of `&lambda;__n` (also called the eigenvalue of the Sturm-Liouville problem) are necessary in the intermediate solving steps, and to express in closed form the solution to the original problem.

 

We cannot do magic to overcome this mathematical limitation, but there are in Maple representational abstract alternatives: we can use, in all the intermediate computations, a RootOf construction with a label identifying each of the roots and, at the end, remove the RootOf construction, presenting something readable, understandable.

 

This is the representation of the solution that we are proposing, whose automatic derivation from given pde and iv is already implemented:

pdsolve([pde, iv])

u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})

(8)

So an expression restricted by equations, inequations and possibly subject to conditions. This is the same type of representation we use in pdsolve, PDEtools:-casesplit and the FunctionAdvisor.

 

Note that, since there are infinitely many roots to the left and to the right of the origin, we assumed for simplicity that `&lambda;__n` >= 0, which suffices to construct the infinite series solution above. The initial value for the summation index n could be 0 or 1, it doesn't matter, since n itself does not appear in the summand, it only identifies one of the values of lambda solving tan(lambda[n])*lambda[n]-1 = 0. This is a very nice development.

 

So we can now compute and represent the solution algebraically even when the eigenvalue `&lambda;__n` cannot be expressed in closed form. But how do you test such a solution? Or even plot it?

 

For now that needs some human intervention. Start with testing (part of what follows is in the plans for further development of pdetest). Separate the solution expressed in terms of `&lambda;__n`from the equation defining it

solution := lhs(u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})) = op(1, rhs(u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})))

u(x, t) = Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity)

(9)

op([2, 2, 1, 1], u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])}))

tan(lambda[n])*lambda[n]-1 = 0

(10)

By inspection, solution has sin(lambda[n]) and cos(lambda[n]), not tan(lambda[n]), so rewrite (10), and on the way isolate cos(lambda[n])

condition := isolate(convert(tan(lambda[n])*lambda[n]-1 = 0, sincos), cos(lambda[n]))

cos(lambda[n]) = sin(lambda[n])*lambda[n]

(11)

Start by pdetesting

pdetest(solution, [pde, iv])

[0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, Sum(-3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*sin(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^2*sin(2*lambda[n])+4*lambda[n]^3), n = 0 .. infinity)+Sum(3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*cos(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)]

(12)

A further manipulation, substituting condition and combining the sums results in

simplify(subs(condition, combine([0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, Sum(-3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*sin(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^2*sin(2*lambda[n])+4*lambda[n]^3), n = 0 .. infinity)+Sum(3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*cos(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)], Sum)))

[0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, 0]

(13)

So from the four elements (one PDE and three iv), three are satisfied without having to specify who is `&lambda;__n` - it sufficed to say that cos(lambda[n]) = sin(lambda[n])*lambda[n], and this is the case of most of the examples we analyzed. You really don't need the exact closed form of `&lambda;__n` in these examples.

For the one expression which remains to be proven equal to zero, there is no clear way to perform the sum and show that it is equal to 1-(1/4)*x^3 without further information on the value of `&lambda;__n`.  So this part needs to be tested using a plot.

 

We need to perform the summation, instead of using infinite terms, using, say, the first 100 of them, and for that purpose we need the first 100 positive values of `&lambda;__n`. These values can be obtained using fsolve. Increase Digits to get a better approximation:

Digits := 20

20

(14)

L := [fsolve(condition, lambda[n], 0 .. 10^10, maxsols = 100)]

[.86033358901937976248, 3.4256184594817281465, 6.4372981791719471204, 9.5293344053619636029, 12.645287223856643104, 15.771284874815882047, 18.902409956860024151, 22.036496727938565083, 25.172446326646664714, 28.309642854452012364, 31.447714637546233553, 34.586424215288923664, 37.725612827776501051, 40.865170330488067836, 44.005017920830842726, 47.145097736761031075, 50.285366337773650463, 53.425790477394666341, 56.566344279821518125, 59.707007305335457045, 62.847763194454453706, 65.988598698490388394, 69.129502973895260447, 72.270467060308959618, 75.411483488848152399, 78.552545984242931733, 81.693649235601687434, 84.834788718042289254, 87.975960552493213068, 91.117161394464748699, 94.258388345039861151, 97.399638879073768561, 100.54091078684231954, 103.68220212628958019, 106.82351118369472752, 109.96483644107604716, 113.10617654902325890, 116.24753030393208866, 119.38889662883081820, 122.53027455715460386, 125.67166321895208822, 128.81306182910932798, 131.95446967725504430, 135.09588611907366660, 138.23731056880233903, 141.37874249272782439, 144.52018140353123171, 147.66162685535436266, 150.80307843948249426, 153.94453578055557821, 157.08599853323391302, 160.22746637925593824, 163.36893902483538786, 166.51041619835300015, 169.65189764830461611, 172.79338314147304750, 175.93487246129575380, 179.07636540640428965, 182.21786178931479917, 185.35936143525164220, 188.50086418108862526, 191.64236987439434602, 194.78387837256989967, 197.92538954206868814, 201.06690325768935430, 204.20841940193396857, 207.34993786442454883, 210.49145854137182078, 213.63298133509084236, 216.77450615355873900, 219.91603291001033966, 223.05756152256797778, 226.19909191390213620, 229.34062401091997921, 232.48215774447913415, 235.62369304912436649, 238.76522986284504017, 241.90676812685147396, 245.04830778536849850, 248.18984878544468993, 251.33139107677590895, 254.47293461154190896, 257.61447934425489811, 260.75602523161904694, 263.89757223240002997, 267.03912030730377471, 270.18066941886366904, 273.32221953133554631, 276.46377061059982966, 279.60532262407027259, 282.74687554060878265, 285.88842933044586060, 289.02998396510622761, 292.17153941733925030, 295.31309566105380609, 298.45465267125726198, 301.59621042399826673, 304.73776889631308125, 307.87932806617519465, 311.02088791244799345]

(15)

For convenience, construct a procedure, as a function of n, that returns each of these values

Lambda := proc (n) options operator, arrow; if n::nonnegint then L[n+1] else 'procname(args)' end if end proc

proc (n) options operator, arrow; if n::nonnegint then L[n+1] else 'procname(args)' end if end proc

(16)

Replace `&lambda;__n` by "Lambda(n), "infinity by 99 and the expression to be plotted is

remain := subs(lambda[n] = Lambda(n), infinity = 99, [0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, 0][2])

Sum(3*cos(Lambda(n)*x)*((I*Lambda(n)^3+(2*I)*Lambda(n)-Lambda(n)^2+2)*exp(-I*Lambda(n))-4+(-I*Lambda(n)^3-(2*I)*Lambda(n)-Lambda(n)^2+2)*exp(I*Lambda(n)))/(2*Lambda(n)^3*sin(2*Lambda(n))+4*Lambda(n)^4), n = 0 .. 99)-1+(1/4)*x^3

(17)

Perform the sum and plot. The plotting range is the one present in the iv (1), x goes from 0 to 1

R := eval(remain, Sum = add)

plot(R, x = 0 .. 1)

 

This result is very good. With the first 100 terms (constructed using the first 100 roots of tan(lambda[n])*lambda[n]-1 = 0) we verified that this last of the four testing conditions is sufficiently close to zero, and this concludes the verification.

To plot the solution, the idea is the same one: in (9), give a value to k - say k = 1/5 - then construct the sum of the first 100 terms as done in (17), but this time using (9) instead of (13)

 

subs(k = 1/5, lambda[n] = Lambda(n), infinity = 99, u(x, t) = Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity))

u(x, t) = Sum(3*exp(-(1/5)*Lambda(n)^2*t)*cos(Lambda(n)*x)*((-Lambda(n)^2+2)*cos(Lambda(n))-2+(Lambda(n)^3+2*Lambda(n))*sin(Lambda(n)))/(Lambda(n)^3*(sin(2*Lambda(n))+2*Lambda(n))), n = 0 .. 99)

(18)

S := eval(u(x, t) = Sum(3*exp(-(1/5)*Lambda(n)^2*t)*cos(Lambda(n)*x)*((-Lambda(n)^2+2)*cos(Lambda(n))-2+(Lambda(n)^3+2*Lambda(n))*sin(Lambda(n)))/(Lambda(n)^3*(sin(2*Lambda(n))+2*Lambda(n))), n = 0 .. 99), Sum = add)

plot3d(rhs(S), x = 0 .. 1, t = 0 .. 1)

 

Compare with the numerical solution one could obtain using pdsolve with the numeric option. So substitute k = 1/5, and from the corresponding help page rewrite the initial/boundary conditions using D notation and this is the syntax and corresponding plot

pds := pdsolve(subs(k = 1/5, pde), convert({iv}, D), numeric, time = t, range = 0 .. 1)

_m5021120320

(20)

pds:-plot3d(t = 0 .. 1, x = 0 .. 1)

 

``


 

Download PDE_and_BC_Example_with_RootOf_eigenvalues.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

pdsolve does not work

How can i solve the laplace differential equation of second order with boundary conditions in maple??

$
0
0

Uxx + Uyy =0

      y is less than Pi,x is greater than 0

B.c are u(0,y)=0 , u(Pi,y)=sinh*Pi*cosy

              u(x,0)=sinx , u(x,Pi)=-sinhx

Differential equations solving

$
0
0

 Any one can help me to solve the differential equations using maple to get the velocities u ,v and pressure p for the problem mentioned below

Why does pdsolve for my system does't work?

$
0
0

This is my program, I need to solve that differential equation but when i click on the pdsolve I don't get any result, do you know why?

thank you

internal error from pdsolve when HINT is used. Command used to work OK before

$
0
0

This code used to work OK in an earlier version of Maple 2018. I do not know what changed and if it some change in Physics package that caused it.

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(r,0)=0,u(r,Pi)=0,u(0,theta)=0,u(1,theta)=f(theta);
sol:=pdsolve([pde,bc],u(r,theta),HINT = boundedseries(r = 0));

Now it gives the error 

Error, (in assuming) when calling 'assume'. Received: 'invalid arguments'

Workaround is to remove the HINT above. So the following now works

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(r,0)=0,u(r,Pi)=0,u(0,theta)=0,u(1,theta)=f(theta);
sol:=pdsolve([pde,bc],u(r,theta));

Should this error message show up when using the HINT option?

Maple 2018.2 with Physics package cloud version 205.

Here is screen shot showing it was working in Physics 170

 

Plotting a following PDE

$
0
0
restart;
PDE := diff(y(x,t), x,x,x,x)+(diff(y(x, t), t,t))=0;  
# Initial/boundary conditions 
  BCs:=y(0,t) = 0, y(1,t) = 0,D[1](y)(0,t)=0,D[1](y)(1,t)=0;

  ICs:=y(x,0) =0, D[2](y)(x,0)=1 ;
  num_solution := pdsolve(PDE, {BCs,ICs}, numeric); 
  num_solution :-plot3d(x=0..1, t=0..1);

1st Question:How to plot the 2D at point x=0.5?

 

2nd Question: How to use PDEplot?


how I can pdsolve these equations?

Calculating values of function of solutions of ODE or PDE in numerical solutions

$
0
0
restart;
#PDE
PDE := (diff(u(x,y), x,x))-1/x*(diff(u(x, y), x)) -x^2*(diff(u(x,y), y,y))= 2;
BCs:=u(0,t) = 0, u(1,t) = 0;

ICs:=u(x,0) =0, D[2](u)(x,0)=2 ;
num_sol := pdsolve(PDE, {BCs,ICs}, numeric); 
BCs := u(0, t) = 0, u(1, t) = 0;
ICs := u(x, 0) = 0, D[2](u)(x, 0) = 2;
num_sol := pdsolve(PDE, {BCs,ICs}, numeric);

 #ODE
ODE:=diff(y(x),x,x)+16*diff(y(x),x)=0;
 BCs:=y(0) =0, y(2)=3 ;
ode_num_sol:=dsolve({ODE,BCs},numeric);

Suppose that we solved numerically an ODE or PDE like above. 
How to calculate values of function y or u at special values x like analytical solutions?

For example; u(1,1)=? y(1)=? etc.

 

 

the_code.mw

Maple hangs in pdsolve on a standard PDE

$
0
0

Trying Maple on a textbook problem to verify my hand solution. 

But Maple pdsolve hangs with the mserver.exe tallomg almost 100% CPU and over 10 GB of RAM!

I waited for almost 20 minutes. Tried another time, same thing.

It is no problem if Maple can't solve this, but Maple seems to suffer from too many hangs when it is not able to solve a problem. I've had similar problems with dsolve also.

This is on windows 10, 64 bit with Maple 2018.2 With Physics updates version 218

restart;
PackageTools:-IsPackageInstalled("Physics Updates");

218

interface(showassumed=0);
infolevel[pdsolve]:=2;
pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+Q(x,t);
ic  :=  u(x,0)=f(x);
bc  :=  eval(diff(u(x,t),x),x=0)=A(t),eval(diff(u(x,t),x),x=1)=B(t);
sol:=pdsolve({pde,ic,bc},u(x,t)) assuming t>0,k>0;

then


* trying method "_Fn" for 2nd order PDEs   -> trying "linear_in_xt"   -> trying "BC_equal_0"
* trying method "_Cn_cn" for 2nd order PDEs
Trying travelling wave solutions as power series in tanh ...
Trying travelling wave solutions as power series in ln ...
Trying travelling wave solutions as power series in tanh ...
Trying travelling wave solutions as power series in ln ...
* trying method "Wave" for 2nd order PDEs   -> trying "Cauchy"   -> trying "SemiInfiniteDomain"   -> trying "WithSourceTerm"
* trying method "Heat" for 2nd order PDEs   -> trying "SemiInfiniteDomain"   -> trying "WithSourceTerm"
* trying method "Series" for 2nd order PDEs   -> trying "ThreeBCsincos"   -> trying "FourBC"   -> trying "ThreeBC"   -> trying "ThreeBCPeriodic"   -> trying "WithSourceTerm"      * trying method "_Fn" for 2nd order PDEs         -> trying "linear_in_xt"         -> trying "BC_equal_0"      * trying method "_Cn_cn" for 2nd order PDEs

And here is hangs. Notice that because both ends are Neumann, there is no unique solution to this problem.  So the solution will contain arbitrary constant. May be this is what made pdsolve hang? 

No it is not. Trying with only one end nonhomogeneous  Neumann, and the other end Dirichlet, it still hangs. The problem seems to be with one end is nonhomogeneous  Neumann, which is a function of time. So this hangs also (same place)

restart;
interface(showassumed=0);
infolevel[pdsolve]:=2;
pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+Q(x,t);
ic  :=  u(x,0)=f(x);
bc  :=  eval(diff(u(x,t),x),x=0)=A(t),eval(diff(u(x,t),x),x=1)=0;
sol:=pdsolve({pde,ic,bc},u(x,t)) assuming t>0,k>0;

And this also

restart;
interface(showassumed=0);
infolevel[pdsolve]:=2;
pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+Q(x,t);
ic  :=  u(x,0)=f(x);
bc  :=  eval(diff(u(x,t),x),x=0)=sin(t),eval(diff(u(x,t),x),x=1)=0;
sol:=pdsolve({pde,ic,bc},u(x,t)) assuming t>0,k>0;

But this does not hang

interface(showassumed=0);
infolevel[pdsolve]:=2;
pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+Q(x,t);
ic  :=  u(x,0)=f(x);
bc  :=  eval(diff(u(x,t),x),x=0)=1,eval(u(x,t),x=1)=0;
sol:=pdsolve({pde,ic,bc},u(x,t)) assuming t>0,k>0;

The issue seems to be when one end is nonhomogeneous  Neumann which is function of time. 

Is there a workaround so it does not hang? The complaint is that Maple hangs, and not that Maple unable to solve the PDE.

 

pdsolve gives PDEtools/eval/2) numeric exception: division by zero on basic first order PDE

$
0
0

Using Latest Physics updates (I am not sure when this started), pdsolve gives Error, (in PDEtools/eval/2) numeric exception: division by zero on the following problem from a HW from text book.

restart;
PackageTools:-IsPackageInstalled("Physics Updates");"220"


pde:=diff(w(x,t),t)+3*t*diff(w(x,t),x)=w(x,t);
ic:=w(x,0)=f(x);
sol:=pdsolve([pde,ic],w(x,t));

Error, (in PDEtools/eval/2) numeric exception: division by zero
 

Mathematica answer btw is 

pde = D[w[x, t], t] + 3 t D[w[x, t], x] == w[x, t];
ic = w[x, 0] == f[x];
sol = Simplify[DSolve[{pde, ic}, w[x, t], {x, t}]]

 

This is on Maple 2018.2 on windows 10 64 bit.

Any idea what is causing this and any workaround? Do others get the same exception?

 

why pdsolve only solves this wave PDE when telling it that speed is positive?

$
0
0

 

This is a Wave PDE inside disk. with fixed edge of disk,  and no theta dependency. initial position and velocity  given.

When using "c^2" for the  wave propagation speed, Maple only gives solution when also using assumptions to tell that c is positive.

restart; 
Physics:-Version()[2]; 
`2018, November 28, 1:35 hours, version in the MapleCloud: 224, version installed in this computer: 224`

And the PDE is 

pde := diff(u(r, t), t$2) = c^2*( diff(u(r,t), r$2)  + (1/r)* diff(u(r,t),r)  ) ; 
ic:=u(r,0)=1, eval( diff(u(r,t),t),t=0)=r/3; 
bc:=u(1,t)=0; 
sol:=pdsolve([pde, ic,bc], u(r, t)) assuming t>0;

sol:=()

Now adding assuming c>0, or "c::positive", or "c>=0", it solves it 

restart;
pde := diff(u(r, t), t$2) = c^2*( diff(u(r,t), r$2)  + (1/r)* diff(u(r,t),r)  ) ; 
ic:=u(r,0)=1, eval( diff(u(r,t),t),t=0)=r/3; 
bc:=u(1,t)=0; 
sol:=pdsolve([pde, ic,bc], u(r, t)) assuming t>0,c>=0;

Any idea why the assumption "c>0"  is needed when the speed is given as "c^2" ? I also tried assumption "c::real", but it still did not solve it.   It seems related to Maple using Laplace transform to solve it.

It seems to me the assumption c>0 should not needed here. But if it is, I'd like to learn why.

Maple 2018.2, windows 10

Update

Thanks to comment below

   " so u(r, 0)=1 (for all r), and u(1, t)=0 (for all t). So what is u(1,0)???"

I should have added "r>0,r<1".  The reason I did not, is that I copied the code to solve this from Mathematica. In Mathematica, it did not need this assumption to solve it. It seems to depend on the method of solution used by Mathematica vs. Maple to cause this difference.

But now I see it helps to have it there. With the above assumption, now, there is no need to do any assumption on "c" at all and it gives solution. adding c>0 or t>0 or c>=0, makes no change now.

restart;
pde := diff(u(r, t), t$2) = c^2*( diff(u(r,t), r$2)  + (1/r)* diff(u(r,t),r)  ) ; 
ic:=u(r,0)=1, eval( diff(u(r,t),t),t=0)=r/3; 
bc:=u(1,t)=0; 
sol:=pdsolve([pde, ic,bc], u(r, t)) assuming t>0,r>0,r<1;

 

 

Uval the derivation from pdsolve

$
0
0

Hello,

I have this problem with pdsolve , I need to know the value of dTf(x,y)/dy, but I knew just the value of Tf 

Pleas find attached the code


 

restart

with(plots); with(ExcelTools); with(Student[Calculus1])

restart

eq := diff(Tf(x, y), x) = diff(Tf(x, y), y, y):

Cl := {1 = Tf(0, y), (D[2](Tf))(x, 0) = 1, (D[2](Tf))(x, 1) = 1};

{1 = Tf(0, y), (D[2](Tf))(x, 0) = 1, (D[2](Tf))(x, 1) = 1}

(1)

pds := pdsolve(eq, Cl, numeric);

_m191894592

(2)

pp := pds:-value(x = 2, output = listprocedure);

[x = 2., y = proc (y) option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; evalf(y) end proc, Tf(x, y) = proc (y) local res, solnproc, outpoint, ndsol; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := trunc(evalhf(Digits)); outpoint := evalf(y); solnproc := proc (outpoint) local indepvals, depvals, vary, ndep, i; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; table( [( "soln_procedures" ) = array( 1 .. 1, [( 1 ) = (18446744073902277486)  ] ) ] ) indepvals := Vector(21, {(1) = .0, (2) = 0.5e-1, (3) = .1, (4) = .15, (5) = .2, (6) = .25, (7) = .3, (8) = .35, (9) = .4, (10) = .45, (11) = .5, (12) = .55, (13) = .6, (14) = .65, (15) = .7, (16) = .75, (17) = .8, (18) = .85, (19) = .9, (20) = .95, (21) = 1.0}, datatype = float[8]); if outpoint = "left" then return indepvals[1] elif outpoint = "right" then return indepvals[21] elif outpoint = "start" then return HFloat(0.0) elif not type(outpoint, 'numeric') then error "non-numeric input" end if; if outpoint < indepvals[1] or indepvals[21] < outpoint then error "requested %1 value must be in the range %2..%3", y, indepvals[1], indepvals[21] end if; depvals := Matrix(21, 1, {(1, 1) = .4999930801471113, (2, 1) = .5499968318884445, (3, 1) = .6000080871124441, (4, 1) = .6499977374209617, (5, 1) = .6999980446183738, (6, 1) = .7500003281451354, (7, 1) = .8000006534468979, (8, 1) = .850000137731867, (9, 1) = .8999998355209465, (10, 1) = .9499998529282891, (11, 1) = .9999999999999913, (12, 1) = 1.0500001470716935, (13, 1) = 1.1000001644790365, (14, 1) = 1.149999862268117, (15, 1) = 1.1999993465530858, (16, 1) = 1.2499996718548485, (17, 1) = 1.3000019553816105, (18, 1) = 1.3500022625790227, (19, 1) = 1.3999919128875402, (20, 1) = 1.4500031681115404, (21, 1) = 1.500006919852874}, datatype = float[8], order = C_order); vary := Vector(2, {(1) = .0, (2) = -0.5e-1}, datatype = float[8]); ndep := 1; if vary[ndep+1]-outpoint <> 0. then `pdsolve/interp1dto0d`(21, indepvals, 1, depvals, false, outpoint, vary); vary[ndep+1] := outpoint end if; [seq(vary[i], i = 1 .. ndep)] end proc; if not type(outpoint, 'numeric') then if member(outpoint, ["start", "left", "right"]) then return solnproc(y) elif outpoint = "solnprocedure" then return eval(solnproc) elif procname <> unknown then return ('procname')(y) else ndsol := pointto(solnproc("soln_procedures")[1]); return ('ndsol')(y) end if end if; try res := solnproc(outpoint); res[1] catch: error  end try end proc]

(3)

``

rhs(op(3, pp))

proc (y) local res, solnproc, outpoint, ndsol; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := trunc(evalhf(Digits)); outpoint := evalf(y); solnproc := proc (outpoint) local indepvals, depvals, vary, ndep, i; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; table( [( "soln_procedures" ) = array( 1 .. 1, [( 1 ) = (18446744073902277486)  ] ) ] ) indepvals := Vector(21, {(1) = .0, (2) = 0.5e-1, (3) = .1, (4) = .15, (5) = .2, (6) = .25, (7) = .3, (8) = .35, (9) = .4, (10) = .45, (11) = .5, (12) = .55, (13) = .6, (14) = .65, (15) = .7, (16) = .75, (17) = .8, (18) = .85, (19) = .9, (20) = .95, (21) = 1.0}, datatype = float[8]); if outpoint = "left" then return indepvals[1] elif outpoint = "right" then return indepvals[21] elif outpoint = "start" then return HFloat(0.0) elif not type(outpoint, 'numeric') then error "non-numeric input" end if; if outpoint < indepvals[1] or indepvals[21] < outpoint then error "requested %1 value must be in the range %2..%3", y, indepvals[1], indepvals[21] end if; depvals := Matrix(21, 1, {(1, 1) = .4999930801471113, (2, 1) = .5499968318884445, (3, 1) = .6000080871124441, (4, 1) = .6499977374209617, (5, 1) = .6999980446183738, (6, 1) = .7500003281451354, (7, 1) = .8000006534468979, (8, 1) = .850000137731867, (9, 1) = .8999998355209465, (10, 1) = .9499998529282891, (11, 1) = .9999999999999913, (12, 1) = 1.0500001470716935, (13, 1) = 1.1000001644790365, (14, 1) = 1.149999862268117, (15, 1) = 1.1999993465530858, (16, 1) = 1.2499996718548485, (17, 1) = 1.3000019553816105, (18, 1) = 1.3500022625790227, (19, 1) = 1.3999919128875402, (20, 1) = 1.4500031681115404, (21, 1) = 1.500006919852874}, datatype = float[8], order = C_order); vary := Vector(2, {(1) = .0, (2) = -0.5e-1}, datatype = float[8]); ndep := 1; if vary[ndep+1]-outpoint <> 0. then `pdsolve/interp1dto0d`(21, indepvals, 1, depvals, false, outpoint, vary); vary[ndep+1] := outpoint end if; [seq(vary[i], i = 1 .. ndep)] end proc; if not type(outpoint, 'numeric') then if member(outpoint, ["start", "left", "right"]) then return solnproc(y) elif outpoint = "solnprocedure" then return eval(solnproc) elif procname <> unknown then return ('procname')(y) else ndsol := pointto(solnproc("soln_procedures")[1]); return ('ndsol')(y) end if end if; try res := solnproc(outpoint); res[1] catch: error  end try end proc

(4)


Thank you

Download mapleprime.mw

is possible to solve this pde via maple?


Euler-Bernoulli beam Guided/sliding at both ends

$
0
0

Hello, i am trying to solve the PDE

 (E*I) d4/dx4 [w(x,t)] + (rho*A) d2/dt[w(x,t)]=0

where w(x,t) = W(x) * cos (ω *t)

W(x) is the amplitude of the beam, the PDE is solved for W(x) by seperation of variables.

my first question is how to simplify the equations by replacing the e^ terms with alpha as done in the lecture, so that things look cleaner. And the next question is how do i proceed to input the Boundary conditions to solve the problem? I have looked in quite a lot of places but there is no example of a second or third order boundary condition(if that makes sense)

 beam_vibration_displacement.mwMech_vibrations.pdf

Solution control of a partial differential equation

$
0
0

Hello,

given is the lower, partial differential equation. I have solved this (hopefully) correctly. I was given the tip to do in Maple a simple control in which the solution is inserted into the original equation. Since I'm quite inexperienced in maple, I would like to ask you for help on how I do that best!

Thanks a lot!

Basis equation:

Solution:


what is difference between the following syntax for setting value of derivatives?

$
0
0

I've been using the following syntax to set boundary condition which is a derivative, when passing it to pdsolve. Say we want to set u(r,theta,t) to have insulated boundary conditions at r=1. So the BC will be

For example, to set derivative of u w.r.t. "r" to zero when r=1

       eval(  diff(u(r,theta,t),r), r=1) = 0;  #(1)

or using this syntax

       D[1](u)(1, theta, t) = 0;  #(2)

But now I find, on one example below, that the above no longer works.  I have to use this syntax (which I did not know about) for it to work

        D[1]*u(1, theta, t) = 0;  #(3)

Has something changed? why when using (3) pdsolve now gives result, but when using (2) or (1) it returns unevaluated? are the three semantically equivalent? when to use which syntax?

I am using Physics updates 265, Latest Maple 2018.2 

Here is an example showing the (1,2)  syntax no longer works, but the (3) syntax works

#articolo example 6.9.2
restart;

#using (1) syntax
pde := diff(u(r, theta, t), t) = (diff(u(r, theta, t), r)+r*(diff(u(r, theta, t), r, r))+(diff(u(r, theta, t), theta, theta))/r)/(25*r);
bc_on_r := eval(diff(u(r,theta,t),r), r=1) = 0;
bc_on_theta:= u(r,0,t)=0, u(r,Pi,t)=0;
ic := u(r,theta,0)=(r-1/3*r^3)*sin(theta);
pdsolve([pde, bc_on_r,bc_on_theta,ic], u(r, theta, t), HINT = boundedseries(r = [0]))

does not solve it.

restart;

#using (2) syntax
pde := diff(u(r, theta, t), t) = (diff(u(r, theta, t), r)+r*(diff(u(r, theta, t), r, r))+(diff(u(r, theta, t), theta, theta))/r)/(25*r);
bc_on_r := D[1](u)(1, theta, t) = 0; 
bc_on_theta:= u(r,0,t)=0, u(r,Pi,t)=0;
ic := u(r,theta,0)=(r-1/3*r^3)*sin(theta);
pdsolve([pde, bc_on_r,bc_on_theta,ic], u(r, theta, t), HINT = boundedseries(r = [0]))

does not solve it.

restart;

#using(3) syntax
pde := diff(u(r, theta, t), t) = (diff(u(r, theta, t), r)+r*(diff(u(r, theta, t), r, r))+(diff(u(r, theta, t), theta, theta))/r)/(25*r);
bc_on_r := D[1]*u(1,theta,t)=0;
bc_on_theta:= u(r,0,t)=0, u(r,Pi,t)=0;
ic := u(r,theta,0)=(r-1/3*r^3)*sin(theta);
pdsolve([pde, bc_on_r,bc_on_theta,ic], u(r, theta, t), HINT = boundedseries(r = [0]))

I've used syntax (1) before many times and it works. Here is an example where all three syntax work

pde:=diff(u(x,t),t)=k*diff(u(x,t),x$2);
bc:=eval(diff(u(x,t),x),x=0)=0,u(L,t)=0;
ic:=u(x,0)=f(x);
sol:=pdsolve([pde,bc,ic],u(x,t));

pdsolve gives

 Using syntax (2)

pde:=diff(u(x,t),t)=k*diff(u(x,t),x$2);
bc:=D[1](u)(0,t)=0,u(L,t)=0;
ic:=u(x,0)=f(x);
sol:=pdsolve([pde,bc,ic],u(x,t));

gives same answer as (1) and using syntax (3)

pde:=diff(u(x,t),t)=k*diff(u(x,t),x$2);
bc:=D[1]*u(0,t)=0,u(L,t);
ic:=u(x,0)=f(x);
sol:=pdsolve([pde,bc,ic],u(x,t));

The answer also looks like different and simpler, but I assume they are equivalent for now without looking too much into it.

Which syntax should one use as now I am really confused.

It looks like (3) is the one that should be used? Why the others did not work on first example? i.e. pdsolve did not give an answer at all?  And if (1,2,3) syntax are supposed to be equivalent, whysecond example gives slightly different looking answer when using one syntax vs. the other?

 

And finally to make things more confusing, here is an example where syntax (3) does not work, but syntax 1 and 2 work:

#articolo example 8.4.3
restart;
pde := diff(u(x, t), t) = (1/20)*(diff(u(x, t), x, x))+t;
bc := u(0, t) = 5, (u(1, t)+ D[1](u)(1, t)) = 10;
ic:= u(x, 0) = -40*x^2*(1/3)+45*x*(1/2)+5;
pdsolve([pde, bc,ic], u(x, t))

gives answer.

restart;
pde := diff(u(x, t), t) = (1/20)*(diff(u(x, t), x, x))+t;
bc := u(0, t) = 5, (u(1, t)+eval(diff(u(x,t),x),x=1))  = 10;
ic:= u(x, 0) = -40*x^2*(1/3)+45*x*(1/2)+5;
pdsolve([pde, bc,ic], u(x, t))

gives same answer. But

restart;
pde := diff(u(x, t), t) = (1/20)*(diff(u(x, t), x, x))+t;
bc := u(0, t) = 5, (u(1, t)+ D[1]*u(1, t)) = 10;
ic:= u(x, 0) = -40*x^2*(1/3)+45*x*(1/2)+5;
pdsolve([pde, bc,ic], u(x, t))

does not work.

Clearly there is something I do not understand between these 3 syntaxes and when to use which.

Using 265 version

Physics:-Version() "C:\Maple_updates\Physics+Updates.maple", 2018, December 22,     10:41 hours, version in the MapleCloud: 265, version     installed in this computer: not installed


downloaded today.

harmless assumptions changes the form of the final solution from pdsolve for wave pde

$
0
0

trying some examples from 209970-Exact-Solutions-For-PDE-And-Boundary--Initial-Conditions-2018

I noticed some answer change when adding assumptions which should not really cause the answer to change. Numerically, both answers seem to be the same. But one is series solution and the other with assumptions added uses integrals.

In wave pde on string where left end at x=0 and adding assumptions x>0,t>0 to pdsolve should produce the same form and it does on some problems but no on others.

Compare

#example 19, wave pde, on string left end fixed, right end moving, with source, no initial velocity
restart;
pde := diff(u(x, t), t$2) = 4*diff(u(x, t), x$2)+(1+t)*x;
bc := u(0,t)=0,u(Pi,t)=sin(t);
ic := u(x,0)=0,eval(diff(u(x,t),t),t=0)=0;

sol:=pdsolve([pde, bc,ic],u(x,t));  #1
sol:=pdsolve([pde, bc,ic],u(x,t)) assuming t>0; #2
sol:=pdsolve([pde, bc,ic],u(x,t)) assuming x>0; #3
sol:=pdsolve([pde, bc,ic],u(x,t)) assuming t>0,x>0;  #4

(1,2,3) above give same answer which is 

but (4) gives

Tried random points and numerically they are the same (set the sum to n=100 to evaluate).

my question is why would adding no assuming, or adding t>0 on its own or adding x>0 on its own give same answer, but adding  t>0,x>0 at same time give such a different looking soution.

I typically adding such assumptions to be safe, but here it seems to had some side effect I have not noticed before.

Physics:-Version(); "C:\Maple_updates\Physics+Updates.maple", 2018, December 22,     10:41 hours, version in the MapleCloud: 265, version installed in this computer: not installed

kernelopts(version)
  Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973

 

pdsolve gives wrong extra arguments: {method = Fourier}

$
0
0

Maple 2018.2.1, using Physicsupdates 266.

I undertsand method=Fourier needs boundary conditions to work, but I do not think this error message is right. Compare

 

restart;
pde := diff(u(r, theta), r, r)+diff(u(r, theta), theta, theta) = 0;
iv := u(2, theta) = 3*sin(2*theta)+1;
pdsolve([pde,iv], u(r,theta), method = Fourier)

With

restart;
pde := diff(u(r, theta), r, r)+diff(u(r, theta), theta, theta) = 0;
pdsolve(pde, u(r,theta), method = Fourier)

Error, (in pdsolve/info) wrong extra arguments: {method = Fourier}
 

pdsolve should return no solution instead. The way it is above, I thought at first I had wrong syntax with the "method = Fourier" settings and I think this error message can be misleading to a user.
 

Viewing all 445 articles
Browse latest View live