dharr

Dr. David Harrington

8455 Reputation

22 Badges

21 years, 30 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

I corrected D^2 to D@@2, and knf = .8154646474. has two decimal points, so I deleted the second. Then it works, but your f and theta are just constant for the boundary conditions you have chosen.
 

restart;

with(plots):

ODES := (diff(f(eta), `$`(eta, 4)))/((1-phi1)^2.5*(1-phi2)^2.5*((1-phi2)*(1-phi1+phi1*rhos1/rhosf)+phi2*rhos2/rhosf))+S*(f(eta)*(diff(f(eta), `$`(eta, 3)))-3*(diff(f(eta), `$`(eta, 2)))-eta*(diff(f(eta), `$`(eta, 3)))-(diff(f(eta), eta))*(diff(f(eta), `$`(eta, 2)))) = 0,

(khnf/kf+(4/3)*R)*(diff(theta(eta), `$`(eta, 2)))/((1-phi2)*(1-phi1+phi1*rhos1*cp1/(rhosf*cpf))+phi2*rhos2*cp2/(rhosf*cpf))+S*Pr*(f(eta)*(diff(theta(eta), eta))-eta*(diff(theta(eta), eta))-gamma*(eta^2*(diff(theta(eta), `$`(eta, 2)))-2*eta*f(eta)*(diff(theta(eta), `$`(eta, 2)))-eta*(diff(f(eta), eta))*(diff(theta(eta), eta))+f(eta)*(diff(f(eta), eta))*(diff(theta(eta), eta))+f(eta)^2*(diff(theta(eta), `$`(eta, 2))))) = 0;
 

(diff(diff(diff(diff(f(eta), eta), eta), eta), eta))/((1-phi1)^2.5*(1-phi2)^2.5*((1-phi2)*(1-phi1+phi1*rhos1/rhosf)+phi2*rhos2/rhosf))+S*(f(eta)*(diff(diff(diff(f(eta), eta), eta), eta))-3*(diff(diff(f(eta), eta), eta))-eta*(diff(diff(diff(f(eta), eta), eta), eta))-(diff(f(eta), eta))*(diff(diff(f(eta), eta), eta))) = 0, (khnf/kf+(4/3)*R)*(diff(diff(theta(eta), eta), eta))/((1-phi2)*(1-phi1+phi1*rhos1*cp1/(rhosf*cpf))+phi2*rhos2*cp2/(rhosf*cpf))+S*Pr*(f(eta)*(diff(theta(eta), eta))-eta*(diff(theta(eta), eta))-gamma*(eta^2*(diff(diff(theta(eta), eta), eta))-2*eta*f(eta)*(diff(diff(theta(eta), eta), eta))-eta*(diff(f(eta), eta))*(diff(theta(eta), eta))+f(eta)*(diff(f(eta), eta))*(diff(theta(eta), eta))+f(eta)^2*(diff(diff(theta(eta), eta), eta)))) = 0

BCS:= f(0) = 0, ((D@@2)(f))(0) = 0, (D(theta))(0) = 0, f(1) = 0, (D(f))(1) = 0, theta(1) = 1;

 
 

f(0) = 0, ((D@@2)(f))(0) = 0, (D(theta))(0) = 0, f(1) = 0, (D(f))(1) = 0, theta(1) = 1

params:={phi1 = .1, phi2 = .1, rhos1 = 2720, rhos2 = 2810, rhosf = 997.1, khnf = 1.083061737, kf = .613, cp1 = 893, cp2 = 960, cpf = 4179, Pr = 6.2, knf =.8154646474, S=0.5,R=0.5, gamma=0.5};

{Pr = 6.2, R = .5, S = .5, cp1 = 893, cp2 = 960, cpf = 4179, gamma = .5, kf = .613, khnf = 1.083061737, knf = .8154646474, phi1 = .1, phi2 = .1, rhos1 = 2720, rhos2 = 2810, rhosf = 997.1}

sol:=dsolve(eval({ODES,BCS},params),numeric);

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(8, {(1) = .0, (2) = .14285714285714277, (3) = .28571428571428553, (4) = .4285714285714284, (5) = .5714285714285713, (6) = .7142857142857142, (7) = .857142857142857, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = 1.0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = 1.0, (2, 6) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = 1.0, (3, 6) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = 1.0, (4, 6) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = 1.0, (5, 6) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = 1.0, (6, 6) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = 1.0, (7, 6) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = 1.0, (8, 6) = .0}, datatype = float[8], order = C_order); YP := Matrix(8, 6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(8, {(1) = .0, (2) = .14285714285714277, (3) = .28571428571428553, (4) = .4285714285714284, (5) = .5714285714285713, (6) = .7142857142857142, (7) = .857142857142857, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[8] elif outpoint = "order" then return 2 elif outpoint = "error" then return HFloat(-0.0) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [6, 8, [f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), theta(eta), diff(theta(eta), eta)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(6, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 6, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(6, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 6, X, Y, outpoint, yout, L, V) end if; [eta = outpoint, seq('[f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), theta(eta), diff(theta(eta), eta)]'[i] = yout[i], i = 1 .. 6)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[8] elif outpoint = "order" then return 2 elif outpoint = "error" then return HFloat(-0.0) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [6, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(6, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 6, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(6, {(1) = 0., (2) = 0., (3) = 0., (4) = 0., (5) = 0., (6) = 0.}); `dsolve/numeric/hermite`(8, 6, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 6)] end proc, (2) = Array(0..0, {}), (3) = [eta, f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), theta(eta), diff(theta(eta), eta)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [eta = res[1], seq('[f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), theta(eta), diff(theta(eta), eta)]'[i] = res[i+1], i = 1 .. 6)] catch: error  end try end proc

odeplot(sol,[[eta,f(eta)],[eta,theta(eta)]],0..1,color=[red,blue]);

 


 

Download dsolve.mw

series(HB1,r,3); gives the constant term and the term in r^2, but after that Maple seems to have a problem (same result with taylor)

The calculation is working, it is just taking forever. This can be seen by doing only 3 points, which produces a plot.

plot(evalf(eval(s__avg,[f=20e3,D_=0.2])),t=100e-6..200e-6,adaptive=false,sample=[100e-6,150e-6,200e-6],style=point,symbolsize=20);

Plotting with adaptive=false, numpoints=49 works, but you don't have good resolution on your steps. You can play around with the tradoff of accuracy and time.

You are numerically approximating an integral many times. It seems like normally you would use a sampled signal, and then the sliding average would reduce to a sum (add in Maple) and would be a much simpler calculation.

sliding.mw

display combines plots. (For future reference it is helpful if you directly upload your worksheet using the big green up arrow.)
 

restart;

with(plots):

alpha := 0.1;
beta := 0.1;
mu := 0.5;
u := 0.5;
v := 1;
gamma = 0.1;
 

.1

.1

.5

.5

1

gamma = .1

Eq := -2*sigma*alpha*beta*mu*u - sigma*alpha*beta^2*u*v - 2.0*mu*alpha*beta^2*u*v - gamma^2*k^2*alpha*beta*u + beta*sigma^2*v + sigma^3 + 2*mu*sigma^2 - alpha*beta*sigma^2*u + sigma*beta^2*u*v + gamma^2*k^2*sigma + 2.0*mu*beta*sigma*v + 2.0*mu*beta^2*u*v;
p1:=implicitplot(Eq, k = 0 .. 10, sigma = -0.1 .. 0.1):

0.995e-1*sigma+0.4500e-2-0.5e-2*gamma^2*k^2+1.095*sigma^2+sigma^3+gamma^2*k^2*sigma

[k1,0], [k2,0], [k3,0], ...) , where k_{n}=2*n*Pi/L and the domain [0,L]

L:=10.0;
p2:=pointplot([seq([2*n*Pi/L,0],n=0..15)],color=red,symbolsize=15):
display(p1,p2);

10.0

 


 

Download plots.mw

In the DEs x and y should be x(t) and y(t) (I thought this was always true in Maple):

sys:=D(x)(t)=v1(x(t),y(t)),D(y)(t)=v2(x(t),y(t));

Note that the ditto used to be " but is now %, so that has to be changed also.

The post suggests the Greek letter was required, then the OP's later comments suggest otherwise. But the OPs use of unevaluation quotes works to give the posted plot, at least in Maple 2017.

plot(eta^2,eta=0..1,labels = [eta, 'Nu[a]'(eta)], labeldirections=[horizontal,vertical]);

 

 

Download plot.mw

The error message is

Error, (in pdsolve/sys/info) the HINTs programmed for PDE systems are: {"as is", `*`, `+`, TWS, tws}; received: HINT = F[1](t)*F[2](r*sin(phi))

i.e., an arbitrary function hint is not available for a system. In the case of a single pde, F(t)*G(r)*H(phi) should work.

HINT=`*` works here to give a separated solution.

If you know it is periodic with period 12, then a Fourier series is the simplest choice. I went to n=3, with 7 parameters for 12 data points, and I guess you could go higher, but at some point you are overfitting.

Download Fit.mw

Your immediate problem is the N_y in the second for statement has an extra space between N and _y. Removing the space gets rid of the error message.

Use KroneckerDelta instead of kroneckerdelta, and since it is in the Physics package, you will have to use with(Physics) at the beginning (or perhaps you don't want it to evaluate?)

You have a matrix element in the quantum mechanics sense, but how do you want to generate a Maple Matrix? Do you want Nx*Ny rows and Nx*Ny columns each with order l=1, p=2; l=1, p=2; l=1, ..., p=N_x, l=2, p=1, etc? So then the  <l,p|H|l_prim,p_prim> element would go in H[l*N_y+p, l_prim*N_y+p_prim] entry (that's probably not right but I'll let you figure it out)

Your if statements don't test l_prim or p_prim.

You can test for even and odd by: if p::even then ...   ; if p::odd then

My tendency would be to just make four nested loops for l, p, l_prim, and p_prim and then just have a single complicated if statement to deal with the various cases.

(With this complex code I'd use 1-D math or a code edit region for ease of debugging.)
 



 

A degree 6 polynomial doesn't have a general symbolic solution, so you will need to provide values for at least some variables in the coefficients to get an explicit numerical or symbolic solution. (For simpler ploynomials you can give solve the option explicit.)

For future reference, you should upload your worksheet using the big green up arrow.

You are giving dsolve 60 differential equations and also 15 algebraic equations (final[k]), but then you are giving 75 initial conditions. The algebraic equations are just giving values to variables, so you should just substitute these into the differential equations and give dsolve 60 differential equations and 60 initial conditions in 60 variables.

[Edit: OPs uploaded worksheet is modified and is now producing output]

Probably you intended to give kappa and lambda numerical values and forgot. (If you really want them as parameters then use the parameters= option to dsolve - see the help page)

Do(%TextArea0(Enabled)) returns true (and not "true"). I find the Do mechanism easier to integrate into other code for this reason.

Seems there should be a simpler way, but you can do it step by step.

Download sums.mw

sigma[CNT] = 0.1e7; should be sigma[CNT] := 0.1e7;

In general it is helpful for us to solve your problems if you upload your worksheet using the fat green up arrow in the editor.

First 55 56 57 58 59 60 61 Last Page 57 of 83