Items tagged with numeric numeric Tagged Items Feed

Hey

I have a simple question. 

In maple - when working with Ohm's Law.

Maple know how to calculate with e, but how can I show the result

I have calculated the following calculation:

(2e-4)/2

Maple returns the result:0.0001000000000

How do I maple show the result as 1e-4?

 

I have the following code:

restart;
PDE := diff(u(x, t), t) = diff(u(x, t), x, x)-sin(x+t)+cos(x+t);
IBC:= D[1](u)(0,t)=-sin(t),
D[1](u)(1,t)=-(u(1, t))^4+(cos(1+t))^4-sin(1+t),
u(x,0)=cos(x);

pds := pdsolve( PDE, [IBC], numeric, time = t, range = 0 .. 1,

spacestep = 0.1e-1, timestep = 0.1e-1,
errorest=true
)

 

And I want to plot the difference |pds(t,x) - cos(x+t)| in maple for x=1 and t=0..5

 

I thought to use the following piece of commands but I get an error:

P:=unapply(pds, t,x);
Q:=abs(P(t,x)-cos(x+t));
Q:-plot(x=1, t=0..1);

I get an error that Q isn't a module.

I thought that unapply is used for this case, can you help me with this simple task?

 

Thanks in advance.

 

So im trying to solve multiple ODES using dsolve(numeric) but I jsut cant get it to work.

I kep getting this one error: 

Error, (in f) unable to store '-HFloat(0.020918994979034728)-HFloat(0.09184018333019917)*I' when datatype=float[8]

 

This is my uploaded file 

(for some reason the uploaded file didnt show the error at the bottom so i just pasted it in the spot it would appear.

Download CHE504_HW5.mw

Given:

restart

dt := 2.07*0.254e-1

0.52578e-1

(1)

dto := 2.38*0.254e-1

0.60452e-1

(2)

ho := 5000

5000

(3)

``

Ltube := 5

5

(4)

``

Po := 2.5

2.5

(5)

To := 350

350

(6)

dp := 0.3e-2

0.3e-2

(7)

tau := 3

3

(8)

dpore := 5.2*10^(-9)

0.5200000000e-8

(9)

kfluid := 0.485e-1

0.485e-1

(10)

ksolid := 1.67

1.67

(11)

kpipe := 17

17

(12)

Cpair := 1.01

1.01

(13)

`μ_air` := 3.16*10^(-5)

0.3160000000e-4

(14)

rho := P(z)*(28.9*(1/1000))/(Rgas*(T(z)+273.15))

0.2890000000e-1*P(z)/(Rgas*(T(z)+273.15))

(15)

``

Rgas := 8.2057*10^(-5)

0.8205700000e-4

(16)

``

``

density calculation n/v = (P/RT)*mw_air, kg/m^3

``

`ρi` := (2.5*28.966)/(0.82057e-1*(350+273.15))

1.416186012

(17)

NULL

Volumetric flow, m^3/s

((1/60)*((1/300)*((1/1000)*(180*1000000)*.4535)*(1/24))*(1/60))/(1.416)

0.2224085844e-2

(18)

``

NULL

Superficial velocity, m/s

NULL

Vsi := evalf(%/((1/4)*Pi*(2.07*0.254e-1)^2))

1.024362190

(19)

Gs constant, kg/m^2-s

Error, missing operator or `;`

 

Gsi := `ρi`*Vsi

1.450687405

(20)

Gs := 1.45

1.45

(21)

``

``

NULL

Void fraction, epsilon,b

`εb` := .38+0.73e-1*(1+(0.525e-1/(0.3e-2)-2)^2/(0.525e-1/(0.3e-2))^2)

.5102677551

(22)

hi

hi := 3.6*kfluid*(dp*Gs/(`μ_air`*`εb`))^.365/dp

448.9928888

(23)

kinetic parameter

K := ln(19.837-13636/(T(z)+273.15))

ln(19.837-13636/(T(z)+273.15))

(24)

radial disperssion Coeff

Dr := Vs*dp/(9*(1+19.4*(dp/dt)^2))

0.3135309899e-3*Vs

(25)

thermal conductivity calculations

Kbs := kfluid*(`εb`+(1-`εb`)/(2/3*(1+kfluid/ksolid)))

0.5937050269e-1

(26)

``

Kbd := `εb`*Cpair*Gs*dp/(9*(1+19.4*(dp/dt)^2))

0.2342976727e-3

(27)

KB := Kbs+Kbd

0.5960480036e-1

(28)

Heat of reaction (deltaH), Find heat of formation for each reactant and product--> dHrxn = heat of formation(product)-heat of formation(reactant)

Error, missing operator or `;`

 

heat of formation = A + B*T + C*T^2

Hfacrolein := -7.076*10+(-5.59*10^(-2))*(273.15+350)+3.86*10^(-5)*(273.15+350)^2

-90.60509039

(29)

Hfwater := -238.41-0.122e-1*(350+273.15)+2.76*10^(-6)*(273.15+350)^2

-244.9406781

(30)

Hfpropylene := 3.62*10+(-6.49*10^(-2))*(273.15+350)+3.049*10^(-5)*(273.15+350)^2

7.59731748

(31)

`ΔHrxn` := Hfacrolein-Hfwater-Hfpropylene

146.7382702

(32)

Solving nodified Ergun Equation

f := (1-`εb`)*(1.75+(150*(1-`εb`))*`μ_air`/(dp*Gs))/`εb`

2.191735176

(33)

``

Determining U of the wall and Ueffective

``

``

Uwall := 1/(1/hi+ln(dto/dt)/(2*ksolid)+1/ho)

22.61972270

(34)

``

Ueff := 1/(1/Uwall+(1/2)*dt/(4*KB))

6.473624190

(35)

ode1 := Gs*(diff(Cprop(z), z))/rho = -K*Cprop(z)

0.4117046714e-2*(T(z)+273.15)*(diff(Cprop(z), z))/P(z) = -ln(19.837-13636/(T(z)+273.15))*Cprop(z)

(36)

ode2 := Gs*Cpair*(diff(T(z), z)) = -K*Cprop(z)*`ΔHrxn`-4*Ueff*(T(z)-350)/dt

1.4645*(diff(T(z), z)) = -146.7382702*ln(19.837-13636/(T(z)+273.15))*Cprop(z)-492.4968000*T(z)+172373.8800

(37)

ode3 := diff(P(z), z) = -f*Gs^2/(rho*dp)

diff(P(z), z) = -4.361346783*(T(z)+273.15)/P(z)

(38)

Ics1 := Cprop(0) = 0.3e-1

Cprop(0) = 0.3e-1

(39)

Ics2 := T(0) = 350

T(0) = 350

(40)

Ics3 := P(0) = 2.5

P(0) = 2.5

(41)

NULL

dsolve({Ics1, Ics2, Ics3, ode1, ode2, ode3}, {Cprop(z), P(z), T(z)})

Error, (in f) unable to store '-HFloat(0.020918994979034728)-HFloat(0.09184018333019917)*I' when datatype=float[8]

 

 

NULL

NULL

``

Dear friends,

 

I have a huge differential equation which I am trying to solve.

However, even solving it numerically, maple keeps evaluating it for a long time and then stops working! So there is no solution.

I just want to check if there is any solution to this differential equation at all!

Do you know a way with which maple can check if the differential equation is solvable?

 

Hai everyone

may i ask why solution have an error?

hope i have an answer

r

 

NULL

restart

with(plots):

Pr := 6.8:

Eq1 := (101-100*lambda)*(diff(f(eta), `$`(eta, 3)))+f(eta)*(diff(f(eta), `$`(eta, 2)))+2*delta*theta(eta)+2*delta*Nc*gamma(eta)-2*delta*Nr*phi(eta);

(101-100*lambda)*(diff(diff(diff(f(eta), eta), eta), eta))+f(eta)*(diff(diff(f(eta), eta), eta))+2*theta(eta)+2*gamma(eta)-2*phi(eta)

(1)

Eq2 := (101-100*lambda)*(diff(theta(eta), `$`(eta, 2)))+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*(diff(theta(eta), eta))^2;

(101-100*lambda)*(diff(diff(theta(eta), eta), eta))+6.8*f(eta)*(diff(theta(eta), eta))+3.40*(diff(theta(eta), eta))*(diff(phi(eta), eta))+3.40*(diff(theta(eta), eta))^2

(2)

Eq3 := (101-100*lambda)*(diff(phi(eta), `$`(eta, 2)))+Le*f(eta)*(diff(phi(eta), eta))+Nt*(diff(theta(eta), `$`(eta, 2)))/Nb;

(101-100*lambda)*(diff(diff(phi(eta), eta), eta))+.1*f(eta)*(diff(phi(eta), eta))+1.000000000*(diff(diff(theta(eta), eta), eta))

(3)

Eq4 := (101-100*lambda)*(diff(gamma(eta), `$`(eta, 2)))+Sc*s*(diff(theta(eta), `$`(eta, 2)))+Sc*f(eta)*(diff(gamma(eta), eta));

(101-100*lambda)*(diff(diff(gamma(eta), eta), eta))+.30*(diff(diff(theta(eta), eta), eta))+.6*f(eta)*(diff(gamma(eta), eta))

(4)

VBi := [10, 20, 30]:

etainf := 5:

bcs := f(0) = 0, (D(f))(0) = 0, (D(theta))(0) = -Bi*(1-theta(0)), phi(0) = 1, gamma(0) = 1, (D(f))(etainf) = 1, theta(etainf) = 0, phi(etainf) = 0, gamma(etainf) = 0;

f(0) = 0, (D(f))(0) = 0, (D(theta))(0) = -Bi*(1-theta(0)), phi(0) = 1, gamma(0) = 1, (D(f))(5) = 1, theta(5) = 0, phi(5) = 0, gamma(5) = 0

(5)

dsys := {Eq1, Eq2, Eq3, Eq4, bcs}:

for i to 3 do Bi := VBi[i]; dsol[i] := dsolve(dsys, numeric, continuation = lambda); print(Bi); print(dsol[i](0)) end do

Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile, please specify an approximate initial solution

 

NULL

NULL

 

Download soret.mw

 

 

 



thanks. I played around, and had problems implementing your ideas for one of the systems I'm interested in.I don't see a difference between this and what you had advised me on, but it gets an error.

any idea why?
or how to fix it?

thing1 := diff(B[1](t), t) = piecewise(t <= 500, 0.3e-2-(63/10000)*B[1](t)-(3/500)*B[2](t), -(3/10000)*B[1](t)):
thing2 := diff(B[1](t), t) = piecewise(t <= 500, 0.1e-1-(1/50)*B[1](t)-(13/625)*B[2](t), -(1/1250)*B[2](t)):
sol := dsolve({thing1, thing2, B[1](0) = 0, B[2](0) = 0}, {B[1](t), B[2](t)}, numeric, output = listprocedure); plots:-odeplot(sol, [B[1](t), B[2](t)], t = 450 .. 550);

Error, (in dsolve/numeric/DAE/explicit) unable to obtain the standard form of the DAE system due to the presence of leading dependent variables/derivatives in the piecewise: piecewise(t <= 500, 1/100-(1/50)*B[1](t)-(13/625)*B[2](t), -(1/1250)*B[2](t))-piecewise(t <= 500, 3/1000-(63/10000)*B[1](t)-(3/500)*B[2](t), -(3/10000)*B[1](t))
Error, (in plots/odeplot) curve is not fully specified in terms of the ODE solution, found additional unknowns {B[1](t), B[2](t)}


 Can anyone explain me how to use the next feature that you can find in ?dsolve,numeric,events,Round-off and simple triggers or refer me to a previous answer that explain this:

   This is primarily desired to be able to apply events for an ODE system that has been separated into disjoint cases dependent on the values of particular triggers (in which case you always want to use a form that provides the values just past the trigger point).

 Specially how to separate the ODE system into disjoint cases. Thanks in advanced.

hi.please remove error in attached file

thanks...gfhf.mw

Hi,

I have a first order differential eq. for some variable say $r(x)$, where $x$ is the independent variable.

After solving this differential equation numerically, I want to use its solution in other expression for $r(x)$ and plot the expession with $x$.

Please let me know how to do it.

Thanks in advance.

 

 

using FDM or FEM rather than dsolve?

ode.docxode.docx

Hi, Im now trying to run my code. But it took like years to even getting the results. may I know any solutions on how to get faster results? Because I have run this code for almost 4 hours yet there is still 'Evaluating...' at the corner left. And when I tried to stop the program, it will stop at 'R1...'.

 

Digits := 18;
with(plots):n:=1.4: mu(eta):=(diff(U(eta),eta)^(2)+diff(V(eta),eta)^(2))^((n-1)/(2)):
Eqn1 := 2*U(eta)+(1-n)*eta*(diff(U(eta), eta))/(n+1)+diff(W(eta), eta) = 0;
Eqn2 := U(eta)^2-(V(eta)+1)^2+(W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(U(eta), eta))-mu(eta)*(diff(U(eta), eta, eta))-(diff(U(eta), eta))*(diff(mu(eta), eta)) = 0;
Eqn3 := 2*U(eta)*(V(eta)+1)+(W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(V(eta), eta))-mu(eta)*(diff(V(eta), eta, eta))-(diff(V(eta), eta))*(diff(mu(eta), eta)) = 0;
bcs1 := U(0) = 0, V(0) = 0, W(0) = 0;
bcs2 := U(4) = 0, V(4) = -1;
R1 := dsolve({Eqn1, Eqn2, Eqn3, bcs1, bcs2}, {U(eta), V(eta), W(eta)}, initmesh = 30000, output = listprocedure, numeric);
Warning, computation interrupted
for l from 0 by 2 to 4 do R1(l) end do;
plot1 := odeplot(R1, [eta, U(eta)], 0 .. 4, numpoints = 2000, color = red);

 

Thankyou in advance :)

how can i improve doing the graph with various parameter

do anyone have abother numerical method in maple rather than rk45 felhberg

like keller box/homotopy/ or anything

i have attchassignment.mwsassignment.pdf

restart

with(plots)

%?

Eq1 := diff(f(eta), `$`(eta, 3))+(diff(f(eta), `$`(eta, 2)))*f(eta)-(diff(f(eta), eta))^2+4 = 0

diff(diff(diff(f(eta), eta), eta), eta)+(diff(diff(f(eta), eta), eta))*f(eta)-(diff(f(eta), eta))^2+4 = 0

(1)

%?

Eq2 := diff(theta(eta), `$`(eta, 2))+Pr*(diff(theta(eta), eta))*f(eta) = 0

diff(diff(theta(eta), eta), eta)+Pr*(diff(theta(eta), eta))*f(eta) = 0

(2)

%?

VPr := [0.1e-1, 0.2e-1, 0.3e-1]

etainf := 27

bcs := (D(f))(0) = 0, f(0) = 0, (D(theta))(0) = -1, (D(f))(etainf) = 2, theta(etainf) = 0

(D(f))(0) = 0, f(0) = 0, (D(theta))(0) = -1, (D(f))(27) = 2, theta(27) = 0

(3)

dsys := {Eq1, Eq2, bcs}

for i to 3 do Pr := VPr[i]; dsol[i] := dsolve(dsys, numeric); print(Pr); print(dsol[i](0)) end do

0.1e-1

[eta = 0., f(eta) = HFloat(0.0), diff(f(eta), eta) = HFloat(0.0), diff(diff(f(eta), eta), eta) = HFloat(3.4862842650940435), theta(eta) = HFloat(9.305856096452466), diff(theta(eta), eta) = HFloat(-0.9999999999999998)]

0.2e-1

[eta = 0., f(eta) = HFloat(0.0), diff(f(eta), eta) = HFloat(0.0), diff(diff(f(eta), eta), eta) = HFloat(3.4862842653392216), theta(eta) = HFloat(6.7064688361073745), diff(theta(eta), eta) = HFloat(-1.0)]

0.3e-1

[eta = 0., f(eta) = HFloat(0.0), diff(f(eta), eta) = HFloat(0.0), diff(diff(f(eta), eta), eta) = HFloat(3.4862842648459234), theta(eta) = HFloat(5.552583608770695), diff(theta(eta), eta) = HFloat(-0.9999999999999998)]

(4)

SDf1 := odeplot(dsol[1], [eta, f(eta)], 0 .. etainf, color = green, axes = box); SDf2 := odeplot(dsol[2], [eta, f(eta)], 0 .. etainf, color = red); SDf3 := odeplot(dsol[3], [eta, f(eta)], 0 .. etainf, color = blue)

display([SDf1, SDf2, SDf3], labels = ["&eta;", "f (&eta;)"], labeldirections = [horizontal, vertical], labelfont = [italic, 16, bold], axes = boxed, axesfont = [times, 14], thickness = 3)
%?

 

%?

SDfd1 := odeplot(dsol[1], [eta, diff(f(eta), eta)], 0 .. etainf, color = green, axes = box); SDfd2 := odeplot(dsol[2], [eta, diff(f(eta), eta)], 0 .. etainf, color = red); SDfd3 := odeplot(dsol[3], [eta, diff(f(eta), eta)], 0 .. etainf, color = blue)

%?

display([SDfd1, SDfd2, SDfd3], labels = ["&eta;", "f  ' (&eta;)"], labeldirections = [horizontal, vertical], labelfont = [italic, 16, bold], axes = boxed, axesfont = [times, 14], thickness = 3)

 

%?

`S&theta;1` := odeplot(dsol[1], [eta, theta(eta)], 0 .. etainf, color = green, axes = box); `S&theta;2` := odeplot(dsol[2], [eta, theta(eta)], 0 .. etainf, color = red); `S&theta;3` := odeplot(dsol[3], [eta, theta(eta)], 0 .. etainf, color = black)

display([`S&theta;1`, `S&theta;2`, `S&theta;3`], labels = ["&eta;", "&theta; (&eta;)"], labeldirections = [horizontal, vertical], labelfont = [italic, 16, bold], axes = boxed, axesfont = [times, 14], thickness = 3)

 

%?

`S&theta;d1` := odeplot(dsol[1], [eta, diff(theta(eta), eta)], 0 .. etainf, color = green, axes = box); `S&theta;d2` := odeplot(dsol[2], [eta, diff(theta(eta), eta)], 0 .. etainf, color = red); `S&theta;d3` := odeplot(dsol[3], [eta, diff(theta(eta), eta)], 0 .. etainf, color = black)

display([`S&theta;d1`, `S&theta;d2`, `S&theta;d3`], labels = ["&eta;", "&theta; '(&eta;)"], labeldirections = [horizontal, vertical], labelfont = [italic, 16, bold], axes = boxed, axesfont = [times, 14], thickness = 3)

 

%?

 

 

Download assignment.mws

 

HAM for convective boundary layer flows? please share

can  we share code or exchange code?

email me : faisalbasir91@gmail.com/+60182236765

Hi. I want to solve a system of equations. But I got this type of error. 

>restart;

>Digits := 15;
>with(plots):n:=0.7:Pr=1: mu(eta):=(diff(U(eta),eta)^(2)+diff(V(eta),eta)^(2))^((n-1)/(2)):
>Eqn1 := 2*U(eta)+(1-n)*eta*(diff(U(eta), eta))/(n+1)+diff(W(eta), eta) = 0:
>Eqn2 := U(eta)^2-(V(eta)+1)^2+(W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(U(eta), eta))-mu(eta)*(diff(U(eta), eta, eta))-(diff(U(eta), eta))*(diff(mu(eta), eta)) = 0:
>Eqn3 := 2*U(eta)*(V(eta)+1)+(W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(V(eta), eta))-mu(eta)*(diff(V(eta), eta, eta))-(diff(V(eta), eta))*(diff(mu(eta), eta)) = 0:
>Eqn4 := (W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(theta(eta), eta))-(mu(eta)*(diff(theta(eta), eta, eta))+(diff(mu(eta), eta))*(diff(theta(eta), eta)))/Pr = 0:
>bcs1 := U(0) = 0, V(0) = 0, W(0) = 0, theta(0) = 1:
>bcs2 := U(20) = 0, V(20) = -1, theta(20) = 0:
>R1 := dsolve({Eqn1, Eqn2, Eqn3, Eqn4, bcs1, bcs2}, {U(eta), V(eta), W(eta), theta(eta)}, initmesh = 20000, output = listprocedure, numeric);

Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 8, got 7

>for l from 0 by 2 to 20 do R1(l) end do;
>plot1 := odeplot(R1, [eta, theta(eta)], 0 .. 20, numpoints = 2000, color = red);

 

What is the problem actually because based on the paper that I refer to, there is only 7 bc. 

Can anyone help me?

Thankyou in advance.

I have the following two PDEs:

PDE := diff(u(x, t), t) = diff(u(x, t), x, x)+sin(x+t)-cos(x+t);

IBC:= D[1](u)(0,t)=-sin(t),
D[1](u)(1,t)=-sin(1+t),
u(x,0)=cos(x);

pds := pdsolve( PDE, [IBC], numeric, time = t, range = 0 .. 1,
spacestep = 1/32, timestep = 1/32,
errorest=true
)

 

PDE2 := diff(v(x, t), t) = diff(v(x, t), x, x);
IBC2:= D[1](v)(0,t)=0,
D[1](v)(1,t)=-0.000065*v(1, t)^4,
v(x,0)=1;

pds1 := pdsolve( PDE2, [IBC2], numeric, time = t, range = 0 .. 1,
spacestep = 1/32, timestep = 1/32,
errorest=true
);

 

Now, what I want to do with these two PDEs is the following:

 

For each h=timestep=spacestep  = 1/16 , 1/32 , 1/64 , 1/128 , 1/256

Calculate the error norm ||E||_h = sqrt(sum_{j=0}^{1/h} h* |u(j*h,tval)-v(j*h,tval)|^2)

where tval is some chosen point between 0 and 1 (this value is fixed for each spacestep chosen).

 

And then plot the graph of log ||E||_h vs. log h above.

 

What I don't know is how to extract each time the spacestep and its PDE's two solutions, does someone have a suggested script to use here?

 

 

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