Maple 2018 Questions and Posts

These are Posts and Questions associated with the product, Maple 2018

Good day,
 

1. Please I need your greatest help. Can anyone please help me to run the examples on the attached papers on Maple software?

 2. Also help me to plot the graphs along with the exact solution

 3. If possible with tables

 I tried but did not get the results as expected. I shall be very grateful if I can get assistance from you

 

Thanks
 

restart:

Digits:= trunc(evalhf(Digits)); #generally a very efficient setting

15

(1)

Setup of BVP system:

#ordinary differential equations:
ODEs:= [
   #Eq 1:
   A1*(diff(f(x), x, x, x))/(A2*phi)-(diff(f(x), x))^2-M^2*(f(x))+f(x)*(diff(f(x), x, x)),

   #Eq 2:
   A4*Pr*phi*(diff(Theta(x), x, x))/A3+f(x)*(diff(Theta(x), x))+Q*Theta(x)
   
   #All these ODEs are implicitly equated to 0.
]:

<ODEs[]>; #Display the ODEs.

Vector(2, {(1) = A1*(diff(diff(diff(f(x), x), x), x))/(A2*phi)-(diff(f(x), x))^2-M^2*f(x)+f(x)*(diff(diff(f(x), x), x)), (2) = A4*Pr*phi*(diff(diff(Theta(x), x), x))/A3+f(x)*(diff(Theta(x), x))+Q*Theta(x)})

(2)

Params := Record(fw = .2, M = .5, Q = .5, Pr = 6.2, phi = 0.5e-1, rf = 997.1, kf = .613, cpf = 4179, btf = 0.3e-4, p1 = 0.1e-1, p2 = 0.5e-1, p3 = 0.5e-1, rs1 = 5100, ks1 = 3007.4, cps1 = 410, bs1 = 0.2e-3, rs2 = 2200, ks2 = 5000, cps2 = 790, bs2 = 0.5e-3, rs3 = 3970, ks3 = 40, cps3 = 765, bs3 = 0.4e-3, A1 = B1*p1+B2*p2+B3*p3, B1 = 1+2.5*phi+6.2*phi^2, B2 = 1+13.5*phi+904.4*phi^2, B3 = 1+37.1*phi+612.6*phi^2, B4 = (ks1+2*kf-2*phi*(kf-ks1))/(ks1+2*kf+phi*(kf-ks1)), B5 = (ks2+3.9*kf-3.9*phi*(kf-ks2))/(ks2+3.9*kf+phi*(kf-ks2)), B6 = (ks3+4.7*kf-4.7*phi*(kf-ks3))/(ks3+4.7*kf+phi*(kf-ks3)), A2 = 1-p1-p2-p3+p1*rs1/rf+p2*rs2/rf+p3*rs3/rf, A3 = B4*p1+B5*p2+B6*p3, A4 = 1-p1-p2-p3+p1*rs1*cps1/(rf*cpf)+p2*rs2*cps2/(rf*cpf)+p3*rs3*cps3/(rf*cpf))

Record(fw = .2, M = .5, Q = .5, Pr = 6.2, phi = 0.5e-1, rf = 997.1, kf = .613, cpf = 4179, btf = 0.3e-4, p1 = 0.1e-1, p2 = 0.5e-1, p3 = 0.5e-1, rs1 = 5100, ks1 = 3007.4, cps1 = 410, bs1 = 0.2e-3, rs2 = 2200, ks2 = 5000, cps2 = 790, bs2 = 0.5e-3, rs3 = 3970, ks3 = 40, cps3 = 765, bs3 = 0.4e-3, A1 = B1*p1+B2*p2+B3*p3, B1 = 1+2.5*phi+6.2*phi^2, B2 = 1+13.5*phi+904.4*phi^2, B3 = 1+37.1*phi+612.6*phi^2, B4 = (ks1+2*kf-2*phi*(kf-ks1))/(ks1+2*kf+phi*(kf-ks1)), B5 = (ks2+3.9*kf-3.9*phi*(kf-ks2))/(ks2+3.9*kf+phi*(kf-ks2)), B6 = (ks3+4.7*kf-4.7*phi*(kf-ks3))/(ks3+4.7*kf+phi*(kf-ks3)), A2 = 1-p1-p2-p3+p1*rs1/rf+p2*rs2/rf+p3*rs3/rf, A3 = B4*p1+B5*p2+B6*p3, A4 = 1-p1-p2-p3+p1*rs1*cps1/(rf*cpf)+p2*rs2*cps2/(rf*cpf)+p3*rs3*cps3/(rf*cpf))

(3)

LB, UB := 0, 1; BCs := [`~`[`=`](([f(x), diff(f(x), x), Theta])(LB), [fw, 1, 1])[], `~`[`=`](([diff(f(x), x), Theta])(UB), [0, 0])[]]

[(f(x))(0) = fw, (diff(f(x), x))(0) = 1, Theta(0) = 1, (diff(f(x), x))(1) = 0, Theta(1) = 0]

(4)

NBVs := [A1*(diff(f(x), x, x))(0) = C*`*f`, -A4*(diff(Theta(x), x))(0) = `Nu*`]; Nu := `Nu*`; Cf := `C*__f`; x0 := Array([LB])

NULL

Solve := module () local nbvs_rhs, Sol, Dsolve, ModuleApply, AccumData, ModuleLoad; export SavedData, Pos, Init;  nbvs_rhs := `~`[rhs](:-NBVs); Dsolve := proc (Sys, Params::(set(name = realcons))) option remember; Sol := dsolve(Sys, _rest, 'numeric'); AccumData(Params); eval(Sol) end proc; ModuleApply := subs(_Sys = {:-BCs[], :-NBVs[], :-ODEs[]}, proc ({ fw::realcons := Params:-fw, Pr::realcons := Params:-Pr, M::realcons := Params:-M, Q::realcons := Params:-Q, phi::realcons := Params:-phi }) Dsolve(_Sys, {_options}, {_rest}[]) end proc); AccumData := proc (params::(set(name = realcons))) local n, nbvs; if Sol::rtable then nbvs := seq(n = Sol[2, 1][1, Pos(n)], n = nbvs_rhs) else nbvs := `~`[`=`](nbvs_rhs, eval(nbvs_rhs, Sol(:-LB)))[] end if; SavedData[params] := Record[packed](params[], nbvs); return  end proc; ModuleLoad := eval(Init); Init := proc () Pos := proc (n::name) local p; option remember; member(n, Sol[1, 1], 'p'); p end proc; SavedData := table(); return  end proc; ModuleLoad() end module

NULL

colseq := [red, green, blue, brown]

#parameter values that remain fixed for the entire set of plots:
Pc:= phi=0.05:
 

#parameter values that remain fixed with each of the four plots::
Ps:= [
   [fw=0.2, Pr=6.2, M=0.5],
   [fw=0.2, Q=0.3, M=0.5],
   [fw=0.2, Pr=6.2, Q=0.3],
   [Q=0.3, Pr=6.2, M=0.5]
]:

#parameter value for each curve
Pv:= [
   Q=[0.2, 0.4, 0.6, 0.8],
   Pr=[0.7, 1.4, 2.1, 2.8],
   M=[0.6, 1.2, 1.8, 2.4],
   fw=[1, 2, 3, 4]
]:
      

for i to nops(Ps) do
   plots:-display(
      [seq(
         plots:-odeplot(
            Solve(lhs(Pv[i])= rhs(Pv[i])[j], Ps[i][], Pc),
            [x, Theta(x)], 'color'= colseq[j], 'legend'= [lhs(Pv[i])= rhs(Pv[i])[j]]
         ),
         j= 1..nops(rhs(Pv[i]))
      )],
      'axes'= 'boxed', 'gridlines'= false,
      'labelfont'= ['TIMES', 'BOLDOBLIQUE', 16],
      'caption'= nprintf(
         cat("\n%a = %4.2f, "$nops(Ps[i])-1, "%a = %4.2f\n\n"), (lhs,rhs)~(Ps[i])[]
      ),
      'captionfont'= ['TIMES', 16]
   )
od;

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

 

for i to nops(Ps) do plots:-display([seq(plots:-odeplot(Solve(lhs(Pv[i]) = rhs(Pv[i])[j], Ps[i][], Pc), [x, D(f(x))], 'color' = colseq[j], 'legend' = [lhs(Pv[i]) = rhs(Pv[i])[j]]), j = 1 .. nops(rhs(Pv[i])))], 'axes' = 'boxed', 'gridlines' = false, 'labelfont' = ['TIMES', 'BOLDOBLIQUE', 16], 'caption' = nprintf(cat(`$`("\n%a = %4.2f, ", nops(Ps[i])-1), "%a = %4.2f\n\n"), `~`[lhs, rhs](Ps[i])[]), 'captionfont' = ['TIMES', 16]) end do

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

 

ParamPlot2d := proc (Y::{`module`, procedure}, X::(name = range(realcons)), FP::(list(name = realcons)), { dsolveopts::(list({name, name = anything})) := [] }) plot(proc (x) options operator, arrow; Y(Solve(lhs(X) = x, FP[], 'abserr' = 0.5e-4, 'interpolant' = false, 'output' = x0, dsolveopts[])) end proc, rhs(X), 'numpoints' = 25, 'axes' = 'boxed', 'gridlines' = false, 'labelfont' = ['TIMES', 'BOLDOBLIQUE', 16], 'caption' = nprintf(cat(`$`("%a = %4.2f, ", nops(FP)-1), "%a = %4.2f"), `~`[lhs, rhs](FP)[]), 'captionfont' = ['TIMES', 16], _rest) end proc

#procedure that extracts Nusselt number from dsolve solution:
GetNu:= (Sol::Matrix)-> Sol[2,1][1, Solve:-Pos(:-Nu)]:

Q:= [0.2, 0.4, 0.6]:
plots:-display(
   [seq(
      ParamPlot2d(
         GetNu, fw= 1..4, [M= 0.5],
         'dsolveopts'= [Q= Q[k], Pr=6.2,  phi=0.05],
         'legend'= [Q= Q[k]], 'color'= colseq[k], 'labels'= [fw, Nu]
      ),
      k= 1..nops(Q)
   )]
);

Error, invalid input: ParamPlot2d expects value for keyword parameter dsolveopts to be of type list({name, name = anything}), but received [[.2, .4, .6] = .2, Pr = 6.2, phi = 0.5e-1]

 

NULL

Download surface_dinesh_paper.mw  please help me to solve the problem

Dear all,

consider two lists of complex values :

list1 := [l1,l2,l3,l4,l5]

list2 := [s1,s2,s3,s4,s5].

There is a set of second order differential equation

d^2u(k)/dt^2+I*A*du/dt-B*u=0

where A is sum of elements of list1 and list2 and B is multiplication of their element. Therefore,

d^2u[1](k)/dt^2+I*(l1+s1)*du[1]/dt-(l1*s1)*u[1]=0

d^2u[2](k)/dt^2+I*(l2+s2)*du[2]/dt-(l2*s2)*u[2]=0

d^2u[3](k)/dt^2+I*(l3+s3)*du[3]/dt-(l3*s3)*u[3]=0

d^2u[4](k)/dt^2+I*(l4+s4)*du[4]/dt-(l4*s4)*u[4]=0

d^2u[5](k)/dt^2+I*(l5+s5)*du[5]/dt-(l5*s5)*u[5]=0

How can I create a set of differential equations and initial conditions based on nops(list1), then solve this system of differential equations numerically in Maple.

since u[i] are function of k, next step is to transforme them to real space by inverse fourier transform.

finally save the results and plot them.

Note that for simplisity I wrote a linear equation but it is not. so, because of nonlinear terms it is not possible to use superposition of the solution. I have to take them as coupled system of equations.

====

for example

list1 := [ [0., -5.496799068*10^(-15)-0.*I], [.1, 5.201897725*10^(-16)-1.188994754*I], [.2, 6.924043163*10^(-17)-4.747763855*I], [.3, 2.297497722*10^(-17)-10.66272177*I], [.4, 1.159126178*10^(-17)-18.96299588*I] ] 

list2 :=[ [0., -8.634351786*10^(-7)-67.81404036*I], [.1, -0.7387644021e-5-67.76491234*I], [.2, -0.1433025271e-4-67.59922295*I], [.3, -0.2231598645e-4-67.25152449*I], [.4, -0.3280855430e-4-66.56357035*I] ]

where first element is k and the second value is l_i and s_i

the differential equation is

ode_u[i]:= diff(u[i](t),t$2)+I*(list1[i][2]+list2[i][2])*diff(u[i](t),t)-list1[1][2]*list2[2][2]*u[i](t)=0;

eta is in fourier space where k values are in list1[i][1].

We laso know that f(-k)= - f*(k) where f=list[i][2]

and u[i] as function of k, initially has a Gaussian shape at t=0 in fourier space..

Thanks in advance for your help

restart:
PDEtools[declare](f(x), prime = x):
PDEtools[declare](Theta(x), prime = x):
PDEtools[declare](Phi(x), prime = x):
N := 4; M := .1; Kp := .1; Gr := 0.1e-1; Gc := 0.1e-1; Pr := 1; S := 0.1e-1; Sc := .78; Kc := 0.1e-1; La := 1
f (x):=  sum((p^(i))*f [i] (x), i = 0 .. N) ;
Theta(x):=  sum((p^(i))*Theta[i] (x), i = 0 .. N) ;
Phi(x):= sum((p^(i))*Phi [i] (x), i = 0 .. N);
HPMEq1 := (1-p)*(diff(f(x), x, x, x))+p*(diff(f(x), x, x, x)+(1/2)*(diff(f(x), x, x))*f(x)-(M^2+Kp)*(diff(f(x), x)-La)+Gr*Theta(x)+Gc*Phi(x))
HPMEq2 := (1-p)*(diff(Theta(x), x, x))/Pr+p*((diff(Theta(x), x, x))/Pr+(1/2)*(diff(Theta(x), x))*f(x)+S*Theta(x))
HPMEq3 := (1-p)*(diff(Phi(x), x, x))/Sc+p*((diff(Phi(x), x, x))/Sc+(1/2)*(diff(Phi(x), x))*f(x)+Kc*Phi(x))
for i from 0 to N do equ[1][i] := coeff(HPMEq1, p, i) = 0 end do
for i from 0 to N do equ[1][i] := coeff(HPMEq2, p, i) = 0 end do
for i from 0 to N do equ[1][i] := coeff(HPMEq3, p, i) = 0 end do
cond[1][0] := f[0](0) = 0, (D(f[0]))(0) = 0, Theta[0](0) = 1, Phi[0](0) = 1, Theta[0](5) = 0, Phi[0](5) = 0, (D(f[0]))(5) = 1; for j to N do cond[1][j] := f[j](0) = 0, (D(f[j]))(0) = 0, Theta[j](0) = 0, Phi[j](0) = 0, Theta[j](5) = 0, Phi[j](5) = 0, (D(f[j]))(5) = 0 end do
for i from 0 to N do pdsolve({cond[1][i], equ[1][i]}, f[i](x)); f[i](x) := rhs(%) end do
f(x) := evalf(simplify(sum(f[n](x), n = 0 .. N))); convert(f(x), 'rational'); subs(x = 1, diff(f(x), x))

Please rectify the error
Thank you

Can Maple prove this simple identity  binomial(2*n, n)/2 = binomial(2*n-1, n-1) ,where n is integer and positive. Doing it manually is very easy. My attempt was unsuccessful:

is(binomial(2*n, n)/2=binomial(2*n-1, n-1)) assuming n::posint;

                                                       FAIL

Good day. 

I have been looking into the time series features in Maple and was eager to apply the models to one specific example containing 47 data points (attached).

When I run the ESM routine, Maple provides a forecast based on a (A,N,N) configuration. You will notice that the forecast for the following 12 data points is a constant value. I have also noticed this for several other data set examples and I would have expected the predictions to vary across the next 12 data points.

Does the (A,N,N) configuration in Maple automatically provide an optimal forecast and can anyone advise me on how to specify all possible combinations of (error, trend, season) models?

Thanks you for reading.

MaplePrimes_TS_Example.mw

Dear All

Same calculation, but Maple gave 2 different results, when I used 2 different input methods, using palettes and through Maple Tutors, respectively (image). Can someone explain to me the reason?

Good Day.

I have attached a worksheet for a time series that comprises 45 data points. I would like to investigate the overall demand (for forecasting purposes) and to isolate the underlying demand components; that is, trend, level, seasonal, and residual. However, I have difficulty in distinguishing each component in the plot as the colors appear to be similar and some may have relatively small values.

Does anyone know how to recolor these components so they appear to be more obvious? It would be also beneficial to isolate and plot each individual component - can that be done?

Thanks for your interest!

MaplePrimes_Time_Series.mw

Hello.

If I input 'floor(5.5)' in Maple 2018 I get the expected \lfloor 5.5 \rfloor thing.  I mean, with the special brackets typical for the floor notation.

However, if I try to place the floor notation onto a plot I get literally the string "floor(5.5)".  As in

  textplot([2, 2, 'floor(5.5)'])

The ' ' quotation marks ensure the delayed evaluation but I do not get the floor parentheses! 

Interestingly,

  textplot([2, 2, 'sqrt(5.5)'])

outputs the radical notation as expected.

How come I cannot produce a plot with the floor brackets notation in it?

Thanks

Minko

Pls see below worksheet. I want to compute the maximum number that appears in the Collatz series when starting with several starting numbers.

I calculate the maximum number appearing when starting with a specific number in procedure collatz. Then I want to calculate the maximum number appearing when calling different starting numbers in procedure collatz_max by calling collatz several times - collatz_max does not yet contain the handing of the results from collatz as the below error appears. If I only call collatz in collatz_max it return the right value, but in the loop or if I assign collatz to a variable within procedure collatz_max, calling collatz returns () as a result.

What do I do wrong?

Thanks for helping,

Oliver

Collatz.mws

restart

eq1 := (2*(r^2+a^2*cos(theta)^2))*(M*r-(1/2)*a^2-(1/2)*r^2)*(diff(f(r, theta), r, theta))+(2*(a^2*(M-r)*cos(theta)^2-M*r^2+a^2*r))*(diff(f(r, theta), theta))

2*(r^2+a^2*cos(theta)^2)*(M*r-(1/2)*a^2-(1/2)*r^2)*(diff(diff(f(r, theta), r), theta))+2*(a^2*(M-r)*cos(theta)^2-M*r^2+a^2*r)*(diff(f(r, theta), theta))

(1)

eq2 := sin(theta)*(r^2+a^2*cos(theta)^2)*(diff(f(r, theta), theta, theta))-cos(theta)*(diff(f(r, theta), theta))*(a^2*cos(theta)^2-2*a^2-r^2)

sin(theta)*(r^2+a^2*cos(theta)^2)*(diff(diff(f(r, theta), theta), theta))-cos(theta)*(diff(f(r, theta), theta))*(a^2*cos(theta)^2-2*a^2-r^2)

(2)

eq3 := -2*(r^2+a^2*cos(theta)^2)^2*(M*r-(1/2)*a^2-(1/2)*r^2)*sin(theta)*(diff(g(r, theta), r, r))+sin(theta)*(r^2+a^2*cos(theta)^2)^2*(diff(g(r, theta), theta, theta))+(4*(-(1/4)*cos(theta)^4*a^4+a^2*r*(M-(1/2)*r)*cos(theta)^2-M*a^2*r-(1/4)*r^4))*cos(theta)*(diff(g(r, theta), theta))-2*M*sin(theta)*(diff(g(r, theta), r))*(a^2+r^2)*(cos(theta)*a-r)*(cos(theta)*a+r)

-2*(r^2+a^2*cos(theta)^2)^2*(M*r-(1/2)*a^2-(1/2)*r^2)*sin(theta)*(diff(diff(g(r, theta), r), r))+sin(theta)*(r^2+a^2*cos(theta)^2)^2*(diff(diff(g(r, theta), theta), theta))+4*(-(1/4)*cos(theta)^4*a^4+a^2*r*(M-(1/2)*r)*cos(theta)^2-M*a^2*r-(1/4)*r^4)*cos(theta)*(diff(g(r, theta), theta))-2*M*sin(theta)*(diff(g(r, theta), r))*(a^2+r^2)*(cos(theta)*a-r)*(cos(theta)*a+r)

(3)

pdsolve([eq1, eq2, eq3])

[{f(r, theta) = _F1(r)+(Int((r^2+a^2*cos(theta)^2)/((cos(theta)+1)^(1/2)*(cos(theta)-1)^(1/2)), theta))*_C1/(2*M*r-a^2-r^2)}, [diff(diff(g(r, theta), r), r) = (sin(theta)*(sin(theta)^2*a^2-a^2-r^2)^2*(diff(diff(g(r, theta), theta), theta))-4*cos(theta)*((1/4)*a^4*sin(theta)^4+(-(1/2)*a^2+r*(M-(1/2)*r))*a^2*sin(theta)^2+(1/4)*(a^2+r^2)^2)*(diff(g(r, theta), theta))+2*M*sin(theta)*(diff(g(r, theta), r))*(a^2+r^2)*(sin(theta)^2*a^2-a^2+r^2))/(sin(theta)*(sin(theta)^2*a^2-a^2-r^2)^2*(2*M*r-a^2-r^2))]]

(4)

``

Download pde1.mw

SlitRecoil.mw

At line 46 I do some integrals of a probablity function obainted from complex amplitudes. The plot of the function is shown above. However, the integral suddlenly drops to almost nothing when I increase the limits from +/- 0.195 to +/-0.2. The transition actually occus at ~0.196 (not shown)

This makes no sense. It doesn't seem  from the plot that the step size could get so large as to miss the peak! However, I don't know how to change numerical integral step size to test that.

---Arthur (a.k.a. Traruh)

Hello. There is some system of differential equations with respect to the unknowns u1(x), u2(x), u3(x) with boundary conditions. Solved numerically using the dsolve command.
Is it possible to build a graph of a function of the form W=a*u1(x)+b*u2(x)+c*u3(x) based on this solution?

Thank you for your answers.

Hi

I want to solve two equations (Eqmin and Eqmax) numerically  and plot curves of Mmin and Mmax versus "sigma" in one frame, But the  second curve (Mmax) is not plotted !  What should I do? 
(We know that only real and positive roots are acceptable)
Eq.mw

eq1 := f(r)*((diff(g(t, phi, r), t))*a^2+(diff(g(t, phi, r), t))*r^2+a*(diff(g(t, phi, r), phi)))/(sqrt(-g(t, phi, r)^2*f(r)^2+1)*sqrt(-(r^2+a^2*cos(theta)^2)*(2*M*r-a^2-r^2)))

f(r)*((diff(g(t, phi, r), t))*a^2+(diff(g(t, phi, r), t))*r^2+a*(diff(g(t, phi, r), phi)))/((-g(t, phi, r)^2*f(r)^2+1)^(1/2)*(-(r^2+a^2*cos(theta)^2)*(2*M*r-a^2-r^2))^(1/2))

(1)

eq2 := (((-a*cos(theta)^2+a)*f(r)^2*g(t, phi, r)^2+a*cos(theta)^2-a)*(diff(g(t, phi, r), phi, t))+(g(t, phi, r)^2*f(r)^2-1)*(diff(g(t, phi, r), phi, phi))+(-(diff(g(t, phi, r), phi))+(diff(g(t, phi, r), t))*a*(cos(theta)-1)*(cos(theta)+1))*(diff(g(t, phi, r), phi))*f(r)^2*g(t, phi, r))*f(r)/((-g(t, phi, r)^2*f(r)^2+1)^(3/2)*sin(theta))

(((-a*cos(theta)^2+a)*f(r)^2*g(t, phi, r)^2+a*cos(theta)^2-a)*(diff(diff(g(t, phi, r), phi), t))+(g(t, phi, r)^2*f(r)^2-1)*(diff(diff(g(t, phi, r), phi), phi))+(-(diff(g(t, phi, r), phi))+(diff(g(t, phi, r), t))*a*(cos(theta)-1)*(cos(theta)+1))*(diff(g(t, phi, r), phi))*f(r)^2*g(t, phi, r))*f(r)/((-g(t, phi, r)^2*f(r)^2+1)^(3/2)*sin(theta))

(2)

pdsolve([eq1, eq2])

Error, (in pdsolve/sys) found the element '_F4' repeated in the indication of blocks variables

 

``

Download problemfile.mw

I am trying to solve these two coupled PDE and am getting this error. Does anyone know what this mean?

4 5 6 7 8 9 10 Last Page 6 of 62