Maple 2018 Questions and Posts

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

Hi,

I do not really understand the difference between annrow operator and unapply.
From the help pages it seems that unapply "creates" an arrow operator and thus that they could be two different ways to do the same thing.


restart:

f := x[1]+y[1]:

a := indets(f):                  # just because f can be more complex than the f above
g := (op(a)) -> f;              # generates an error, "operators not of a symbol type"
h := unapply(f, (op(a)))   # ok, but with a strange output
     h := (x__1, y__1) -> x__1+y__1

So it seems that Maple has transform by itself the indexed x[1] and y[1] into symbols x__1 and y__1.

Could you explain me what happened exactly ?

TIA

Assume we have an expression in several variables, x,y,z,..., where all of them are function of one parameter, t, for an example consider the following simple expression;

f := 2*y(t)*(diff(x(t), t))^2+3*(diff(x(t), t$3))-3*x(t)*(diff(y(t), t));

Is there any command or a way to ask Maple to give the highest order of derivation of x or y with respect to t in the expression? For example in the above example, the answer for x is 3 and for y is 1. If we remove the second term, then the answer for x should be 1.

Hello!

I am truing to simplify kretchmann variable in the following worksheet:

 

 
M > 

# Obtaining Ricci and Kretchmann;
with(DifferentialGeometry):with(Tensor):

DGsetup([t, r, theta, phi], M);
g := evalDG(-(1-2*M*mu/r)^(1/mu)*dt &t dt+(1-2*M*mu/r)^(-1/mu)*`&t`(dr, dr)+r^2*(1-2*M*mu/r)^(1-1/mu)*(`&t`(dtheta, dtheta)+sin(theta)^2*`&t`(dphi, dphi)));
C := Christoffel(g):

`frame name: M`

 

_DG([["tensor", M, [["cov_bas", "cov_bas"], []]], [[[1, 1], -(-(2*M*mu-r)/r)^(1/mu)], [[2, 2], (-(2*M*mu-r)/r)^(-1/mu)], [[3, 3], r^2*(-(2*M*mu-r)/r)^((mu-1)/mu)], [[4, 4], r^2*(-(2*M*mu-r)/r)^((mu-1)/mu)*sin(theta)^2]]])

(1.1)

Rie := CurvatureTensor(C):
R := RicciScalar(g,Rie);
h := InverseMetric(g):
kretchmann := ContractIndices(RaiseLowerIndices(g, Rie, [1]), RaiseLowerIndices(h, Rie, [2, 3, 4]), [[1, 1], [2, 2], [3, 3], [4, 4]]);

2*(-(2*M*mu-r)/r)^(1/mu)*M^2*(mu^2-1)/(r^2*(2*M*mu-r)^2)

 

4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+2*M*mu+M-2*r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(2/mu)*M^2*(M*mu^2+M*mu-r)^2/((2*M*mu-r)^4*r^4)+20*(-(2*M*mu-r)/r)^(2/mu)*(M*mu+M-r)^2*M^2/((2*M*mu-r)^4*r^4)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+M*mu-r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu+M-r)^2/(r^6*(2*M*mu-r)^2)

(1.2)
M > 

# simplification

M > 

simplify(normal(R),symbolic)

2*(-1)^(1/mu)*(2*M*mu-r)^((1-2*mu)/mu)*r^((-1-2*mu)/mu)*M^2*(mu^2-1)

(1.3)
M > 

simplify(kretchmann,size,symbolic)

4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+2*M*mu+M-2*r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(2/mu)*M^2*(M*mu^2+M*mu-r)^2/((2*M*mu-r)^4*r^4)+20*(-(2*M*mu-r)/r)^(2/mu)*(M*mu+M-r)^2*M^2/((2*M*mu-r)^4*r^4)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+M*mu-r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu+M-r)^2/(r^6*(2*M*mu-r)^2)

(1.4)
M > 

 


 

Download RicciScalarKretchmann.mw

The problem is that I cannot obtain a good form of it. With Mathematica FullSimplify[] function I got the following form (LaTeX code incoming): $K =& 4 M^2 \Bigl(A-B r+C r^2\Bigr)(r-2 M \mu)^{\frac{2}{\mu}-4}r^{-\frac{2}{\mu}-4},\
    A =&M^2 (\mu (3 \mu+2)+7) (\mu+1)^2,\,B = 8 M (\mu+2) (\mu+1),\, C = 12$, i.e. terms $(r-2 M \mu)$ and $r$ got fully factorized. However, I could never achieve the same form in Maple. Any help?


I am sorry if this is a silly and many-times-answered question, but I tried consulting with Maple help and googling solutions without any success.

Regards,
Nick

Exercises solved online with Maple exclusively in space. I attach the explanation links on my YouTube channel.

Part # 01

https://www.youtube.com/watch?v=8Aa2xzU8LwQ

Part # 02

https://www.youtube.com/watch?v=qyGT28CeSz4

Part # 03

https://www.youtube.com/watch?v=yf8rjSPbv5g

Part # 04

https://www.youtube.com/watch?v=FwHPW7ncZTg

Part # 05

https://www.youtube.com/watch?v=bm3frpukb0I

Link for download the file:

Vector_Exercises-Force_in_space.mw

Lenin AC

Ambassador of Maple

 

 

 


 

restart:
with(LinearAlgebra):
with(plots):
with(geometry):
with(plottools): # On appelle alpha la moitié de l'angle de rotation de la roue menée par tour de roue menante. alpha=Pi/n en raduans soit Pi/5=36° pour 5 rainures.. On a alors les relations suivantes entre l'entaxe E, le rayon de la roue ùenante R1 et le rayon de la roue menée R2 : R1=E.sin(alpha), R2=E*cos(alpha) Intersection du cercle (O,R2) avec la droite tan(phi)x-r/cos(phi), on obtient les coordonnées de P3
sol:=allvalues(solve([tan(phi)*x-r/cos(phi)=y,y^2+x^2=R2^2],[x,y])): # Intersection de 2 cercles
sol1:=allvalues(solve([(x-E)^2+y^2=(R-a)^2,y^2+x^2=R2^2],[x,y])): # Coordonnées des points du pourtour de l'élément de croix #point(O,0,0):
phi:=Pi/5:
R2:=5:
r:=1/4:
E:=R2/cos(phi):
R:=R2*tan(phi):
a:=0.5:
[(R2/2-r)*cos(phi),(R2/2-r)*sin(phi)];
geometry[point](P1,(R2/2-r)*cos(phi),(R2/2-r)*sin(phi)):
geometry[point](P2,(R2/2)*cos(phi)+r*sin(phi),(R2/2)*sin(phi)-r*cos(phi)):

[(9/4)*cos((1/5)*Pi), (9/4)*sin((1/5)*Pi)]

xP2:=(R2/2)*cos(phi)+r*sin(phi):
yP2:=(R2/2)*sin(phi)-r*cos(phi):
xP1:=(R2/2-r)*cos(phi):
yP1:=(R2/2-r)*sin(phi): # Equation paramétrique du segment OP1 (t varie de 0 à 1) ; non pris en compte
x1:=t*(0-xP1)+xP1:
y1:=t*(0-yP1)+yP1:
n1:=5:
dt:=1/(n1-1): #t varie entre 0 et 1

for i to n1 do tau:=(i-1)*dt:
xx[i]:=evalf(subs(t=tau,x1)):
yy[i]:=evalf(subs(t=tau,y1)): #print(i,xx[i],yy[i]);
od: # Equation paramétrique du quart de cercle P1P2 de la rainure (t varie de 0 à 1)
x2:=R2/2*cos(phi)+r*cos(t): #attention au sens de rotation du parcours de l'objet
y2:=R2/2*sin(phi)+r*sin(t):
n2:=6:
dt:=Pi/2/(n2-1): #arc de Pi/2
for i to n2 do
tau:=phi-Pi+(i-1)*dt:
xx[i]:=evalf(subs(t=tau,x2)):
yy[i]:=evalf(subs(t=tau,y2)):
od:
for i to n2 do
Vector[row]([i,xx[i],yy[i]])
od:

droite:=plot((tan(phi)*x-r/cos(phi),x=0..3),linestyle=dot,color=blue):

xP3:=evalf(subs(op(1,sol[1]),x)):
yP3:=evalf(subs(op(1,sol[1]),y)):
xP2:=evalf(subs(op(1,sol[2]),x)):
yP2:=evalf(subs(op(1,sol[2]),y)):
xP4:=evalf(subs(op(1,sol1[1]),x)):
yP4:=evalf(subs(op(1,sol1[1]),y)):
xP5:=E-(R-a):
yP5:=0:
x3:=t*(xP3-xP2)+xP2:
y3:=t*(yP3-yP2)+yP2:
n3:=10:
dt:=1/(n3-1): #t varie entre 0 et 1

for i to n3 do
tau:=(i-1)*dt:
xx[i+n2]:=evalf(subs(t=tau,x3)):
yy[i+n2]:=evalf(subs(t=tau,y3)):
od:

for i to n3 do Vector[row]([i,xx[i],yy[i]]) od:

x4:=xP5+R-a+(R-a)*cos(t):#attention au sens de rotation du parcours de l'objet
y4:=(R-a)*sin(t):
n4:=11:
eta:=arcsin(yP4/(R-a)):
dt:=(-eta)/(n2-1)/2:#arc de Pi/2

for i to n4 do
tau:=(Pi+eta)+(i-1)*dt: #recherche de tau ?
xx[i+n2+n3]:=evalf(subs(t=-tau,x4)):
yy[i+n2+n3]:=evalf(subs(t=-tau,y4)):
od:

for i to n4 do
Vector[row]([i,xx[i],yy[i]])
od:

n:=n2+n3+n4;
for i to n do
Vector[row]([i,xx[i],yy[i]])
od:

27

figure:=NULL:
for i from 0 to n do
xx[0]:=0:
yy[0]:=0:
figure:=figure,[xx[i],yy[i]]:
od:

figure:=[figure]:

polygonplot(figure,scaling=constrained,color=yellow);#,view=[-0.1..5,-0.1..3]

for i to n do
X[i]:=xx[i]:
Y[i]:=yy[i]
od:

d1:=plottools[disk]([xP1,yP1],0.05,color=blue):############ non définis
d2:=plottools[disk]([xP2,yP2],0.05,color=red):############ non définis

n := 27; ##### ci-dessus, il faut arrêter le trait à l'axe Ox ############### il suffit de prendre le symétrique puis 4 rotations de Pi/5 #############
symOX:= pt -> [pt[1],-pt[2]]:
rot:=proc(t,pt) [pt[1]*cos(t)-pt[2]*sin(t),pt[1]*sin(t)+pt[2]*cos(t)]; end:
figure1:=[ op(figure),op(map(symOX,figure))]:
croix:=op(figure1):

27

for i to 4 do croix:=croix,op(map( pt -> rot(i*2*Pi/5,pt),figure1) ): od:
croix:=[croix]:
polygonplot(croix,scaling=constrained,color=yellow); #How arrange this drawning and animate it. Thank you.

 


 

Download GenovaDrive.mw

[Just in case the above is not a 100%-correct presentation of the original code, I've left it below in its origianally posted form.--Carl Love as Moderator]

restart:with(LinearAlgebra):with(plots):with(geometry):with(plottools): On appelle alpha la moitié de l'angle de rotation de la roue menée par tour de roue menante. alpha=Pi/n en raduans soit Pi/5=36° pour 5 rainures.. On a alors les relations suivantes entre l'entaxe E, le rayon de la roue ùenante R1 et le rayon de la roue menée R2 : R1=E.sin(alpha), R2=E*cos(alpha) Intersection du cercle (O,R2) avec la droite tan(phi)x-r/cos(phi), on obtient les coordonnées de P3 sol:=allvalues(solve([tan(phi)*x-r/cos(phi)=y,y^2+x^2=R2^2],[x,y])): Intersection de 2 cercles sol1:=allvalues(solve([(x-E)^2+y^2=(R-a)^2,y^2+x^2=R2^2],[x,y])): Coordonnées des points du pourtour de l'élément de croix #point(O,0,0): phi:=Pi/5:R2:=5:r:=1/4:E:=R2/cos(phi):R:=R2*tan(phi):a:=0.5: [(R2/2-r)*cos(phi),(R2/2-r)*sin(phi)]: geometry[point](P1,(R2/2-r)*cos(phi),(R2/2-r)*sin(phi)): geometry[point](P2,(R2/2)*cos(phi)+r*sin(phi),(R2/2)*sin(phi)-r*cos(phi)): xP2:=(R2/2)*cos(phi)+r*sin(phi):yP2:=(R2/2)*sin(phi)-r*cos(phi): xP1:=(R2/2-r)*cos(phi):yP1:=(R2/2-r)*sin(phi): Equation paramétrique du segment OP1 (t varie de 0 à 1) ; non pris en compte x1:=t*(0-xP1)+xP1: y1:=t*(0-yP1)+yP1: n1:=5: dt:=1/(n1-1):#t varie entre 0 et 1 for i to n1 do tau:=(i-1)*dt: xx[i]:=evalf(subs(t=tau,x1)): yy[i]:=evalf(subs(t=tau,y1)): #print(i,xx[i],yy[i]); od: Equation paramétrique du quart de cercle P1P2 de la rainure (t varie de 0 à 1) x2:=R2/2*cos(phi)+r*cos(t):#attention au sens de rotation du parcours de l'objet y2:=R2/2*sin(phi)+r*sin(t): n2:=6: dt:=Pi/2/(n2-1):#arc de Pi/2 for i to n2 do tau:=phi-Pi+(i-1)*dt: xx[i]:=evalf(subs(t=tau,x2)): yy[i]:=evalf(subs(t=tau,y2)): od: for i to n2 do Vector[row]([i,xx[i],yy[i]]) od: droite:=plot((tan(phi)*x-r/cos(phi),x=0..3),linestyle=dot,color=blue): sol[1]: xP3:=evalf(subs(op(1,sol[1]),x)):yP3:=evalf(subs(op(1,sol[1]),y)): xP2:=evalf(subs(op(1,sol[2]),x)):yP2:=evalf(subs(op(1,sol[2]),y)): xP4:=evalf(subs(op(1,sol1[1]),x)):yP4:=evalf(subs(op(1,sol1[1]),y)): xP5:=E-(R-a):yP5:=0: x3:=t*(xP3-xP2)+xP2: y3:=t*(yP3-yP2)+yP2: n3:=10: dt:=1/(n3-1):#t varie entre 0 et 1 for i to n3 do tau:=(i-1)*dt: xx[i+n2]:=evalf(subs(t=tau,x3)): yy[i+n2]:=evalf(subs(t=tau,y3)): od: for i to n3 do Vector[row]([i,xx[i],yy[i]]) od: x4:=xP5+R-a+(R-a)*cos(t):#attention au sens de rotation du parcours de l'objet y4:=(R-a)*sin(t): n4:=11: eta:=arcsin(yP4/(R-a)): dt:=(-eta)/(n2-1)/2:#arc de Pi/2 for i to n4 do tau:=(Pi+eta)+(i-1)*dt:#recherche de tau ? xx[i+n2+n3]:=evalf(subs(t=-tau,x4)): yy[i+n2+n3]:=evalf(subs(t=-tau,y4)): od: for i to n4 do Vector[row]([i,xx[i],yy[i]]) od: n:=n2+n3+n4; for i to n do Vector[row]([i,xx[i],yy[i]]) od: figure:=NULL: for i from 0 to n do xx[0]:=0:yy[0]:=0: figure:=figure,[xx[i],yy[i]]: od: figure:=[figure]: polygonplot(figure,scaling=constrained,color=yellow):#,view=[-0.1..5,-0.1..3] for i to n do X[i]:=xx[i]: Y[i]:=yy[i] od: d1:=plottools[disk]([xP1,yP1],0.05,color=blue):############ non définis d2:=plottools[disk]([xP2,yP2],0.05,color=red):############ non définis n := 27 ##### ci-dessus, il faut arrêter le trait à l'axe Ox ############### il suffit de prendre le symétrique puis 4 rotations de Pi/5 ############# symOX:= pt -> [pt[1],-pt[2]]: rot:=proc(t,pt) [pt[1]*cos(t)-pt[2]*sin(t),pt[1]*sin(t)+pt[2]*cos(t)]; end: figure1:=[ op(figure),op(map(symOX,figure))]: croix:=op(figure1): for i to 4 do croix:=croix,op(map( pt -> rot(i*2*Pi/5,pt),figure1) ): od: croix:=[croix]: polygonplot(croix,scaling=constrained,color=yellow); How arrange this drawning and animate it. Thank you.

I am working with the Physics package in Maple 2018. I have a spacetime with a metric g and the vector field l is the tangent to a null curve. I have two problems:

(1) I want to check in maple that indeed g(l,l)=0. For this I wrote:

SumOverRepeatedIndices(g_[mu,nu]l[~mu]l[~nu])

Firstly, when I try to execute this command, the program keeps on evaluating for a long time. So, I have to `interrupt the current operation', undo this command, save and reopen the file, execute the entire worksheet again and then somehow it works. However, as you can see in step(13) of the attached worksheet, Maple returns an expression for this command but doesn't cancel out terms and show that it is indeed zero. How can I do this?

(2) I wish to find $(\nabla_l l)^\nu$. Is there a way to directly do this? Or should I do something like:

Define(L[mu,~nu]=D_mu l[~nu])

SumOverRepeatedIndices(l[~mu]L[mu,~nu])

Thanks a lot.

Edit: I actually carried out these steps too. First, I defined $L_\mu^\nu$ in step (14). Then, when I ask for the non-zero components of L, I find that the L\mu,\nu components are given. How can I get the non-zero L\mu\nu components? Also, in step (16), I did the `SumOverRepeatedindices' but it returned only a symbolic result without evaluationg.

try2.mw

How I can simplify result? For factor or using rule.

Thanks

 

Hello,

I am trying to work with the Physics package to calculate Christoffel symbols. I have just started using Maple today and am coming up against a few hurdles.

I want to change the signature of the metric from (+---) to (-+++). I am typing the following in math mode:

Setup( signature = '-+++')

However, this is returning the following error:

"Error, invalid sum/difference" with my command rewritten within a red box together with the last '+" within another red box. Can you please help me out with this?

Thank you.

 

Hello,

How can write a code for determination of Laplacian in a new form is introduced in maple code (First line).

Thank you.

FOR2
 

``

"L:=(∑)`e__i`/(`h__i`)*(∂)/(∂ `xi__i`).((∑)(∑)`e__k`/(`h__k`)((∂)/(∂ `xi__k`)`U__j`*`e__j`+`U__j`(∂)/( `xi__k`)`U__j`)):"

restart; with(VectorCalculus); with(LinearAlgebra); h__1 := VectorCalculus:-`*`(a, 1/cosh(r)); h__2 := VectorCalculus:-`*`(a, 1/cosh(r)); h__3 := VectorCalculus:-`*`(sinh(r), 1/cos(theta)); U__1 := u__r; U__2 := `u__θ`; U__3 := `u__φ`

"for i from 1 to 3 do  for j from 1 to 3 do  for k  from 1 to 3 do     if i=1 then   `h__i`:=a/(cosh(r)-cos(theta)); `U__i`:=`u__r`;`e__i`:=`e__r`:`xi__i`:=r:     else  if i=2 then  `h__i`:=a/(cosh(r)-cos(theta));`U__i`:=`u__theta`;`e__i`:=`e__theta`:`xi__i`:=theta:  else ;   `h__i`:=a/(cosh(r)-cos(theta));`U__i`:=`u__phi`;`e__i`:=`e__phi`:`xi__i`:=phi:  end if;          if  j=1 then ;  `h__j`:=a/(cosh(r)-cos(theta)); `U__j`:=`u__r`;`e__j`:=`e__r`:`xi__j`:=r:   else if  j=2 then;  `h__j`:=a/(cosh(r)-cos(theta));`U__j`:=`u__theta`;`e__j`:=`e__theta`:`xi__j`:=theta:  else ;   `h__j`:=a/(cosh(r)-cos(theta));`U__j`:=`u__phi`;`e__j`:=`e__phi`:`xi__j`:=phi:  end if;       if k=1 then   `h__k`:=a/(cosh(r)-cos(theta)); `U__k`:=`u__r`;`e__k`:=`e__r`:`xi__k`:=r:   else if i=2 then  `h__k`:=a/(cosh(r)-cos(theta));`U__k`:=`u__theta`;`e__k`:=`e__theta`:`xi__k`:=theta:  else     `h__k`:=a/(cosh(r)-cos(theta));`U__k`:=`u__phi`;`e__k`:=`e__phi`:`xi__k`:=phi:  end if;                   end ;  end ;         end ;               "

Error, unterminated loop

"for i from 1 to 3 do  for j from 1 to 3 do  for k  from 1 to 3 do    if i=1 then `h__i`:=a/(cosh(r)-cos(theta)); `U__i`:=`u__r`;`e__i`:=`e__r`:xi__i:=r:     else  if i=2 then  `h__i`:=a/(cosh(r)-cos(theta));`U__i`:=`u__theta`;`e__i`:=`e__theta`:xi__i:=theta:  else ;   `h__i`:=a/(cosh(r)-cos(theta));`U__i`:=`u__phi`;`e__i`:=`e__phi`:xi__i:=phi:  end if;       if j=1 then ;  `h__j`:=a/(cosh(r)-cos(theta)); `U__j`:=`u__r`;`e__j`:=`e__r`:xi__j:=r:   else if j=2 then;  `h__j`:=a/(cosh(r)-cos(theta));`U__j`:=`u__theta`;`e__j`:=`e__theta`:xi__j:=theta:  else ;   `h__j`:=a/(cosh(r)-cos(theta));`U__j`:=`u__phi`;`e__j`:=`e__phi`:xi__j:=phi:  end if;     if k=1 then `h__k`:=a/(cosh(r)-cos(theta)); `U__k`:=`u__r`;`e__k`:=`e__r`:xi__k:=r:   else if i=2 then  `h__k`:=a/(cosh(r)-cos(theta));`U__k`:=`u__theta`;`e__k`:=`e__theta`:xi__k:=theta:  else `h__k`:=a/(cosh(r)-cos(theta));`U__k`:=`u__phi`;`e__k`:=`e__phi`:xi__k:=phi:  end if;           end ;  end ;     end ;               "

 

i

i

(1)

j

j

(2)

``


 

Download FOR2

 

 

How can plot two  and bipolar figures as attached and extract their data.

Thank You.

with(LinearAlgebra):
assign(seq(U || i = `<,>`(x[i], y[i]), i = 1 .. 3));
U || 4 := U || 1; r := (1/6)*sqrt(3);
assign(seq(V || i = (U || i+U || (i+1))*(1/2)+(`<,>`(`<|>`(0, 1), `<|>`(-1, 0)) . (U || (i+1)-U || i))*r, i = 1 .. 3)); Norm(V || 3-V || 1, 2); is(Norm(V || 3-V || 1, 2) = Norm(V || 3-V || 2, 2)); is(Norm(V || 2-V || 1, 2) = Norm(V || 3-V || 2, 2));

Fsolve produces the correct solution.  solve followed by evalf produces a completely different solution.

What am I doing wrong?

## Ioannes Colla problem: "Divide 10 into three parts such that they
## shall be in continued proportion and that the product of the first
## two shall be 6"
eqs := [a+b+c=10, a/b=b/c, a*b=6];
fsolve(eqs); ## correct solution
evalf(solve(eqs)); ## different

Tom Dean

Would anybody be able to explain to me why I had to rewrite this one baby-procedure that has an if-statement inside my larger procedure, so that I could get a later on if-statement to work? As best I can tell, they mean exactly the same thing.


 

Information that may be pertinent:

 - The entire (overall) procedure worked without throwing any warnings prior to my adding this new if-statement.
 - The if-statement itself worked perfectly fine on another worksheet, though I hadn't tested it inside a procedure.
 - Commenting out the if-statement but retaining the interior commands led to the sheet compiling again, showing that it was in fact the presence of the if-statement causing the issue. 
 - When I commented out the offending baby-procedure that started throwing the warning, the sheet once again compiled.

The added if statement:

if eval_size > 4 then Search(max(seq(eval_cont[i], i = 4 .. eval_size)), eval_cont); evals_pairlist := evals_pairlist[[1 .. 3, %]] fi:

The error I get, and its "positioning": 

Error, invalid expression for inline function

 

Hello,

How I can remove some problems in my code.

I wrote it before in  software, but in some lines, I have some problems with it.

How I can change it in maple to run well?


 

restart

M := 2; B := 1; C := 3; K := 6; f := 2*exp(-t); q0 := 1; qd0 := -1; qd20 := 1; alpha := 1/2; beta := 1/12; gammaa := 1/4; h := .1; Tf := 2

"N:=size(M,1)  T:=0:h:Tf;  lt:=length(T);  F:=subs(f,t,T);  F:=subs(t=T,f);    qd30:=M\(F(1)-B*qd20-C*qd0-K*q0);   q:=zeros(N,lt)  qd:=zeros(N,lt)  qd2:=zeros(N,lt);  qd3:=zeros(N,lt);  q(:,1):=q0  qd(:,1):=qd0  qd2(:,1):=qd20  qd3(:,1):=qd30"

Error, invalid function arguments

"N:=size(M,1)  T:=0:h:Tf;  lt:=length(T);  F:=subs(f,t,T);  F:=subs(t=T,f);    qd30:=M\(F(1)-B*qd20-C*qd0-K*q0);  q:=zeros(N,lt)  qd:=zeros(N,lt)  qd2:=zeros(N,lt);  qd3:=zeros(N,lt);  q(:,1):=q0  qd(:,1):=qd0  qd2(:,1):=qd20  qd3(:,1):=qd30"

 

"A:=M+alpha*h*B+gammaa*(h^2)*C+beta*(h^3)*K;  for n:=1:lt-1 do      D:=F(n+1)-B*(qd2(:,n)+(1-alpha)*h*qd3(:,n))-...          C*(qd(:,n)+h*qd2(:,n)+(0.5-gammaa)*(h^2)*qd3(:,n))-...          K*(q(:,n)+h*qd(:,n)+(h^2)/2*qd2(:,n)+(1/6-beta)*(h^3)*qd3(:,n));      qd3(:,n+1):=A\D;      qd2(:,n+1):=qd2(:,n)+(1-alpha)*h*qd3(:,n)+alpha*h*qd3(:,n+1);      qd(:,n+1):=qd(:,n)+h*qd2(:,n)+(0.5-gammaa)*(h^2)*qd3(:,n)+gammaa*(h^2)*qd3(:,n+1);      q(:,n+1):=q(:,n)+h*qd(:,n)+(h^2)/2*qd2(:,n)+(1/6-beta)*(h^3)*qd3(:,n)+...          beta*(h^3)*qd3(:,n+1);  end do"

Error, invalid function arguments

"A:=M+alpha*h*B+gammaa*(h^2)*C+beta*(h^3)*K;  for n:=1:lt-1 do      D:=F(n+1)-B*(qd2(:,n)+(1-alpha)*h*qd3(:,n))-...          C*(qd(:,n)+h*qd2(:,n)+(0.5-gammaa)*(h^2)*qd3(:,n))-...          K*(q(:,n)+h*qd(:,n)+(h^2)/2*qd2(:,n)+(1/6-beta)*(h^3)*qd3(:,n));      qd3(:,n+1):=A\D;      qd2(:,n+1):=qd2(:,n)+(1-alpha)*h*qd3(:,n)+alpha*h*qd3(:,n+1);      qd(:,n+1):=qd(:,n)+h*qd2(:,n)+(0.5-gammaa)*(h^2)*qd3(:,n)+gammaa*(h^2)*qd3(:,n+1);      q(:,n+1):=q(:,n)+h*qd(:,n)+(h^2)/2*qd2(:,n)+(1/6-beta)*(h^3)*qd3(:,n)+...          beta*(h^3)*qd3(:,n+1);  end do"

 

plot(T, q, 'r-o', 'linewidth', 1.5)

Error, (in plot) unexpected options: [r-o, , 1.5]

 

``


 

Download

 

Hi freind,

Anybody knows what happen to this coding?

why this error happens? how can i fix it?

thank you!

3 4 5 6 7 8 9 Last Page 5 of 40
´╗┐