Maple 2018 Questions and Posts

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

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!

Please help me for removing an error in my code.

Thank you


 

"   restart:     NL:=960:    LL:=4:      BB:=0.6 :  T:=16:    MM:=NL*(LL+1):          for  NC  from 0 by 1 to MM-1  do       S:=BB+(2*Pi*NC/T)*I;          powerFactor := 0.05 * (sqrt(2.0) - 1.202081528);     powerTerm := sqrt(S)*sqrt(49*S^(2)+280*S+800)/sqrt(S+4);       preFactor := 1/((exp(sqrt(2.0)*powerTerm/10.0)-1.0)*S);       XS(NC+1):= preFactor * ((-exp(-powerFactor*powerTerm) + exp(powerFactor*powerTerm)) * exp(sqrt(2.0)*powerTerm/20.0));    end  do;    for  timeCounter from 0 by 1 to  NL-1  do     totalTerm:=0;     for KK from 0 to NL-1 do        for L from 0 to LL do           Term1:=Re(XS(KK+L*NL+1))+I*(Im(XS(KK+L*NL+1)));           Term2:=exp((timeCounter*KK*2*Pi/NL)*I);           totalTerm:=totalTerm+Term1*Term2;        end do     end do     XT(timeCounter+1):=((2.0/T)*exp(BB*timeCounter*T/NL)*(-0.5*Re(XS(1))+Re(totalTerm)));     TT(timeCounter+1):=(timeCounter*T)/NL;         end do    "

Error, invalid loop statement termination

"   restart:    NL:=960:  LL:=4:  BB:=0.6 :  T:=16:    MM:=NL*(LL+1):       for NC  from 0 by 1 to MM-1  do     S:=BB+(2*Pi*NC/T)*I;    powerFactor := 0.05 * (sqrt(2.0) - 1.202081528);   powerTerm := sqrt(S)*sqrt(49*S^2+280*S+800)/sqrt(S+4);    preFactor := 1/((exp(sqrt(2.0)*powerTerm/10.0)-1.0)*S);     XS(NC+1):= preFactor * ((-exp(-powerFactor*powerTerm) + exp(powerFactor*powerTerm)) * exp(sqrt(2.0)*powerTerm/20.0));    end  do;    for timeCounter from 0 by 1 to NL-1  do  totalTerm:=0;     for KK from 0 to NL-1 do        for L from 0 to LL do  Term1:=Re(XS(KK+L*NL+1))+I*(Im(XS(KK+L*NL+1)));  Term2:=exp((timeCounter*KK*2*Pi/NL)*I);  totalTerm:=totalTerm+Term1*Term2;        end do     end do   XT(timeCounter+1):=((2.0/T)*exp(BB*timeCounter*T/NL)*(-0.5*Re(XS(1))+Re(totalTerm)));   TT(timeCounter+1):=(timeCounter*T)/NL;      end do    "

 

``

``


 

Download

 

Hello,

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

Thank you.

FOR

Maple Worksheet - Error

Failed to load the worksheet //convert/FOR
 

Download FOR

 

 

How to do the partition of integer?
If I input:
>Partition(10,2)
then output is:
>[[1, 9], [2, 8], [3, 7], [4, 6],[5,5]]
-------------------------------------------------
"10" is the number that I want to part,and "2" means that there are "two" number's sum = 10
Sorry my Engilsh is not good,but I really need help.
no other restriction!!

Hi everyone

 

Im new to MaplePrimes aswell as to Maple.

I have a task where i shoud plot the following shape (with a hole in the centre) using the plot3d function:

 

 

 

 

 

 

 

All i have accomplished in the last hours is the following file A1.0.mw:

As you can see i havent been able to get rid off the surface in the centre nor the spikes on the edge...
 

  • In order to fix the issue regarding the centre I assume I have to exclude the range -2..2 from x, but havent been able to do so.
  • Regarding the spikes on the edge Im honestly pretty much clueless why they appear in the first place.

 

After several hours of trying on my own, I really need your help please!

A1.0.mw
 

f := (x, y) -> ((((((x^2)+(y^2))^(1/2))-4))/(((((x^2)+(y^2))^(1/2))-2)*((((x^2)+(y^2))^(1/2))-6)))+15;
plot3d(f, -6..6, -sqrt(-x^2+36) .. sqrt(-x^2+36), grid=[400,400], view=0..30);

proc (x, y) options operator, arrow; ((y^2+x^2)^(1/2)-4)/(((y^2+x^2)^(1/2)-2)*((y^2+x^2)^(1/2)-6))+15 end proc

 

 

 


 

Download A1.0.mw
 

 

 

Please check this code and fix the error. And help me with the below two questions.

1- In the above image, I'm getting the error when I'm to plot my solutions.

2- How to get information from this system?

      The values of x_1 and corresponding y_1 and so on and errors etc

This is a downloadable link to my worksheet [Practice.mw]

Thanks!


>restart;
> ODEtools[declare]((S, L, B)(t), prime = t);
         ODEtools[declare](S(t), L(t), B(t), prime = t)
> DE1 := diff(S(t), t) = -L*S*beta-`μS`+mu;
                    d                               
            DE1 := --- S(t) = -L S beta - μS + mu
                    dt                              
> DE2 := diff(L(t), t) = L*S*beta-(gamma+mu)*S;
                  d                                  
          DE2 := --- L(t) = beta S L - (gamma + mu) S
                  dt                                 
> DE3 := diff(B(t), t) = L*gamma-gamma*mu;
                      d                           
              DE3 := --- B(t) = L gamma - gamma mu
                      dt                          
> init_conds := S(0) >= 0, L(0) >= 0, B(0) >= 0;
         init_conds := 0 <= S(0), 0 <= L(0), 0 <= B(0)
> sys := {init_conds, diff(B(t), t) = L*gamma-gamma*mu, diff(L(t), t) = L*S*beta-(gamma+mu)*S, diff(S(t), t) = -L*S*beta-`&mu;S`+mu};

> sol := dsolve(sys, numeric, parameters = [mu, beta, gamma, S(t), L(t), B(t)], method = rkf45);

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations


> sol(parameters = [mu = .234, beta = 2.345, gamma = 5.678, S(t) = 6.678, L(t) = 6.789, B(t) = 7.123]);
           sol(parameters = [mu = 0.234, beta = 2.345, gamma = 5.678, S(t) = 6.678, L(t) = 6.789, B(t) = 7.123])

On CBS tv show Survivor S38E4, an interesting scenario arose. There was initially 2 teams comprising 6 persons (blue team) and 9 persons (yellow team). Then they decided to mix it up, and split it into 3 teams. Each player was randomly assigned a buff, (red, green or orange =3 colored buffs *5).= 3 teams of 5.

What was interesting was 5 out of the original 6 blue team are now in the new red team. 5 of the original yellow team are in the new green team and 4 of the original yellow team are in the new orange team. 

What is the chances of that happening?
A couple of attempts:

survivor_rand.mw

I'm using Maple on a compute server (via Putty from my computer which has windows system). It is an only-text mode server so it is a black screen and text and no menu bar to choose file and then save by clicking etc. You only can write commands and press Enter.

The IT section suggested to use writeto("filename.txt"), but I can't see any file on my drive, I used writeto("\drvename\filename.txt"), but still nothing.

Thanks to @acer@Joe Riel and the IT section. The problem now is solved. It was about the way that I was writing the directory path. I had to add something before the "drivename" in my case. Plus that it is a Unix path, so I should use / not \.

Hello, i am experiencing some problems when trying to open the maple 2018 software*
I have tried unistalling and download it again.
I have tried to search for sollution but there is very ittle intel
When i open Maple 2018 it just lingeres on the start up (pic below) and just disappears after 10 seconds

Can someone please help i have a very important examination upcoming

restart;
F0:=proc(sigma__xx,N)
local  x,y,Fx,Fy,:
assume (w,real,w>0):assume (h,real,h>0):

for n from 0 by 2 to N do Fx:=integrate(sigma__xx*cos(w*Zeta*h),Zeta=0..infinity):
end do;
for n from 1 by 2 to N do Fx:=integrate(sigma__xx*sin(w*Zeta*h),Zeta=0..infinity):
end do;
return [Fx]:
end proc;

sigma__xx := -(sqrt(Zeta^2*h^2+h^2)^(-n+2)*cos(n*arctan(h, Zeta*h))*n^2+sqrt(Zeta^2*h^2+h^2)^(-n+2)*cos(n*arctan(h, Zeta*h))*n-2*sqrt(Zeta^2*h^2+h^2)^(-n+2)*cos(n*arctan(h, Zeta*h)))*Zeta^2*h^2/(Zeta^2*h^2+h^2)^2+(sqrt(Zeta^2*h^2+h^2)^(-n+2)*cos(n*arctan(h, Zeta*h))*n^2-3*sqrt(Zeta^2*h^2+h^2)^(-n+2)*cos(n*arctan(h, Zeta*h))*n;

F0(sigma__xx,N);

Hello everyone,

I am a studen and have an astrophysics class where I programmed a basic space probe to go from a planet A to a Planet B.

I have a 2D grap and a 3D graph already done however I would like to animate them.

I have included both a picture and my whole program. Also see some code below. 

Thanks to all.

 

Download SondeII_(1).mwSondeII_(1).mwSondeII_(1).mw

restart:

with(linalg):
with(DEtools):

#Sonde
Position := [x(t), y(t)]:

#Terre
omega1 :=2*Pi:
r1 := [cos(omega1*t), sin(omega1*t)]:
x1(t) := innerprod([1, 0], r1):
y1(t) := innerprod([0, 1], r1):

#Mars
omega2 := sqrt(2)*Pi/2:
phi2 := Pi/2:
r2 := [2*cos(omega2*t + phi2), 2*sin(omega2*t+ phi2)]:
x2(t):= innerprod([1, 0], r2):
y2(t):= innerprod([0, 1], r2):

#Les couplages gravitationnelles (masse).
c1 := 1.0:
c2 := 0.2:
c0 := 100:

#Les forces appliqués sur la sonde
ForceGravitationnelle1 := -c1*(Position-r1)/(sqrt((x(t)-x1(t))^2+(y(t)-y1(t))^2))^3:
ForceGravitationnelle2 := -c2*(Position-r2)/(sqrt((x(t)-x2(t))^2+(y(t)-y2(t))^2))^3:
ForceGravitationnelle0 := -c0*(Position)/(sqrt((x(t))^2+(y(t))^2))^3:

#La somme des forces.
Force := ForceGravitationnelle1 + ForceGravitationnelle2 + ForceGravitationnelle0:

Fx := innerprod([1, 0], Force):
Fy := innerprod([0, 1], Force):

#L'interval de temps.
TempsInit := 0:
TempsFinal := 3:

#Les équations différentielles de deuxieme ordre.
eq1x := (D(D(x)))(t) = Fx:
eq1y := (D(D(y)))(t) = Fy:

#Les conditions initiales..
phi0 :=(Pi)/2:
V0 := 12.946802:
x0 := 1:
y0 := 0.1:
Vx0 := V0*cos(phi0):
Vy0 := V0*sin(phi0):

ConditionsInit := x(0) = x0, y(0) = y0, D(x)(0) = Vx0, D(y)(0) = Vy0:

#La trajectoire de la sonde.
Trajectoire := dsolve({eq1x, eq1y, ConditionsInit}, {x(t), y(t)}, numeric, range = TempsInit..TempsFinal, maxfun=0):

#Tracage du graphique de la trajectoire en 2D
plots[odeplot](Trajectoire, [[0,0],[x1(t),y1(t)],[x2(t), y2(t)], [x(t), y(t)]],
TempsInit..TempsFinal, numpoints = 1000, axes = boxed, scaling = constrained, thickness = [2],
color = ["Black", "Green", "Blue", "Red"],
labels = ["X (L)", "Y (L)"],
labelfont = ["Times", 14], title = "Mouvement de la sonde dans le plan",
titlefont = ["Helvetica", 14], style=[point,line,line,line], symbol = solidcircle);

#Tracage du graphique en 3D:
plots[odeplot](Trajectoire, [[0,0,t],[x1(t),y1(t), t],[x2(t), y2(t), t], [x(t), y(t), t]],
TempsInit..TempsFinal, numpoints = 1000, axes = boxed, scaling = constrained, thickness = [3],
color = ["Black", "Green", "Blue", "Red"],
labels = ["X (L)", "Y (L)", "t"],
labelfont = ["Times", 14], title = "Mouvement de la sonde dans le plan",
titlefont = ["Helvetica", 14], style=[point,line,line,line], symbol = solidcircle);
 

 

 

 

 

 


 

Hello,

How I can take Laplace inverse?

Thank you

LAPLACE

Maple Worksheet - Error

Failed to load the worksheet //convert/LAPLACE
 

Download LAPLACE

 

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