Items tagged with numeric numeric Tagged Items Feed

I want to solve numerically the PDE:

u_xx + u_yy= = u^{1/2}+(u_x)^2/(u)^{3/2}

 

My assumptions are that  |sqrt(2)u_x/u|<<1 (but I cannot neglect the first term since its in my first order approximation of another PDE.

 

So I tried solving by using pdsolve in maple, but to no cigar.

 

Here's the maple file:

 nonlinear.mw

PDE := diff(diff(u(x, y), x), x)+diff(diff(u(x, y), y), y) = u^(1/2)+(diff(u(x, y), x))^2/u^(3/2); IBC := {D[1](u)*(1, t) = 0, D[2](u)*(x, 1) = 0, u(0, t) = 1, u(x, 0) = 1}; pds := pdsolve(PDE, IBC, type = numeric); pds:-plot3d(t = 0 .. 1, x = 0 .. 1, axes = boxed, orientation = [-120, 40], color = [0, 0, u])

diff(diff(u(x, y), x), x)+diff(diff(u(x, y), y), y) = u^(1/2)+(diff(u(x, y), x))^2/u^(3/2)

 

{D[1](u)*(1, t) = 0, D[2](u)*(x, 1) = 0, u(0, t) = 1, u(x, 0) = 1}

 

Error, (in pdsolve/numeric/process_PDEs) all dependent variables in PDE must have dependencies explicitly declared, got {u}

 

Error, `pds` does not evaluate to a module

 

``

 

Download nonlinear.mw

Hi,
I'm new at maple and have a problem/question with the rkf45 numerical ODE Solver.

At first, my computer need a lot of time to calculate an analytic solution.
Therefor, I use the numerical way.

I have the following second order ODE:
ODE:=m*((D@@2)(x))(t)+d*(D(x))(t)+k*x(t) = d*(eval(diff(y(x), x), x = t))+k*y(t)
where y(t) is a realy big piecewise function, defined by me.

My initial conditions are:
x(0) = 0, (D(x))(0) = 0

With dsolve, I get the solution x(t) and the first derivative x'(t). I'm able to plot them with odeplot.

But...

Problem 1:
I need also the second derivative x''(t).
On this page: http://www.maplesoft.com/support/help/maple/view.aspx?path=dsolve%2Frkf45there is an example (eq 13 and 14) where the second derivative is useable, but this doesn't work with my differential equation.
I have add 
(D(D(x)))(0) = 0
to my initial conditions but then, I got the error that only 2 initial conditions are required.
What could I do, so that rkf45 returns also the second derivative?

Problem 2:
And in addition to this, I want to calculate with x(t), x'(t), x''(t) but I found no way to use them.
Only plots are possible.
If I reduce y(t) to a minimum, I can do everything with the analytic solution: plot, d/dt, d2/dt2, +, -, ...
I tried also to convert the procedure to a function but in this case, there is no way to derivate it.

Many thanks...

restart;
odes:=diff(x1(t),t)*diff(x2(t),t$2)*sin(x1(t)*x2(t))+5*diff(x1(t),t$2)*diff(x2(t),t)*cos(x1(t)^2)+t^2*x1(t)*x2(t)^2=exp(-x2(t)^2),diff(x1(t),t$2)*x2(t)+diff(x2(t),t$2)*diff(x1(t),t)*sin(x1(t)^2)+cos(diff(x2(t),t$2)*x2(t))=sin(t);
ics:=x1(0)=1,D(x1)(0)=1,x2(0)=2,D(x2)(0)=2;
subs(diff(x1(t),t$2)=yp2,diff(x2(t),t$2)=yp4,diff(x1(t),t)=Y[2],diff(x2(t),t)=Y[4],x1(t)=Y[1],x2(t)=Y[3],{odes});
p:=proc(N,t,Y,YP)
local eqs,yp2,yp4;
YP[1]=Y[2];
YP[3]=Y[4];
eqs:=[yp2*Y[3]+yp4*Y[2]*sin(Y[1]^2)+cos(yp4*Y[3]) = sin(t), Y[2]*yp4*sin(Y[1]*Y[3])+5*yp2*Y[4]*cos(Y[1]^2)+t^2*Y[1]*Y[3]^2 = exp(-Y[3]^2)];
YP[2],YP[4]:=op(subs(fsolve(eqs,{yp2=1,yp4=2}),[yp2,yp4]));
end proc:
res:=dsolve(numeric,procedure=p,initial=array([1,1,2,2]),number=4,procvars=[x1(t),diff(x1(t),t),x2(t),diff(x2(t),t)],start=0,maxfun=0);
plots:-odeplot(res,[t,x1(t)],0..5,gridlines=true);

It's a long time to wait for the odeplot.

Any advice is appreciated.

Hi all,

restart;#part1
epsilon:=5:Delta1:=2:Delta2:=-4: N1:=1000:
dsys :={diff(x(t),t)=-I*Delta1*x(t)+y(t)+epsilon, diff(y(t),t)=-I*Delta2*y(t)+x(t)*z(t), diff(z(t),t)=-2*(conjugate(x(t))*y(t)+conjugate(y(t))*x(t))};

res:=dsolve(dsys union {x(0)=2*I,y(0)=0,z(0)=1},numeric,output=listprocedure);

P1:=plots:-odeplot(res,[[t,Im(y(t))],[t,Re(x(t))]],0..2):

/ d
{ --- x(t) = -2 I x(t) + y(t) + 5,
\ dt

d
--- y(t) = 4 I y(t) + x(t) z(t),
dt

d ____ ____ \
--- z(t) = -2 x(t) y(t) - 2 y(t) x(t) }
dt /
tit:=sprintf("D1=%g,D2=%g",Delta1,Delta2);
"D1=2,D2=-4"
plots[odeplot](res,[[t,Im(y(t))]],0..200,axes=boxed,titlefont=[SYMBOL,14],font=[1,1,18],color=black,linestyle=1,tickmarks=[3, 4],font=[1,1,14],thickness=2,titlefont=[SYMBOL,12]);
Warning, cannot evaluate the solution further right of 90.013890, maxfun limit exceeded (see ?dsolve,maxfun for details)

when I increase the time give this msn:

Warning, cannot evaluate the solution further right of 90.013890, maxfun limit exceeded (see ?dsolve,maxfun for details)

I want to find numerically the limit lim(y[m](t),m = infinity), do you have an idea how to do implement it in maple?

 

 

"h:=0.000065;  Theta3(t):=sum(exp(-m^(2)*Pi^(2)*t),m=-100..100);  y[0](t)=1;  t>0;  m>=1;  y[m](t)=1-h*int(Theta3(s)(y[m-1](t-s))^(4),s=0..t);  "

0.65e-4

 

proc (t) options operator, arrow; sum(exp(-m^2*Pi^2*t), m = -100 .. 100) end proc

 

Error, (in y[m]) too many levels of recursion

 

0 < t

 

1 <= m

 

Error, (in y[m]) too many levels of recursion

 

``

 

Download recursive_integral.mw

Hello, 

      I am a student doing some self study over the summer trying to work through some of the John Taylor computer problems from his classcial mechanics book. Currently I hit a snag that most likely comes from the fact I am not well acquinted with Maple for solving IVP and DE's (we used Matlab in my DE class). I just need to know how I remove the following error:

Error, (in dsolve/numeric/SC/IVPsetup) initial conditions must be numeric

Here is a copy of my code:

R := 5;
5
g := 9.8;
9.8
deq1 := {diff(x(t), [`$`(t, 2)]) = -g*sin(x(t))/R, x(0) = 20};
/ d / d \ \
{ --- |--- x(t)| = -1.960000000 sin(x(t)), x(0) = 20 }
\ dt \ dt / /
dsol1 := dsolve(deq1, numeric);
Error, (in dsolve/numeric/SC/IVPsetup) initial conditions must be numeric

My hunch is that I need to set x'(0)=0 or something like I do not have enough intial values to solve the problem, but I could be wrong. Anyway anyone who can point out my mistake feel free to do so! Thank you!

I have the following PDE system to solve numerically and I am not sure how to use maple to solve it.

 

v_t = v_{xx} for 0<x<1 , t>0

v(x,0)=1

v_x(1,t)=-hv^4(1,t) (where h is some numerical number);

v_x(0,t)=0

To solve this pde numerically I need to use the following condition on v(1,t):

v(1,t) = 1-h*\int_{0}^t \theta_3(\tau)v(1,t-\tau)^4d\tau

this is the numerical boundary condition, where \theta_3 is Jacobi theta3 function.

 

I don't see how can I use maple for this numerical pde problem.

 

Here's my attempt at solution:

[code]

 PDE := diff(v(x, t), t) = diff(v(x, t), x, x);

JACOBIINTEGRAL := int(JacobiTheta3(0, exp(-Pi^2*s))*v(1, t-s)^4, s = 0 .. t);

IBC := {`&PartialD;`(v(0, t))/`&PartialD;`(x) = 0, `&PartialD;`(v(1, t))/`&PartialD;`(x) = -0.65e-4*v(1, t)^4, v(x, 0) = 1};

pds := pdsolve(PDE, IBC, numeric, time = t, range = 0 .. 1, spacestep = 0.1e-2, timestep = 0.1e-2, numericalbcs = {v(1, t) = 1-0.65e-4*JACOBIINTEGRAL}, method = ForwardTimeCenteredSpace)

[/code]

But I get the next error message:

Error, (in pdsolve/numeric/process_IBCs) improper op or subscript selector

 

How to fix this or suggest me a better way to solve this pde numerically?

 

How to calculate the integral

(symbolically or/and numerically) with Maple?

 

Hello, dear experts.
I have a question...
solve the system of differential equations,where one of the initial conditions need to be chosen so thatcondition is metat the end of integration.
The task is not difficult, but I'm having trouble with the syntax.

1.I can't "pull"the desired function from the solution and find its value at a certain point.
I try to do so:
r_ravn:=s->subs(F,r(s));
evalf(r_ravn(s_end));
evalf(r_ravn(0));
but there is no result

2.In this case,instead of"for"it is better to use a while loop, but again the problem arises 1.
Tell me, please,how to implemen my program.

 

restart:
R:=0.3:
theta_min:=Pi/6:
theta_max:=Pi/2:
betta_max:=evalf(Pi/180*80);
p:=2*10^5:

theta0:=s->Pi/3/s_end*s+Pi/6:
r0:=s->R*sin(theta0(s)):
s_end:=evalf(R*(theta_max-theta_min)):

sol1:=solve({sin(betta_max)=c/r0(0)},{c});
const1:=0.1477211630;

betta0:=s->arcsin(const1/r0(s)):
betta:=s->arcsin(r(s)/r0(s)*sin(betta0(s))):
A:=s->cos(betta(s))/cos(betta0(s)):
T1:=s->rT1(s)/r(s):
T2:=s->T1(s)*tan(betta(s))^2:

step:=0.001:
delta:=0.001:
for i from 1 to 3000 do
r_min:=0.3-step:
rT1_n:=p*Pi*r_min^2/2/Pi/sin(theta_min):

sys := diff(rT1(s), s)-A(s)*T2(s)*cos(theta(s)),diff(theta(s), s)-A(s)/T1(s)*(p-T2(s)*sin(theta(s)/r(s))),diff(r(s),s)-A(s)*cos(theta(s)),diff(z(s),s)-A(s)*sin(theta(s));
fcns := {rT1(s),theta(s),r(s), z(s)};
F := dsolve({sys,rT1(0)=rT1_n, theta(0)=theta_min,r(0) = r_min, z(0) = 0}, fcns, numeric,output=listprocedure):
r_ravn:=s->subs(F,r(s)):
if abs(evalf(r_ravn(s_end))-R)=delta then break:
print(r_min):
end if:
end do:

r_ravn:=s->subs(F,r(s));
evalf(r_ravn(s_end));
evalf(r_ravn(0));
plot([r_ravn(s),r(s)],s=0..s_end);

Is it possible to somehow extract a derivative from numeric solution of partial differential equation?

I know there is a command that does it for dsolve but i couldn't find the same thing for pdsolve.

The actual problem i have is that i have to take a numeric solution, calculate a derivative from it and later use it somewhere else, but the solution that i have is just a set of numbers an array of some sort and i can't really do that because obviously i will get a zero each time.

Perhaps there is a way to interpolate this numeric solution somehow?

I found that someone asked a similar question earlier but i couldn't find an answer for it.

Hey there,

I've a numerical solved system of differential equations, which depend on one argument and one index. I can solve it, but when I try plot it I have this error: Error, (in plot) two lists or Vectors of numerical values expected.

Could anyone help me figure out what I'm doing wrong?

 

> restart;
> A := 115.1558549; B := .3050464658; n := 3; f0 := 0.5e-4;
               
>f:=theta->f0*(cos(arcsin(sin(theta)/n)))^2;
  I0:=Ir(z)+sum(Is[k](z),k=1..20);

> alpha := [0, 1, 2, 3, 4, 5, 6];

Theta := [3*Pi*(1/180), 6*Pi*(1/180), 9*Pi*(1/180), 12*Pi*(1/180), 15*Pi*(1/180), 18*Pi*(1/180), 21*Pi*(1/180), 24*Pi*(1/180), 27*Pi*(1/180), 30*Pi*(1/180), 33*Pi*(1/180), 36*Pi*(1/180), 39*Pi*(1/180), 42*Pi*(1/180), 45*Pi*(1/180), 48*Pi*(1/180), 51*Pi*(1/180), 54*Pi*(1/180), 57*Pi*(1/180), 60*Pi*(1/180)];

>G:= theta->A*sin(theta)*cos(2*arcsin((sin(theta)/n)))/((1+sin(theta)^2/B^2)*cos(arcsin(sin(theta)/n)));

>for j from 1 to 7 do
d1 := diff(Ir(z), z) = -sum(G(Theta[k])*Ir(z)*Is[k](z)/I0,k=1..20)-alpha[j]*Ir(z)-sum(f(Theta[k])*Ir(z),k=1..20):
d2 := diff(Is[1](z), z) = G(Theta[1])*Ir(z)*Is[1](z)/I0-alpha[j]*Is[1](z)+f(Theta[1])*Ir(z):
d3 := diff(Is[2](z), z) = G(Theta[2])*Ir(z)*Is[2](z)/I0-alpha[j]*Is[2](z)+f(Theta[2])*Ir(z):
d4 := diff(Is[3](z), z) = G(Theta[3])*Ir(z)*Is[3](z)/I0-alpha[j]*Is[3](z)+f(Theta[3])*Ir(z):
d5 := diff(Is[4](z), z) = G(Theta[4])*Ir(z)*Is[4](z)/I0-alpha[j]*Is[4](z)+f(Theta[4])*Ir(z):
d6 := diff(Is[5](z), z) = G(Theta[5])*Ir(z)*Is[5](z)/I0-alpha[j]*Is[5](z)+f(Theta[5])*Ir(z):
d7 := diff(Is[6](z), z) = G(Theta[6])*Ir(z)*Is[6](z)/I0-alpha[j]*Is[6](z)+f(Theta[6])*Ir(z):
d8 := diff(Is[7](z), z) = G(Theta[7])*Ir(z)*Is[7](z)/I0-alpha[j]*Is[7](z)+f(Theta[7])*Ir(z):
d9 := diff(Is[8](z), z) = G(Theta[8])*Ir(z)*Is[8](z)/I0-alpha[j]*Is[8](z)+f(Theta[8])*Ir(z):
d10 := diff(Is[9](z), z) = G(Theta[9])*Ir(z)*Is[9](z)/I0-alpha[j]*Is[9](z)+f(Theta[9])*Ir(z):
d11 := diff(Is[10](z), z) = G(Theta[10])*Ir(z)*Is[10](z)/I0-alpha[j]*Is[10](z)+f(Theta[10])*Ir(z):
d12 := diff(Is[11](z), z) = G(Theta[11])*Ir(z)*Is[11](z)/I0-alpha[j]*Is[11](z)+f(Theta[11])*Ir(z):
d13 := diff(Is[12](z), z) = G(Theta[12])*Ir(z)*Is[12](z)/I0-alpha[j]*Is[12](z)+f(Theta[12])*Ir(z):
d14 := diff(Is[13](z), z) = G(Theta[13])*Ir(z)*Is[13](z)/I0-alpha[j]*Is[13](z)+f(Theta[13])*Ir(z):
d15 := diff(Is[14](z), z) = G(Theta[14])*Ir(z)*Is[14](z)/I0-alpha[j]*Is[14](z)+f(Theta[14])*Ir(z):
d16 := diff(Is[15](z), z) = G(Theta[15])*Ir(z)*Is[15](z)/I0-alpha[j]*Is[15](z)+f(Theta[15])*Ir(z):
d17 := diff(Is[16](z), z) = G(Theta[16])*Ir(z)*Is[16](z)/I0-alpha[j]*Is[16](z)+f(Theta[16])*Ir(z):
d18 := diff(Is[17](z), z) = G(Theta[17])*Ir(z)*Is[17](z)/I0-alpha[j]*Is[17](z)+f(Theta[17])*Ir(z):
d19 := diff(Is[18](z), z) = G(Theta[18])*Ir(z)*Is[18](z)/I0-alpha[j]*Is[18](z)+f(Theta[18])*Ir(z):
d20 := diff(Is[19](z), z) = G(Theta[19])*Ir(z)*Is[19](z)/I0-alpha[j]*Is[19](z)+f(Theta[19])*Ir(z):
d21 := diff(Is[20](z), z) = G(Theta[20])*Ir(z)*Is[20](z)/I0-alpha[j]*Is[20](z)+f(Theta[20])*Ir(z):
dsys := {d1, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, d2, d20, d21, d3, d4, d5, d6, d7, d8, d9}:
dSol[j] := dsolve({op(dsys), Ir(0) = 1, Is[1](0) = 0.1e-1, Is[2](0) = 0.1e-1, Is[3](0) = 0.1e-1, Is[4](0) = 0.1e-1, Is[5](0) = 0.1e-1, Is[6](0) = 0.1e-1, Is[7](0) = 0.1e-1, Is[8](0) = 0.1e-1, Is[9](0) = 0.1e-1, Is[10](0) = 0.1e-1, Is[11](0) = 0.1e-1, Is[12](0) = 0.1e-1, Is[13](0) = 0.1e-1, Is[14](0) = 0.1e-1, Is[15](0) = 0.1e-1, Is[16](0) = 0.1e-1, Is[17](0) = 0.1e-1, Is[18](0) = 0.1e-1, Is[19](0) = 0.1e-1, Is[20](0) = 0.1e-1}, [Ir(z), Is[1](z), Is[2](z), Is[3](z), Is[4](z), Is[5](z), Is[6](z), Is[7](z), Is[8](z), Is[9](z), Is[10](z), Is[11](z), Is[12](z), Is[13](z), Is[14](z), Is[15](z), Is[16](z), Is[17](z), Is[18](z), Is[19](z), Is[20](z)], numeric);
end do:


>for j from 1 to 7 do
dSol[j](0.4);
as:='as':
for l from 1 to 20 do
as[l]:=[Theta[l],rhs(dSol[j](0.4)[2+l])];
od:
plo[j]:=convert(as,listlist);
od:


>plot(plo[2],plo[1]);
Error, (in plot) two lists or Vectors of numerical values expected

Hello all.

Need help. 

My project are too slow calculate integrals. What can i do to speed up numerical integration?

Thanks all.
MP_1.mw

I'm currently having some difficulties in solving a system of differential equations numerically.

This is my code.

 

Let us consider the definite integral

J:=int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1);

Maple fails with it, Mathematica 10.1 finds it in terms of  special functions. Let us look at the integrand:
plot(x-(-x^5+1)^(1/5), x = 0 .. 1);

We see the expression under the modulus changes its sign at the unique point of RealRange(0,1). Therefore

solve(x-(-x^5+1)^(1/5));


Then

J:= int(-x+(-x^5+1)^(1/5), x = 0 .. (1/2)*2^(4/5))+int(x-(-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1);

which outputs a complicated expression

(1/8)*2^(4/5)*(4*hypergeom([-1/5, 1/5], [6/5], 1/2)-2^(4/5))+(1/2)*2^(4/5)*((1/2)*2^(1/5)-(1/4)*2^(4/5))-(1/25)*Pi*csc((1/5)*Pi)*(-(25/2)*sin((1/5)*Pi)*GAMMA(4/5)*2^(4/5)*hypergeom([-1/5, 1/5], [6/5], 1/2)/Pi+(5/4)*sec((3/10)*Pi)*cos((1/10)*Pi)*2^(3/5)*Pi^(1/2)*csc((3/10)*Pi)/GAMMA(7/10))/GAMMA(4/5).

At the same time we have

int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1, numeric);

                          0.5000000000

How to obtain 1/2 symbolically?






Hi guys,

I'm studying a system of six differential equations. Given the fact that the system cannot be solved symbolically, I've tried the numeric procedure, and it works. I proceeded like this :

soleqd:=dsolve(sysd2,numeric,var);

then i checked if maple could calculate the solutions for given values of t. It works for t=0, t=0.5, t=1,t=2,...,t=5. The solutions are all real numbers.

But when i try to draw a graphic representation of the solutions, it doesn't work. I do :

ff1:=t->subs(soleqd(t),u[1](t));
gg1:=t->subs(soleqd(t),nu[1](t));

Then :

plot(['ff1(t)','gg1(t)',t=0..5],u[1]=0...1,nu[1]=0...1);

(The square brackets are indices)

Now maple answers that it is "unable to evaluate the function to numeric values in the region". I went to the help page but no solution seems to work. I can't figure it out by myself. Does anybody notice something wrong with my code ?

Thank you for your time,

Best regards,

Louis

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