Maple 2018 Questions and Posts

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

Is there a simple 4-vector package available for Maple? Yes, I know about using Tensors, but don't want to fool with metrics and raising and lowering operators.

I have written my  own, but it seems buggy. I generate some vectors in in CM that should add up to a massless neutrino, but some times when I boost them to the 'lab' and do the addition there the neutrion acquires a substantial mass. It's not a merely numerical issue. It's weird because most of the time the neutrion mass is 0 or close to it.

My homemade boost proc 'boostTo' is attached.

  I am unable to draw both 3d plots sowing error please help me to solve

restart:NULLNULL

p1 := 0.1e-1; p2 := 0.2e-1; p3 := 0.1e-1; Px := p1+p2+p3

rf := 1050; kf := .52; cpf := 3617; sigmaf := .8

sigma1 := 25000; rs1 := 5200; ks1 := 6; cps1 := 670

sigma2 := 59.7*10^6; rs2 := 8933; ks2 := 400; cps2 := 385

sigma3 := 2380000; rs3 := 4250; ks3 := 8.9538; cps3 := 686.2

NULL

B1 := 1+2.5*Px+6.2*Px^2; B2 := 1+13.5*Px+904.4*Px^2; B3 := 1+37.1*Px+612.6*Px^2; B4 := (ks1+2*kf-2*Px*(kf-ks1))/(ks1+2*kf+Px*(kf-ks1)); B5 := (ks2+3.9*kf-3.9*Px*(kf-ks2))/(ks2+3.9*kf+Px*(kf-ks2)); B6 := (ks3+4.7*kf-4.7*Px*(kf-ks3))/(ks3+4.7*kf+Px*(kf-ks3))

a2 := B1*p1+B2*p2+B3*p3

a1 := 1-p1-p2-p3+p1*rs1/rf+p2*rs2/rf+p3*rs3/rf

a3 := 1-p1-p2-p3+p1*rs1*cps1/(rf*cpf)+p2*rs2*cps2/(rf*cpf)+p3*rs3*cps3/(rf*cpf)

a4 := B4*p1+B5*p2+B6*p3

NULL

a5 := 1+3*((p1*sigma1+p2*sigma2+p3*sigma3)/sigmaf-p1-p2-p3)/(2+(p1*sigma1+p2*sigma2+p3*sigma3)/((p1+p2+p3)*sigmaf)-((p1*sigma1+p2*sigma2+p3*sigma3)/sigmaf-p1-p2-p3))

``

``



NULL

ODE:=[(a2+K)*(diff(U0(eta), eta, eta))/a1-Ra*(diff(U0(eta), eta))+lambda0/a1-a5*M1^2*U0(eta)/a1+K*(diff(N0(eta), eta))/a1+la*Ra*Theta0(eta)*(1+Qc*Theta0(eta)), (a2+K)*(diff(U1(eta), eta, eta))/a1-H^2*l1*U1(eta)-Ra*(diff(U1(eta), eta))+lambda1/a1-a5*M1^2*U1(eta)/a1+K*(diff(N1(eta), eta))/a1+la*Ra*(Theta1(eta))(1+2*Qc*Theta0(eta)), diff(N0(eta), eta, eta)-Ra*a1*Pj*(diff(N0(eta), eta))-2*n1*N0(eta)-n1*(diff(U0(eta), eta)), diff(N1(eta), eta, eta)-Ra*a1*Pj*(diff(N1(eta), eta))-2*n1*N1(eta)-n1*(diff(U1(eta), eta))-H^2*a1*Pj*l1*N1(eta), (a4/(a3*Pr)-delta*Ra^2/H^2+4*Rd*(1+(Tp-1)^3*Theta0(eta)^3+3*(Tp-1)^2*Theta0(eta)^2+(3*(Tp-1))*Theta0(eta))/(3*a3*Pr))*(diff(Theta0(eta), eta, eta))-Ra*(diff(Theta0(eta), eta))+a5*Ec*M1^2*U0(eta)^2/a3+(a2+K)*Ec*(diff(U0(eta), eta))^2/a1+Q*Theta0(eta)/a3+4*(diff(Theta0(eta), eta))^2*Rd*(3*(Tp-1)+6*(Tp-1)^2*Theta0(eta)+3*(Tp-1)^3*Theta0(eta)^2)/(3*a3*Pr), (a4/(a3*Pr)-delta*Ra^2/H^2+4*Rd*(1+(Tp-1)^3*Theta0(eta)^3+3*(Tp-1)^2*Theta0(eta)^2+(3*(Tp-1))*Theta0(eta))/(3*a3*Pr))*(diff(Theta1(eta), eta, eta))-(H^2*l1+2*Ra*delta*l1+Ra)*(diff(Theta1(eta), eta))+(Q/a3-delta*H^2*l1^2)*Theta1(eta)+2*(a2+K)*Ec*(diff(U0(eta), eta))*(diff(U1(eta), eta))/a1+2*a5*Ec*M^2*U0(eta)*U1(eta)/a3+4*(diff(Theta0(eta), eta, eta))*Theta1(eta)*Rd*(3*(Tp-1)+6*(Tp-1)^2*Theta0(eta)+3*(Tp-1)^3*Theta0(eta)^2)/(3*a3*Pr)+4*Rd*(diff(Theta0(eta), eta))^2*(6*(Tp-1)^2*Theta1(eta)+6*(Tp-1)^3*Theta0(eta)*Theta1(eta))/(3*a3*Pr)+4*Rd*(diff(Theta1(eta), eta))*(diff(Theta0(eta), eta))*(6*(Tp-1)+6*(Tp-1)^3*Theta0(eta)^2+12*(Tp-1)^2*Theta0(eta))/(3*a3*Pr)]:


(LB,UB):= (0,1):


BCs:= [
  
  U0(0) = 0, U1(0) = 0, N0(0) = 0, N1(0) = 0, Theta0(0) = 0, Theta1(0) = 0, U0(1) = 0, U1(1) = 0, N0(1) = 0, N1(1) = 0, Theta0(1) = 1, Theta1(1) = 0
]:

NULL


Params:= Record(
   
   M1=  1.2, Rd=0.8,la=0.8,n1=1.2,Q=0.2,Pj=0.001,Ra=0.8,Ec=1,    Pr= 21,   delta= 0.2,    t1= (1/4)*Pi, lambda0=2,lambda1=3,   Qc= 0.1,    l1= 1,K=0.4,H=3 ,deltat=0.05  ):
   

NBVs:= [   
 
a1**D(U0)(0) = `C*__f` , # Skin friction coefficient
 (a4+(4*Rd*(1/3))*(1+(Tp-1)*(Theta0(0)+0.1e-2*exp(l1*t1)*Theta1(0)))^3)*((D(Theta0))(0)+0.1e-2*exp(l1*t1)*(D(Theta1))(0)) = `Nu*`    # Nusselt number     
]:
Nu:= `Nu*`:
Cf:= `C*__f`:

 

Solve:= module()
local
   nbvs_rhs:= rhs~(:-NBVs), #just the names
   Sol, #numeric dsolve BVP solution of any 'output' form
   ModuleApply:= subs(
      _Sys= {:-ODEs[], :-BCs[], :-NBVs[]},
      proc({
          M1::realcons:=  Params:-M1,
         Pr::realcons:= Params:-Pr,
         Rd::realcons:= Params:-Rd,
         la::realcons:= Params:-la,
         Tp::realcons:= Params:-Tp,
         n1::realcons:= Params:-n1,
         Q::realcons:= Params:-Q,
         Pj::realcons:= Params:-Pj,
         Ra::realcons:= Params:-Ra,
         Ec::realcons:= Params:-Ec,
         t1::realcons:=  Params:-t1,
         delta::realcons:= Params:-delta,
         lambda0::realcons:= Params:-lambda0,
         lambda1::realcons:= Params:-lambda1,
         Qc::realcons:= Params:-Qc,
         K::realcons:= Params:-K,
         l1::realcons:= Params:-l1,
         H::realcons:= Params:-H
      })
         Sol:= dsolve(_Sys, _rest, numeric);
         AccumData(Sol, {_options});
         Sol
      end proc
   ),
   AccumData:= proc(
      Sol::{Matrix, procedure, list({name, function}= procedure)},
      params::set(name= realcons)
   )
   local n, nbvs;
      if Sol::Matrix then
         nbvs:= seq(n = Sol[2,1][1,Pos(n)], n= nbvs_rhs)
      else
         nbvs:= (nbvs_rhs =~ eval(nbvs_rhs, Sol(:-LB)))[]
      fi;
      SavedData[params]:= Record[packed](params[], nbvs)
   end proc,
   ModuleLoad:= eval(Init);
export
   SavedData, #table of Records
   Pos, #Matrix column indices of nbvs
   Init:= proc()
      Pos:= proc(n::name) option remember; local p; member(n, Sol[1,1], 'p'); p end proc;
      SavedData:= table();
      return
   end proc ;
   ModuleLoad()
end module:
 


 

 

#procedure that generates 3-D plots (dropped-shadow contour + surface) of an expression


ParamPlot3d:= proc(
   Z::{procedure, `module`}, #procedure that extracts z-value from Solve's dsolve solution
   X::name= range(realcons), #x-axis-parameter range
   Y::name= range(realcons), #y-axis-parameter range
   FP::list(name= realcons), #fixed values of other parameters
   {
      #fraction of empty space above and below plot (larger "below"
      #value improves view of dropped-shadow contourplot):
      zmargin::[realcons,realcons]:= [.05,0.15],
      eta::realcons:= :-LB, #independent variable value
      dsolveopts::list({name, name= anything}):= [],
      contouropts::list({name, name= anything}):= [],
      surfaceopts::list({name, name= anything}):=[]    
   }
)
local
   LX:= lhs(X), RX:= rhs(X), LY:= lhs(Y), RY:= rhs(Y),
   Zremember:= proc(x,y)
   option remember; #Used because 'grid' should be the same for both plots.
      Z(
         Solve(
            LX= x, LY= y, FP[],
            #Default dsolve options can be changed by setting 'dsolveopts':
            'abserr'= 0.5e-7, 'interpolant'= false, 'output'= Array([eta]),  
            dsolveopts[]
         )
      )
   end proc,
   plotspec:= (Zremember, RX, RY),
   C:= plots:-contourplot(
      plotspec,
      #These default plot options can be changed by setting 'contouropts':
      'grid'= [25,25], 'contours'= 5, 'filled',
      'coloring'= ['yellow', 'orange'], 'color'= 'green',
      contouropts[]
   ),
   P:= plot3d(
      plotspec,
      #These default plot options can be changed by setting 'surfaceopts':
      'grid'= [25,25], 'style'= 'surfacecontour', 'contours'= 6,
      surfaceopts[]
   ),
   U, L #z-axis endpoints after margin adjustment
;
   #Stretch z-axis to include margins:
   (U,L):= ((Um,Lm,M,m)-> (M*(Lm-1)+m*Um, M*Lm+m*(Um-1)) /~ (Um+Lm-1))(
      zmargin[],
      (max,min)(op(3, indets(P, 'specfunc'('GRID'))[])) #actual z-axis range
   );
   plots:-display(
      [
         plots:-spacecurve(
            {
               [[lhs(RX),rhs(RY),U],[rhs(RX),rhs(RY),U],[rhs(RX),rhs(RY),L]], #yz backwall
               [[rhs(RX),rhs(RY),U],[rhs(RX),lhs(RY),U],[rhs(RX),lhs(RY),L]]  #xz backwall
            },
            'color'= 'grey', 'thickness'= 0
         ),
         plottools:-transform((x,y)-> [x,y,L])(C), #dropped-shadow contours
         P
      ],
      #These default plot options can be changed simply by putting the option in the
      #ParamPlot3d call:
      'view'= ['DEFAULT', 'DEFAULT', L..U], 'orientation'= [-135, 75], 'axes'= 'frame',
      'labels'= [lhs(X), lhs(Y), Z], 'labelfont'= ['TIMES', 'BOLDOBLIQUE', 16],
      'caption'= nprintf(cat("%a = %4.2f, "$nops(FP)-1, "%a = %4.2f"), (lhs,rhs)~(FP)[]),
      'captionfont'= ['TIMES', 14],
      'projection'= 2/3,   
      _rest
   )
end proc:

NULL

NULL

GetNu := proc (Sol::Matrix) options operator, arrow; Sol[2, 1][1, Solve:-Pos(:-Nu)] end proc

ParamPlot3d(
   GetNu,Q= 0..5, Rd= 0..5, [
   
   Pr= 21   ],
   labels= [Q, gamma, Nu]
);

Error, (in plot/iplot2d/levelcurve) could not evaluate expression

 

``

Download P6_3D_plots.mw

HI,
I want to simplify an algebraic experssion. How do I do this with Maple?
A1.mw

I have been using 'MemoryInUse()' to try to track down a memory leak that is crashing my Maple-based simulation. The problematic proc seems to be ProbDStarLNu which calculates the probablity of decay as a function of the angles of the decay product. It gets called a lot in acceptance rejection decay generation.

'MemoryInUse()' slows it down a lot. It also seemed to give weird results to me. I calculate the mem used on entry and then after the 4 trig functions have been called. The amount of mem 'in use' goes down after the trig functions are called. I was suspecting they were the source of the leak, but they seem almost an anti-leak.

This weird behavior caused me to write my own mem counting proc ('memUsed') based on summing over the results of 'mem:= kernelopts(memusage)'.

It is much faster. It gives nearly but not quite the same numbers. It still goes "backward" when the trig functions are called. Most of the mem growth comes from the algebra that follows the trig.

Why would that be?

I have included code for 'ProbDStarLNu'. It's pretty simple.

I'm trying to use CodeTools[Profile] to investigate my memory leak and the effect or lack there of of 'forget' to improve it.

I copied my code from an example:

with(CodeTools[Profiling]);
 [Allow, Build, Coverage, GetProfileTable, Ignore, IsProfiled, 

   LoadProfiles, Merge, PrintProfiles, Profile, Remove, 

   SaveProfiles, Select, SortBy, UnProfile]

Profile([PickAngles(1.0, 1.0, 1.0)]);
Error, (in CodeTools:-Profiling:-Profile) unexpected argument(s)

The 'unexpected argument' is the 'result' from 'PickAngles'. I've tried with and w/o the '[]' but it does the same thing failing to recognize that 'PickAngles' is a procedure.

The example I used is here:

https://www.maplesoft.com/support/help/maple/view.aspx?path=CodeTools%2FProfiling%2FProfile procedure.

I did what to make of the subscript Profiles in the example so I used '[Profiles]' and that worked or seemed to.

When I hit the debug button the debugger does not start. Putting Debug() in the code doesn't either. Is there some initiation I'm missing? It seems to me it used to work.

I have data that I've binned in list. I'd like to plot in as a histogram. 

dataplot sort of does it but doesn't give the x-axis that I used but just the bins.

Yes, I know about Histogram from Statistics. To plot 1000000 values I have to enter them all into a list which seems crazy when all I want is a 100 bin histogram. Doing the binning is trivial, but I can't figure out how to plot it with a sensible x-axis (show range used to define the 'histogram')

Hello,

I am experiencing difficulties using my old Maple programs with the newer version. I tried changing the types of inputs and the typesetting level, but it just doesn't work. I would appreciate it if someone could help me overcome my ignorance.

Some simple input is attached with the output.

How do I find the contents of a bin in a Maple histogram?

I'm using NLPSolve to minimize a complicated function. It works great, but the answers are not returned in numerical form which I need as they are then input for the next stage of my program.

How to I extract numbers?

S2 := NLPSolve(test, phi1 = 0 .. 2*Pi, phi2 = 1.0*Pi .. 2*Pi);
     S2 := [-1.00000000011810774, 

       [phi1 = 0.773215730257661, phi2 = 5.98741001513872]]
==>The Result is a list and the solutions appear kind of string-like. 

S2[2,1] returns 'phi=0.773...' not the number I need

restart:

  ra:=2: b1:=1.41: na:=0.7: we:=0.5: eta[1]:=4*0.1: d:=0.5:
  xi:=0.1: m:=na: ea:=0.5: pr:=21: gr:=0.1: R:=0.9323556933:

  PDE1:=ra*(diff(f(x,t),t))=+b1*(1+ea*cos(t))+(1/(R^2))*((diff(f(x,t),x,x))+(1/x)*diff(f(x,t),x));
  IBC:= {D[1](f)(0,t)=0,f(1,t)=0,f(x,0)=0};

2*(diff(f(x, t), t)) = 1.41+.705*cos(t)+1.150367877*(diff(diff(f(x, t), x), x))+1.150367877*(diff(f(x, t), x))/x

 

{f(1, t) = 0, f(x, 0) = 0, (D[1](f))(0, t) = 0}

(1)

sol := pdsolve({PDE1}, IBC, numeric); sol:-plot(f(x, t), t = 1.2, linestyle = "solid", title = "Velocity Profile", labels = ["r", "f"])

 

``

Download pde.mw

for different time plot of f(x,t) in single plot with different color 

modifed_practice.mw

Impact of Shape-Dependent Hybrid Nanofluid on Transient Efficiency of a Fully W
et Porous Longitudinal Fin

dear sir please help me to solve the graph i given reference pdf also. i have implimented the code but getting error in ploting 

Thank you

restart;
alias(u = u(x, y, t), f = f(x, y, t));
                              u, f
u := (f+sqrt(R))*exp(I*R*t);
                    /     (1/2)\           
                    \f + R     / exp(I R t)
pde1 := I*(diff(u, t))+diff(u, x, x)+2*lambda*u*abs(u)*abs(u)-gamma*(diff(u, x, t));
   // d   \                /     (1/2)\             \
 I ||--- f| exp(I R t) + I \f + R     / R exp(I R t)|
   \\ dt  /                                         /

      / d  / d   \\           
    + |--- |--- f|| exp(I R t)
      \ dx \ dx  //           

               /     (1/2)\                           2 
    + 2 lambda \f + R     / exp(I R t) (exp(-Im(R t)))  

               2
   |     (1/2)| 
   |f + R     | 

            // d  / d   \\                / d   \             \
    - gamma ||--- |--- f|| exp(I R t) + I |--- f| R exp(I R t)|
            \\ dx \ dt  //                \ dx  /             /
 

      

how to plot graphs for both methods and comparison of different method values for Diff(f(eta),eta, eta) at eta =0

 

NULL

NULL

restart

F[0] := al

F[1] := a2

F[2] := a3

F[3] := a4

G[0] := a5

G[1] := a6

T[0] := a7

T[1] := a8

Q[0] := a9

Q[1] := a10

n[1] := 1

for k from 0 to n[1] do F[k+4] := solve((1+a)*(k+1)*(k+2)*(k+3)*(k+4)*F[k+4]-a*(k+1)*(k+2)*G[k+2]-R*(sum(F[k-m]*(m+1)*(m+2)*(m+3)*F[m+3], m = 0 .. k))+R*(sum((k-m+1)*F[k-m+1]*(m+1)*(m+2)*F[m+2], m = 0 .. k)), F[k+4]) end do

-(1/12)*(R*a2*a3-3*R*a4*al-a*G[2])/(1+a)

 

-(1/60)*(R^2*a2*a3*al-3*R^2*a4*al^2+2*R*a*a3^2-R*a*al*G[2]+2*R*a3^2-3*a^2*G[3]-3*a*G[3])/(1+a)^2

(1)

n[2] := 3

for k from 0 to n[2] do G[k+2] := solve(b*(k+1)*(k+2)*G[k+2]+a*(k+1)*(k+2)*F[k+2]-2*a*G[k]-c*R*(sum((m+1)*G[m+1]*F[k-m], m = 0 .. k))+c*R*(sum(G[k-m]*(m+1)*F[m+1], m = 0 .. k)), G[k+2]) end do

-(1/2)*(R*a2*a5*c-R*a6*al*c+2*a*a3-2*a*a5)/b

 

-(1/6)*(R^2*a2*a5*al*c^2-R^2*a6*al^2*c^2+2*R*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2*a10*a3*al*b*p2-36*a10*a4*b*p4^2-4*a2*a3*a9*b*p2-6*a4*a9*al*b*p2+2*a^2*a3*a9-2*a^2*a5*a9-12*a*a10*a4*b-36*a10*a4*b*p4-12*a10*a4*b)/((p4+1)^4*b*(1+a))

(4)

U[1] := sum(F[r]*t^r, r = 0 .. n[1]+4)

p[1] := subs(R = 1, a = 1, b = 1, c = 1, p1 = 1, p2 = .8, p3 = .1, p4 = .1, U[1])

U[2] := sum(G[r]*t^r, r = 0 .. n[2]+2)

p[2] := subs(R = 1, a = 1, b = 1, c = 1, p1 = 1, p2 = .8, p3 = .1, p4 = .1, U[2])

U[3] := sum(T[r]*t^r, r = 0 .. n[2]+2)

p[3] := subs(R = 1, a = 1, b = 1, c = 1, p1 = 1, p2 = .8, p3 = .1, p4 = .1, U[3])

U[4] := sum(Q[r]*t^r, r = 0 .. n[2]+2)

p[4] := subs(R = 1, a = 1, b = 1, c = 1, p1 = 1, p2 = .8, p3 = .1, p4 = .1, U[4])

e1 := subs(t = -1, p[1]) = 0

e2 := subs(t = -1, diff(p[1], t)) = 0

e3 := subs(t = 1, diff(p[1], t)) = -1

e4 := subs(t = 1, p[1]) = 0

e5 := subs(t = -1, p[2]) = 0

e6 := subs(t = 1, p[2]) = 1

e7 := subs(t = -1, p[3]) = 1

e8 := subs(t = 1, p[3]) = 0

e9 := subs(t = -1, p[4]) = 1

e10 := subs(t = 1, p[4]) = 0

j := {e1, e10, e2, e3, e4, e5, e6, e7, e8, e9}

j := solve(j)

sj := evalf(j)

{a10 = -3.476623407, a2 = -5.754056209, a3 = .1776219452, a4 = 11.75811242, a5 = 1.324264301, a6 = -684.5523526, a7 = -.2700369914, a8 = 1.152227714, a9 = 2.191204245, al = 0.3618902741e-1}, {a10 = -.5218741555, a2 = .2575353882, a3 = -.2672619833, a4 = -.2650707765, a5 = 0.7065354871e-1, a6 = .1172581545, a7 = .6100817436, a8 = -.5277387253, a9 = .5842364534, al = .2586309916}, {a10 = -4.849411034, a2 = 11.61910224, a3 = -20.01600142, a4 = -22.98820448, a5 = -303.7401922, a6 = -153.4446663, a7 = -7.896832028, a8 = -4.917031955, a9 = -9.645684059, al = 10.13300071}, {a10 = -12.41434918+6.055636678*I, a2 = -6.912869603-3.362489448*I, a3 = -9.364948739-.7062944755*I, a4 = 14.07573921+6.724978896*I, a5 = -106.6284397-3.087774395*I, a6 = 184.4202683+38.56644530*I, a7 = 2.689687372-4.048821750*I, a8 = -4.715343127+5.167588829*I, a9 = 8.474095612-5.785653488*I, al = 4.807474369+.3531472377*I}, {a10 = -8.462156658-37.78952093*I, a2 = -22.10322629+.7748996783*I, a3 = -2.926063539-87.71943544*I, a4 = 44.45645258-1.549799357*I, a5 = 126.1645842+1357.517358*I, a6 = -880.5344239+73.01362458*I, a7 = -96.56841781+19.40514883*I, a8 = -11.30265439-58.49348719*I, a9 = -59.25678527+13.86225901*I, al = 1.588031769+43.85971772*I}, {a10 = 21.28781597+0.9115942334e-2*I, a2 = -2.190767380-.1297694199*I, a3 = 0.4834062985e-1-8.617807139*I, a4 = 4.631534761+.2595388398*I, a5 = -1.070222696-4.103740084*I, a6 = 28.93315819+1.060309794*I, a7 = -.6440073083+2.959900705*I, a8 = 3.178056838-1.712994921*I, a9 = -1.124006374+8.865509135*I, al = .1008296851+4.308903570*I}, {a10 = -2.226772562-4.893664011*I, a2 = -5.213384606-.4953312060*I, a3 = 1.881656676-24.64377975*I, a4 = 10.67676921+.9906624121*I, a5 = -5.922885277-14.38776520*I, a6 = 9.281006594-6.268746147*I, a7 = -8.563253672+2.519226454*I, a8 = -2.293245547-7.112743663*I, a9 = -4.948019289+2.035858706*I, al = -.8158283379+12.32188987*I}, {a10 = -3.311080211+1.380948844*I, a2 = -6.825505968+3.517539795*I, a3 = 10.11566715-.6387142267*I, a4 = 13.90101194-7.035079589*I, a5 = 106.6696011-4.144959139*I, a6 = 183.4179274-43.03852019*I, a7 = -1.117431335-0.4722817327e-1*I, a8 = -1.705921790+.2164542338*I, a9 = -2.431505210+.6185873236*I, al = -4.932833576+.3193571133*I}, {a10 = 1.720689325, a2 = 11.30494181, a3 = 20.89441402, a4 = -22.35988362, a5 = 304.5741226, a6 = -141.0519632, a7 = -3.607319024, a8 = 2.107261122, a9 = -3.764007990, al = -10.32220701}, {a10 = -3.311080211-1.380948844*I, a2 = -6.825505968-3.517539795*I, a3 = 10.11566715+.6387142267*I, a4 = 13.90101194+7.035079589*I, a5 = 106.6696011+4.144959139*I, a6 = 183.4179274+43.03852019*I, a7 = -1.117431335+0.4722817327e-1*I, a8 = -1.705921790-.2164542338*I, a9 = -2.431505210-.6185873236*I, al = -4.932833576-.3193571133*I}, {a10 = -2.226772562+4.893664011*I, a2 = -5.213384606+.4953312060*I, a3 = 1.881656676+24.64377975*I, a4 = 10.67676921-.9906624121*I, a5 = -5.922885277+14.38776520*I, a6 = 9.281006594+6.268746147*I, a7 = -8.563253672-2.519226454*I, a8 = -2.293245547+7.112743663*I, a9 = -4.948019289-2.035858706*I, al = -.8158283379-12.32188987*I}, {a10 = 21.28781597-0.9115942334e-2*I, a2 = -2.190767380+.1297694199*I, a3 = 0.4834062985e-1+8.617807139*I, a4 = 4.631534761-.2595388398*I, a5 = -1.070222696+4.103740084*I, a6 = 28.93315819-1.060309794*I, a7 = -.6440073083-2.959900705*I, a8 = 3.178056838+1.712994921*I, a9 = -1.124006374-8.865509135*I, al = .1008296851-4.308903570*I}, {a10 = -8.462156658+37.78952093*I, a2 = -22.10322629-.7748996783*I, a3 = -2.926063539+87.71943544*I, a4 = 44.45645258+1.549799357*I, a5 = 126.1645842-1357.517358*I, a6 = -880.5344239-73.01362458*I, a7 = -96.56841781-19.40514883*I, a8 = -11.30265439+58.49348719*I, a9 = -59.25678527-13.86225901*I, al = 1.588031769-43.85971772*I}, {a10 = -12.41434918-6.055636678*I, a2 = -6.912869603+3.362489448*I, a3 = -9.364948739+.7062944755*I, a4 = 14.07573921-6.724978896*I, a5 = -106.6284397+3.087774395*I, a6 = 184.4202683-38.56644530*I, a7 = 2.689687372+4.048821750*I, a8 = -4.715343127-5.167588829*I, a9 = 8.474095612+5.785653488*I, al = 4.807474369-.3531472377*I}

(5)

p[1] := subs(a10 = -.5218741555, a2 = .2575353882, a3 = -.2672619833, a4 = -.2650707765, a5 = 0.7065354871e-1, a6 = .1172581545, a7 = .6100817436, a8 = -.5277387253, a9 = .5842364534, al = .2586309916, p[1])

.2586309916+.2575353882*t-.2672619833*t^2-.2650707765*t^3+0.8630991633e-2*t^4+0.7535388242e-2*t^5

(6)

p[2] := subs(a10 = -.5218741555, a2 = .2575353882, a3 = -.2672619833, a4 = -.2650707765, a5 = 0.7065354871e-1, a6 = .1172581545, a7 = .6100817436, a8 = -.5277387253, a9 = .5842364534, al = .2586309916, p[2])

0.7065354871e-1+.1172581545*t+.3439809338*t^2+.3401058738*t^3+0.8536551748e-1*t^4+0.4263597162e-1*t^5

(7)

p[3] := subs(a10 = -.5218741555, a2 = .2575353882, a3 = -.2672619833, a4 = -.2650707765, a5 = 0.7065354871e-1, a6 = .1172581545, a7 = .6100817436, a8 = -.5277387253, a9 = .5842364534, al = .2586309916, p[3])

.6100817436-.5277387253*t-.1364241818*t^2+0.3945483872e-1*t^3+0.2634243820e-1*t^4-0.1171611337e-1*t^5

(8)

p[4] := subs(a10 = -.5218741555, a2 = .2575353882, a3 = -.2672619833, a4 = -.2650707765, a5 = 0.7065354871e-1, a6 = .1172581545, a7 = .6100817436, a8 = -.5277387253, a9 = .5842364534, al = .2586309916, p[4])

.5842364534-.5218741555*t-.1037943244*t^2+0.3134539737e-1*t^3+0.1955787096e-1*t^4-0.9471241840e-2*t^5

(9)

NULL

value*of*D@@2*F(0)*For*R = 1, 1.5, `and`(2*Using*Both*DTM*scheme, dsolve*method)

 

Download DTM_practice.mw

Hi,

It might be really trivial, but I am struggling in the algebraic manipulation of the argument of the exponential function. As an example, I want to substitute 

I*T[0]*(omega1-2*omega2) = I*omega2*T[0]-I*si*T[2]

in the expression of

exp(-I*T[0]*(omega1-2*omega2)).

However, I am only able to do so by subs command and also by exactly copying the argument in the following manner.

subs(-I*T[0]*(omega1-2*omega2) = I*omega2*T[0]-I*si*T[2], exp(-I*T[0]*(omega1-2*omega2)))

The issue is I have expressions like this all over in the main problem, and I have to copy-paste such expressions for the substitution. So I am wondering if there is a more efficient way to tackle this problem. 

Thanks in Advance,

Regards

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