Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Why there is an error? Is any part missing in the if statement?

restart

rel := w+(1/2)*sqrt(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)

w+(1/2)*(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)^(1/2)

(1)

crit_points := solve(diff(rel, k) = 0, k); rel_at_crit := subs(k = crit_points, rel)

"#` determine the maxima and minima by checking the sign of the second derivative at the critical points`  for i from 1 to nops(crit_points) do    if (eval(diff(diff(rel, k), k), k = crit_points[i]) > 0) then      print("Minimum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else if (eval(diff(diff(rel, k), k), k = crit_points[i]) < 0) then      print("Maximum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else      print("Saddle point at k = ", crit_points[i], " with value ", rel_at_crit[i]);    end if;  end do; "

Error, invalid if statement termination

"#` determine the maxima and minima by checking the sign of the second derivative at the critical points`  for i from 1 to nops(crit_points) do    if (eval(diff(diff(rel, k), k), k = crit_points[i]) > 0) then   print("Minimum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else if (eval(diff(diff(rel, k), k), k = crit_points[i]) < 0) then   print("Maximum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else   print("Saddle point at k = ", crit_points[i], " with value ", rel_at_crit[i]);    end if;  end do; "

 

NULL

Download maxnmin.mw

I input this codes:

latex((4*n-1)/9-7/16*n)

\frac{n}{144}-\frac{1}{9}

This is not the output I expected.  I would like to obtain an expression similar to the one below.

\frac{4 n-1}{9}-\frac{7}{16}n

How can I achieve this, as Maple seems to have processed it internally.

Does maple over-understand the expression.

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
 

How to perform PCR principal component Regression and PLS partial least squares Regression in Maple?

Dear all

have a nice time. 

I have a system of nonlinear differential equation with continuous delay.  I tried to find some books that define a strategy to compute the characteristic equation but unfortunattely the most of papers or books give directly the formula without any proof. 

I tried with maple, but unfortunattely no solution up to now. 

I hope find the strategy how find the characteristic equation of the attached system.

characteristic_equation.mw

thanks 

I have a workflow in which I edit files from a package I develop. These are usually mpl files, and I edit them in an editor (VS Code).

Then I have a worksheet called readFile.mw open in Maple that has two commands:

restart:

read("path/to/an/entry/file/that/includes/all/the/other/files")

and another worksheet actual.mw which is the actual worksheet I am working on, which starts with restart: with(MyPackage): and then contains calls to procedures from the package.

With this workflow, I make a change in the editor, execute readFile.mw and then go to my actual worksheet and restart and then use with(MyPackage), and the updates are available.

This works.

However, in actual.mw I may have a bunch of data that I don't want to wipe out with a restart. 

On the other hand, if I don't restart, a new call to with(MyPackage) does not update the import of the package (because it has already been imported. 

Is there an idiomatic or preferred way to accomplish reimporting the package without having to call restart?

PS I don't remember now the exact reason why I don't have the call to read the file in actual.mw but it had something to do with this issue of not getting the package updated correctly.

I think my question can be answered without necessrily providing any code. 

I have a procedure that takes in many arguments and performs heavy calculations (solves multiple sets of differential equations in parallel using Grid:-Map and then does matrix manipulations with results, etc).

It runs fine in a Maple worksheet. 

Until about half an hour ago, I hadn't used the Maple CLI. I would like to run my procedure from the CLI. I did exactly the steps as I do them in a worksheet.

with(MyPackage):

myProcedure(argsList);

But Maple just echoes the second command back to me. myProcedure is in myPackage. There is a much simpler procedure in that package called myProcedure2 and I can call that just fine from the CLI.

What could be happening?

I would like to write some code to test certain functions in a codebase that has gotten relatively large but has no tests. I recently found a bug caused by copying a line and pasting it five times (was supposed to change a parameter on each line but forgot to). Didn't notice the bug until I refactored that procedure to make the code parallelizable for use with the Grid package.

Hence, I am worried about such unknown calculation mistakes in algorithms that involve a sequence of intermediate steps/calculations.

I found there is an assert command

I would write procedures that would call the procedures to be tested with certain arguments and assert the output.

Are there any other tools available or best practices perhaps from experience?

Is it possible to indent list/bullet items easily?  In other programs, when you tab to indent a bullet item, the bullet moves with you.  In Maple the bullet and/or list item stays fixed to the left of the execution group.

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':
_EnvVerticalName = 'y':
EQ := proc(M, N) 
local eq, sol; 
eq := simplify(expand((y - M[2])/(x - M[1]) - (N[2] - M[2])/(N[1] - M[1]))); 
sol := solve(eq, y); 
RETURN(y = sol); end proc:
_local(D);
point(A, [-2, 7]):
point(B, [-5, -2]):
point(C, [8, -7]):
point(E, [1, 4]):
EQ([-5, -2], [8, -7]):
point(D, [1, subs(x = 1, rhs(%))]):
dsegment(sgAD, [A, D]):
BD := distance(B, D):
DC := distance(C, D):
triangle(ABC, [A, B, C]):
area(ABC):
triangle(ABD, [A, B, D]):
area(ABD):
triangle(ADC, [A, D, C]):
area(ADC):
is(area(ABD)/area(ADC) = BD/DC):
triangle(EBD, [E, B, D]):
area(EBD):
triangle(EDC, [E, D, C]):
area(EDC):
triangle(AEC, [A, E, C]):
area(AEC):
triangle(ABE, [A, B, E]):
area(ABE):
is(area(ABE)/area(AEC) = BD/DC):
display*([draw*[A(color = black, symbol = solidcircle, symbolsize = 6), 
B(color = black, symbol = solidcircle, symbolsize = 6), 
C(color = black, symbol = solidcircle, symbolsize = 6), 
ABC(color = blue)], 
textplot*([[coordinates(A)[], "A"], 
[coordinates(B)[], "B"], 
[coordinates(C)[], "C3"]], 
align = [above, right])], 
axes = none, 
title = "Lemme du Chevron");
The program simply reproduces display...Why; Thank you.
display*([draw*[A(color = black, symbol = solidcircle, symbolsize = 12), B(color = black, symbol = solidcircle, symbolsize = 12), C(color = black, symbol = solidcircle, symbolsize = 12), ABC(color = blue)], textplot*([[-2, 7, "A"], [-5, -2, "B"], [8, -7, "C3"]], align = [above, right])], axes = none, title = "Lemme du Chevron")

 

 

queryequal(expr1, expr2)

queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))

(1)

(This question has its origin here).
Plotting the difference of rhs - lhs seems to indicate equality over the range [0..1)

difference := rhs(op(queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2))))[1])-op(queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2))))[2]; plot(difference, x__0 = 0 .. 1, title = 'difference', color = RED)

 

Try simplify

`assuming`([simplify(difference)], [0 < x__0 and x__0 < 1])

(EllipticK((1/2)*(2+2*x__0)^(1/2))-EllipticF(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2))-EllipticF(1/(1+x__0)^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))*2^(1/2)

(2)

Try combine

`assuming`([combine(difference)], [0 < x__0 and x__0 < 1])

-2^(1/2)*EllipticF((x__0/(1+x__0))^(1/2)*2^(1/2), (1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2))+2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))

(3)

Try conversion to integral form

convert(difference, Int)

2^(1/2)*(Int(2/((-_alpha1^2+1)^(1/2)*(-2*_alpha1^2*x__0-2*_alpha1^2+4)^(1/2)), _alpha1 = 0 .. 1))-2^(1/2)*(Int(2/((-_alpha1^2+1)^(1/2)*(-2*_alpha1^2*x__0-2*_alpha1^2+4)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2)))-2^(1/2)*(Int(2/((-_alpha1^2+1)^(1/2)*(-2*_alpha1^2*x__0-2*_alpha1^2+4)^(1/2)), _alpha1 = 0 .. (1-1/(1+x__0))^(1/2)*2^(1/2)))

(4)

`assuming`([simplify(%)], [0 < x__0 and x__0 < 1])

-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1)))

(5)

plot(-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1))), x__0 = .999 .. 1, color = RED)

 

evalf(eval(-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1))), x__0 = 1), 40); evalf(eval(-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1))), x__0 = .9999999999), 40)

-0.8716953127866940896552122384831392143938e-30

(6)

There seems to be a finite difference at x__0 = 1

``

Try an addition theorem from DLMF

Since all elliptic expression have the same modulus k, the following addition theorem could be applied under the condition that the corresponding case is fulfilled https://dlmf.nist.gov/19.11#E7

Check if the following case applies (i.e. is ψ=π/2?)

 

NULL

NULL

queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))

queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))

(7)

theta = 1/sqrt(1+x__0), `&varphi;` = sqrt(1-1/(1+x__0))*sqrt(2)

theta = 1/(x__0+1)^(1/2), varphi = (1-1/(x__0+1))^(1/2)*2^(1/2)

(8)

k = (1/2)*sqrt(1+x__0)*sqrt(2)

k = (1/2)*(x__0+1)^(1/2)*2^(1/2)

(9)

tan((1/2)*psi) = (sin(theta)*Delta(`&varphi;`)+sin(`&varphi;`)*Delta(theta))/(cos(theta)+cos(`&varphi;`))

tan((1/2)*psi) = (sin(theta)*Delta(varphi)+sin(varphi)*Delta(theta))/(cos(theta)+cos(varphi))

(10)

Delta(theta) = sqrt(1-k^2*sin(theta)^2)

Delta(theta) = (1-k^2*sin(theta)^2)^(1/2)

(11)

subs(theta = `&varphi;`, Delta(theta) = (1-k^2*sin(theta)^2)^(1/2))

Delta(varphi) = (1-k^2*sin(varphi)^2)^(1/2)

(12)

subs(Delta(theta) = (1-k^2*sin(theta)^2)^(1/2), Delta(varphi) = (1-k^2*sin(varphi)^2)^(1/2), k = (1/2)*(1+x__0)^(1/2)*2^(1/2), theta = 1/(1+x__0)^(1/2), varphi = (1-1/(1+x__0))^(1/2)*2^(1/2), tan((1/2)*psi) = (sin(theta)*Delta(varphi)+sin(varphi)*Delta(theta))/(cos(theta)+cos(varphi)))

tan((1/2)*psi) = (sin(1/(x__0+1)^(1/2))*(1-(1/2)*(x__0+1)*sin((1-1/(x__0+1))^(1/2)*2^(1/2))^2)^(1/2)+sin((1-1/(x__0+1))^(1/2)*2^(1/2))*(1-(1/2)*(x__0+1)*sin(1/(x__0+1)^(1/2))^2)^(1/2))/(cos(1/(x__0+1)^(1/2))+cos((1-1/(x__0+1))^(1/2)*2^(1/2)))

(13)

`assuming`([simplify(subs(psi = (1/2)*Pi, tan((1/2)*psi) = (sin(1/(1+x__0)^(1/2))*(1-(1/2)*(1+x__0)*sin((1-1/(1+x__0))^(1/2)*2^(1/2))^2)^(1/2)+sin((1-1/(1+x__0))^(1/2)*2^(1/2))*(1-(1/2)*(1+x__0)*sin(1/(1+x__0)^(1/2))^2)^(1/2))/(cos(1/(1+x__0)^(1/2))+cos((1-1/(1+x__0))^(1/2)*2^(1/2)))))], [0 < x__0 and x__0 < 1])

1 = (sin(1/(x__0+1)^(1/2))*((2+2*x__0)*cos(x__0^(1/2)*2^(1/2)/(x__0+1)^(1/2))^2+2-2*x__0)^(1/2)+sin(x__0^(1/2)*2^(1/2)/(x__0+1)^(1/2))*((2+2*x__0)*cos(1/(x__0+1)^(1/2))^2+2-2*x__0)^(1/2))/(2*cos(1/(x__0+1)^(1/2))+2*cos(x__0^(1/2)*2^(1/2)/(x__0+1)^(1/2)))

(14)

plot([lhs(1 = (sin(1/(1+x__0)^(1/2))*((2+2*x__0)*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2)+sin(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))*((2+2*x__0)*cos(1/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2))/(2*cos(1/(1+x__0)^(1/2))+2*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2)))), rhs(1 = (sin(1/(1+x__0)^(1/2))*((2+2*x__0)*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2)+sin(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))*((2+2*x__0)*cos(1/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2))/(2*cos(1/(1+x__0)^(1/2))+2*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))))], x__0 = 0 .. 1, legend = [lhs, rhs])

 

lhs and rhs are not equal -> Case psi = (1/2)*Pi does not apply (provided that the formulas have been applied correctly).
Perhaps this is why Maple does not simply the difference to zero.  NULL


Anything else that could be tried in Maple (maybe with other formulas)?

Download Equality_of_Elliptic_expressions.mw

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

Hi, I would appreciate some help in solving the following system of partial differential equations. The particularity of the system is that only the individual variables (i.e. a, c, and l) depend on two arguments (t: current time period and v: date of birth). The other variables are either rates or aggregates. The aggregate variables (i.e. K, L, and Y) depend only on time, t, because they are the integrals of the individual variables over v. Thanks for your help.

NULL

NULL

restart; with(PDEtools)

alpha := .3306341; delta := solve(1+0.4877489e-1 = exp(delta_a)); T := 1

l0 := 42.375*(33.16667/(52*(24-9.95)*7)); L0 := l0*T

x0 := 0

IOR := .2093723865

KOR := IOR/delta

r0 := alpha/KOR-delta; rho := r0; fsolve({K0 = Y0*KOR, w0 = (1-alpha)*Y0/L0, alpha*exp(x0)*K0^(alpha-1)*L0^(1-alpha) = r0+delta}); assign(%)

0.2758153402e-1

 

{K0 = 2.510740299, Y0 = .5710794198, w0 = 1.390997088}

(1)

C0 := -K0*delta+Y0; c0 := C0/T

.4515111588

 

.4515111588

(2)

sigma := w0*(1-l0)/c0

2.234133040

(3)

eq1 := diff(c(t, v), t) = (r(t)-rho)*c(t, v)

eq2 := sigma*c(t, v) = w(t)*(1-l(t, v))

eq3 := r(t)*a(t, v)+w(t)*l(t, v) = c(t, v)+diff(a(t, v), t)

eq4 := Y(t) = exp(x(t))*K(t)^alpha*L(t)^(1-alpha)

eq5 := r(t)-delta = alpha*Y(t)/K(t)

eq6 := w(t) = (1-alpha)*Y(t)/L(t)

eq7 := K(t) = int(a(t, v), v = t-T .. t)

eq8 := L(t) = int(l(t, v), v = t-T .. t)

eq9 := x(t) = piecewise(t = 0, 0, t > 0, 0.1e-1)

eq := {eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9}

SV := {K(0) = K0, L(0) = L0, Y(0) = Y0, a(t, 0) = 0, c(0, 0) = c0, l(0, 0) = l0, r(0) = r0, w(0) = w0}

pdsolve(eq, SV, numeric, 'time' = t, 'range' = 0 .. T)

Error, (in pdsolve/numeric/process_PDEs) variable(s) {v} are in the PDE system but are not dependent or independent variables

 

sol := pdsolve(eq, SV, 'time' = t, 'range' = 0 .. T)

(4)

NULL

Download OLG.mw

Hi!

This might sound like a simple question, but I have looked pretty hard in the documentation and can't find a solution.  I want to plot functions in spherical coordinates in such a way that they are actually spherical.  For example, r = 1 should be a sphere.  All I can do is get the "cube" with sides labelled as the traditional variables r, theta, and phi.  That's not really spherical coordinates, it's just relabelled Cartesian.

I didn't make a worksheet for this topic.

Thanks in advance for your help!

Hi,

I have been bothered lately by the number format for axis labels in Maple. My problem existed before, but it apparently didn't bother me before. I have spent many hours trying to find an answer in the program help, in MaplePrimes, and in general online searches. I am not having any luck at all (good luck, that is).

I want to change the format of the axis numbering. Maple seems to default to 2 decimal places in my graph, and I really need more. Oddly, when I export the graph to PDF, I get another decimal place (even though I didn't explicitly ask for one). 

How do I change the axis-label format? Any idea what I might get when I export the graph?

Thanks for your help,

Jno.

 

First 113 114 115 116 117 118 119 Last Page 115 of 2097