tomleslie

13821 Reputation

20 Badges

14 years, 301 days

MaplePrimes Activity


These are replies submitted by tomleslie

@lcz 

adding the following to my previous answer

 parse~(Explode(Select(IsDigit, sstr1)));

@vs140580 

makes no sense. Try posting a worksheet whicvh illustrates the problem

@Linhuchong 

a variety of ways - but I have to admit that I cheated a little, by using Maple's geometry() package to ectract relevant ellipse parameters, like the centre and lengths of the major and minor axes - see the attached

  restart;
  with(geometry):
  TWeq:=2.96736996560705*10^(-12)*p^2+1.31319840299485*10^(-13)*t^2-8.89549693662593*10^(-7)* p+8.53128393394231*10^(-7)*t-3.65558815509970*10^(-30)*p*t-1 = 0:
  ellipse( Ell, TWeq, [p,t]):
  detail(Ell);
  draw(Ell);

GeometryDetail(["name of the object", Ell], ["form of the object", ellipse2d], ["center", [1.498885720*10^5, -3.248284461*10^6]], ["foci", [[1.498885720*10^5, -7.472926744*10^6], [1.498885720*10^5, 9.763578220*10^5]]], ["length of the major axis", 8.642687978*10^6], ["length of the minor axis", 1.818143505*10^6], ["equation of the ellipse", -1.+2.967369966*10^(-12)*p^2-3.655588155*10^(-30)*p*t+1.313198403*10^(-13)*t^2-8.895496937*10^(-7)*p+8.531283934*10^(-7)*t = 0])

 

 

 

Download ellgeom.mw

 

If you upload your worksheet using the big green up-arrow in the Mapleprimes edit toolbar, then someone can probably help you.

@KIRAN SAJJAN 

numerous (minor) typos, the attached produces all the plots you *seem* to want.

PS I threw out a lot of code whichyou don't seem to need.

 

restart: with(plots):

rf := 1050: kf := .52: cpf := 3617: `&sigma:f` := .8:
sigma1 := 4.10*10^7: rs1 := 19300: ks1 := 318: cps1 := 129:
sigma2 := 10^(-10): rs2 := 3970: ks2 := 40: cps2 := 765:
sigma3 := 6.30*10^7: rs3 := 10500: ks3 := 429: cps3 := 235:
sigma4 := 10^(-12): rs4 := 4250: ks4 := 8.9538: cps4 := 686.2:

l := 1: la := 1: Qc := 1: Tp := 1:
g := 1: Ec := 1: H := 3:

Rd := 1: M := 2: Pr := 21: p1 := 0.25e-1: p2 := 0.25e-1: t := (1/3)*Pi: lambda0 := 3: lambda1 := 2: delta1 := 1:
a1 := 1/(1-p1-p2)^2.5:
a1 := 1/(1-p1-p2)^2.5:
a2 := 1-p1-p2+p1*rs1/rf+p2*rs2/rf:
a3 := 1-p1-p2+p1*cps1/cpf+p2*cps2/cpf:
a4 := ((ks1*p1+ks2*p2)/(p1+p2)+2*kf+2*(ks1*p1+ks2*p2)-2*(p1+p2)*kf)/((ks1*p1+ks2*p2)/(p1+p2)+2*kf-ks1*p1-ks2*p2+(p1+p2)*kf):
a5 := 1+3*((p1*sigma1+p2*sigma2)/`&sigma:f`-p1-p2)/(2+(p1*sigma1+p2*sigma2)/((p1+p2)*`&sigma:f`)-((p1*sigma1+p2*sigma2)/`&sigma:f`-p1-p2)):
a6 := 1/(1-p1-p2)^2.5:
a7 := 1-p1-p2+p1*rs3/rf+p2*rs4/rf:
a8 := 1-p1-p2+p1*cps3/cpf+p2*cps4/cpf:
a9 := ((ks3*p1+ks4*p2)/(p1+p2)+2*kf+2*(ks3*p1+ks4*p2)-2*(p1+p2)*kf)/((ks3*p1+ks4*p2)/(p1+p2)+2*kf-ks3*p1-ks4*p2+(p1+p2)*kf):
a10 := 1+3*((p1*sigma3+p2*sigma4)/`&sigma:f`-p1-p2)/(2+(p1*sigma3+p2*sigma4)/((p1+p2)*`&sigma:f`)-((p1*sigma3+p2*sigma4)/`&sigma:f`-p1-p2)):

OdeSys := (a1+6*delta1*(diff(U0(Y), Y))^2)*(diff(U0(Y), Y, Y))-a2*R*(diff(U0(Y), Y))+lambda0-a5*M^2*U0(Y)+la*R*a2*Theta0(Y)*(1+Qc*Theta0(Y)), (a1+g*l+6*delta1*(diff(U0(Y), Y))^2)*(diff(U1(Y), Y, Y))+12*delta1*(diff(U0(Y), Y))*(diff(U1(Y), Y))*(diff(U0(Y), Y, Y))-a2*R*(diff(U1(Y), Y))-(H^2*a2*l+M^2*a5)*U1(Y)+lambda1+la*R*a2*Theta1(Y)*(1+2*Qc*Theta0(Y)), (a4+(4*Rd*(1/3))*(1+(Tp-1)^3*Theta0(Y)^3+3*(Tp-1)^2*Theta0(Y)^2+(3*(Tp-1))*Theta0(Y)))*(diff(Theta0(Y), Y, Y))/Pr-a3*R*(diff(Theta0(Y), Y))+a5*Ec*M^2*U0(Y)^2+a1*Ec*(diff(U0(Y), Y))^2+2*Ec*delta1*(diff(U0(Y), Y))^4+4*Rd*(Tp-1)*(diff(Theta0(Y), Y))^2*(1+(2*(Tp-1))*Theta0(Y)+(Tp-1)^2*Theta0(Y)^2)/Pr, (a4+(4*Rd*(1/3))*(1+(Tp-1)^3*Theta0(Y)^3+3*(Tp-1)^2*Theta0(Y)^2+(3*(Tp-1))*Theta0(Y)))*(diff(Theta1(Y), Y, Y))/Pr-a3*R*(diff(Theta1(Y), Y))-l*a3*H^2*Theta1(Y)+2*a5*Ec*M^2*U0(Y)*U1(Y)+2*a1*Ec*(diff(U0(Y), Y))*(diff(U1(Y), Y))+8*Ec*delta1*(diff(U0(Y), Y))^3*(diff(U1(Y), Y))+4*Rd*(Tp-1)*(Theta1(Y)+(2*(Tp-1))*Theta0(Y)*Theta1(Y)+(Tp-1)^2*Theta0(Y)^2*Theta1(Y))*(diff(Theta0(Y), Y, Y))/Pr+8*Rd*(Tp-1)*(diff(Theta0(Y), Y))^2*((Tp-1)^2*Theta0(Y)*Theta1(Y)+(Tp-1)*Theta1(Y))/Pr+8*Rd*(Tp-1)*(diff(Theta0(Y), Y))*(diff(Theta1(Y), Y))*(1+(2*(Tp-1))*Theta0(Y)+(Tp-1)^2*Theta0(Y)^2)/Pr:

 Cond := U0(0) = 0, U1(0) = 0, Theta0(0) = 0, Theta1(0) = 0, U0(1) = 0, U1(1) = 0, Theta0(1) = 1, Theta1(1) = 0:
 RVals := [1, 2, 3]: Ans1[j] := {}: Ans[j] := {}:

for j to numelems(RVals) do
      Ans[j] := dsolve(eval([OdeSys, Cond], R = RVals[j]), numeric, output = listprocedure)
end do:

OdeSys1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p-1)*(diff(Phi0(Y), Y))*(diff(Phi1(Y), Y))*(1+(2*(Tp-1))*Phi0(Y)+(Tp-1)^2*Phi0(Y)^2)/Pr:

 Cond1 := V0(0) = 0, V1(0) = 0, Phi0(0) = 0, Phi1(0) = 0, V0(1) = 0, V1(1) = 0, Phi0(1) = 1, Phi1(1) = 0:

for j to numelems(RVals) do
    Ans1[j] := dsolve(eval([OdeSys1, Cond1], R = RVals[j]), numeric, output = listprocedure)
 end do:

  cols := [red, blue, black]:
  plotA:= display
          ( [ seq
              ( odeplot
                ( Ans[k],
                  [Y, U0(Y)],
                  0..1,
                  color=cols[k]
                 ),
                 k=1..numelems(RVals)
               )
             ],
             'axes'= 'boxed',
             labels=[Y,'U0']
            );
  plotB:=  display
           ( [ seq
               ( odeplot
                 ( Ans[k],
                   [Y, U1(Y)],
                   0..1,
                   color=cols[k]
                 ),
                 k=1..numelems(RVals)
               )
             ],
             'axes'= 'boxed',
             labels=[Y,'U1']
           );
  plotC:= display
          ( [ seq
              ( odeplot
                ( Ans1[k],
                  [Y, V0(Y)],
                  Y=0..1,
                  color=cols[k]
                ),
                k=1..numelems(RVals)
              )
            ],
           'axes'= 'boxed',
           'linestyle' = 'dashdot',
           labels=[Y,'U0']
         );
  plotD:=  display
           ( [ seq
               ( odeplot
                 ( Ans1[k],
                   [Y,V1(Y)],
                   Y=0..1,
                   color=cols[k]
                 ),
                 k=1..numelems(RVals)
               )
             ],
             'axes'= 'boxed',
             'linestyle' = 'dashdot',
             labels=[Y,'U1']
           );
  plotE:= display
          ( [ seq
              ( odeplot
                ( Ans[k],
                  [Y,Theta0(Y)],
                  Y=0..1,
                  color=cols[k]
                ),
                k=1..numelems(RVals)
              )
            ],
            'axes'= 'boxed',
            labels=[Y,'Theta0']
          );
  plotF:=  display
           ( [ seq
               ( odeplot
                 ( Ans[k],
                   [Y, Theta1(Y)],
                   Y=0..1,
                   color=cols[k]
                 ),
                 k=1..numelems(RVals)
               )
             ],
             'axes'= 'boxed',
              labels=[Y,'Theta1']
           );
  plotG:= display
          ( [ seq
              ( odeplot
                ( Ans1[k],
                  [Y, Phi0(Y)],
                  Y=0..1,
                  color=cols[k]
                ),
                k=1..numelems(RVals)
              )
           ],
           'axes'= 'boxed',
           'linestyle' = 'dashdot',
           labels=[Y,'Theta0']
         );
  plotH:=  display
           ( [ seq
               ( odeplot
                 ( Ans1[k],
                   [Y,Phi1(Y)],
                   Y=0..1,
                   color=cols[k]
                 ),
                 k=1..numelems(RVals)
               )
             ],
             'axes'= 'boxed',
             'linestyle' = 'dashdot',
             labels=[Y,'Theta1']
           );

 

 

 

 

 

 

 

 

plots:-display([plotE, plotG]);
plots:-display([plotF, plotH]);

 

 

 


 

Download odeStuff.mw

@MANUTTM 

op(4, s2)[][];

 

'g2' does not contain the name 'q', and so is entirely independent of it.

The expression TC contains the variable names

{Cd, D, O1, O2, P, beta, h1, h2, i, q, r, t1, t2, theta1, theta2}.

However when you differentiate this expression with respect to t2, the result contains only the variables

{Cd, D, O2, beta, h2, i, t2, theta2},

so

{O1, h1, q, t1, theta1}

have been eliminated

is a numerical solver. Thus every quantity in your equation(s), other than the variable(s) you want fsolve() to compute has to have a numeric value.

I notice that you sayyou are trying to  "solve a system of differential equations" for which I would have expected you to be using dsolve(), with, or without the numeric option.

This would be so much easier to diagnose/fix if you uploaded your worksheet using the big green up-arrow in the Mapleprimes toolbar

just use the built-in help which comes with your Maple release?

As in

Help->What's new

from the menus in the standard GUI

Maple 2017 produces "correct" answer. All subsequent Maple releases produce weird answer.

Using lists rather than expressions sequences appears to make the problem go away in later releases (Maple 2018 - Maple2023)

This is a bug, and it is a bad one.

If one uses sequences of names rather than integers, then one can see the difference in the calculations being performed depending on whether the Units() package is loaded or not. The second calculation in the attached makes sense: the first one makes no sense at all.

restart;

interface(version);
with(Units):

`Standard Worksheet Interface, Maple 2023.0, Windows 7, March 6 2023 Build ID 1689885`

 

Automatically loading the Units[Simple] subpackage
 

 

A:=a__1, a__2, a__3;
B:=b__1, b__2, b__3;
B-A

a__1, a__2, a__3

 

b__1, b__2, b__3

 

b__1+b__2+b__3+a__1-a__2-a__3

(1)

restart;

A:=a__1, a__2, a__3;
B:=b__1, b__2, b__3;
B-A

a__1, a__2, a__3

 

b__1, b__2, b__3

 

b__1-a__1, b__2-a__2, b__3-a__3

(2)

 

Download badBug.mw

@delvin 

  1. Pretty unlikely that you will be able to solve analytically
  2. Given some additional information, you may be able to solve numerically

 

@MANUTTM 

the error message which you are receiving?

Error, (in Optimization:-NLPSolve) could not store 3233180.16916754-HFloat(infinity)*I in a floating-point rtable

I warned you before that generating complex numbers in an optization problem was a  very bad idea - so what do think is going to happen when you generate a complex number with an INFINITE imaginary part?

is a particularly unfortunate example because, by default, Maple will interpret this as the differential operator, rather than the simple literal 'D'. In consequence it will appear upright rather than in italic, unless you force italic, as in the attached

  restart:
  with(Units):
  plot( x,
        x=0..1,
        labels=[ typeset(D*Unit(kg/m^3)),
                 typeset(A*Unit(m) )
               ],
        labelfont=[times, bolditalic, 14]
      );

Automatically loading the Units[Simple] subpackage
 

 

 

 

Download labs2.mw

Again the appearance of the figure on this site is misleading - the way it appears in a worksheet is shown below

 

appears in a Maple worksheet

 

2 3 4 5 6 7 8 Last Page 4 of 207