Items tagged with syntax

Hi

I'm trying to add a new element to an array to a position that doesn't exist (length+1). According to the Maple help sheet, automatic resizing should take care of this. Instead I'm getting the error 'Error, invalid left hand side in assignment'. I tried this in a new worksheet. This is the entire code

L:=Array():
L:=(1,2,3,4,5):
L:=(6):
L;

When I run this, it kicks that error and only returns 1,2,3,4,5

When I do this to a 2D array it seems to work which has confused me more!

Thanks for your help


 

restart

G := 6.6743*10^(-8); 1; R := 1336599.126346; 1; rho := 2.2450*10^14; 1; c := 2.9799*10^10; 1; a := 1/(8/3*(6.67*10^(-8)*Pi*rho/c^2))^.5

0.6674300000e-7

 

1336599.126346

 

0.2245000000e15

 

0.2979900000e11

 

4715700.713/Pi^.5

(1)

y(x) = rho*c((1-(x/a)^2)^(1/2)-(1-(R/a)^2)^(1/2))^2/(3*(1-(R/a)^2)^(1/2)-(1-(x/a)^2)^(1/2))

y(x) = 0.1993516000e36/(3*(1-0.8033593953e-1*Pi^1.0)^(1/2)-(1-0.4496840993e-13*x^2*Pi^1.0)^(1/2))

(2)

``


 

Download y(x).mw

hi

how i can remove this error?

1) ''Error, invalid input: lhs received diff(diff(diff(diff(w(x, y, t), x), x), x), x)+.12*(diff(diff(diff(diff(w(x, y, t), x), x), y), y))+0.11e-2*(diff(diff(diff(diff(w(x, y, t), y), y), y), y))+10-.4*(diff(diff(w(x, y, t), x), x))-0.4e-2*(diff(diff(w(x, y, t), y), y))+diff(diff(w(x, y, t), t), t)-w(x, y, t)-tau, which is not valid for its 1st argument, expr'''''

2)'' Error, incorrect number of extra arguments in select''

thanks

scale.mw
 

 

NULL

restart:Digits := 15: beta := 1: alpha := 0.1: Upsilon := .1: xi := 10: eta := .1: N_X := .4: N_Y := .4: psi:NULL=4.73:tau = 10

tau = 10

(1)

A5 := 1; A6 := 2*alpha^2; A7 := alpha^4; A8 := xi; A9 := xi*alpha^2; A10 := xi*alpha^4; A11 := -N_X; A12 := -N_Y*alpha^2; A13 := 1; A14 := -beta; A15 := -tau

-tau

(2)

EOM := A5*(diff(w(x, y, t), x, x, x, x))+A6*(diff(w(x, y, t), x, x, y, y))+A7*(diff(w(x, y, t), y, y, y, y))+A8(diff(w(x, y, t), x, x, x, x))+A9*(diff(w(x, y, t), x, x, y, y))+A10*(diff(w(x, y, t), y, y, y, y))+A11*(diff(w(x, y, t), x, x))+A12*(diff(w(x, y, t), y, y))+A13*(diff(w(x, y, t), t, t))+A14*w(x, y, t)+A15

diff(diff(diff(diff(w(x, y, t), x), x), x), x)+.12*(diff(diff(diff(diff(w(x, y, t), x), x), y), y))+0.11e-2*(diff(diff(diff(diff(w(x, y, t), y), y), y), y))+10-.4*(diff(diff(w(x, y, t), x), x))-0.4e-2*(diff(diff(w(x, y, t), y), y))+diff(diff(w(x, y, t), t), t)-w(x, y, t)-tau

(3)

BC := w(0, y, t) = 0, (D[1, 1](w))(0, y, t) = 0, w(a, y, t) = 0, (D[1, 1](w))(a, y, t) = 0, w(x, 0, t) = 0, (D[2, 2](w))(x, 0, t) = 0, w(x, b, t) = 0, (D[2, 2](w))(x, b, t) = 0

w(0, y, t) = 0, (D[1, 1](w))(0, y, t) = 0, w(a, y, t) = 0, (D[1, 1](w))(a, y, t) = 0, w(x, 0, t) = 0, (D[2, 2](w))(x, 0, t) = 0, w(x, b, t) = 0, (D[2, 2](w))(x, b, t) = 0

(4)

 

 

BC1:=subs(a=1,b=1,[BC])

[w(0, y, t) = 0, (D[1, 1](w))(0, y, t) = 0, w(1, y, t) = 0, (D[1, 1](w))(1, y, t) = 0, w(x, 0, t) = 0, (D[2, 2](w))(x, 0, t) = 0, w(x, 1, t) = 0, (D[2, 2](w))(x, 1, t) = 0]

(5)

We use the method of multiple scales to directly attack EOM1 and BC1. To transform the time derivatives in EOM1 in terms of the scales  and , we let

timeScales:=T[0],T[1]

T[0], T[1]

(6)

dt[1]:=expr->add(epsilon^i*diff(expr,timeScales[i+1]),i=0..1)

proc (expr) options operator, arrow; add(epsilon^i*(diff(expr, timeScales[i+1])), i = 0 .. 1) end proc

(7)

msForm:={w(x,y,t)=w(x,y,timeScales),seq(diff(w(x,y,t),t$i)=dt[i](w(x,y,timeScales)),i=1..2)}

{diff(diff(w(x, y, t), t), t) = dt[2](w(x, y, T[0], T[1])), diff(w(x, y, t), t) = diff(w(x, y, T[0], T[1]), T[0])+epsilon*(diff(w(x, y, T[0], T[1]), T[1])), w(x, y, t) = w(x, y, T[0], T[1])}

(8)

multiScales:=`union`(map(s->subs(w=s,msForm),[w])[])

{diff(diff(w(x, y, t), t), t) = dt[2](w(x, y, T[0], T[1])), diff(w(x, y, t), t) = diff(w(x, y, T[0], T[1]), T[0])+epsilon*(diff(w(x, y, T[0], T[1]), T[1])), w(x, y, t) = w(x, y, T[0], T[1])}

(9)

Then, we seek a second-order approximate solution in the form

solRule:=w(x,y,timeScales)=add(epsilon^j*w[j](x,y,timeScales),j=1..3)

w(x, y, T[0], T[1]) = epsilon*w[1](x, y, T[0], T[1])+epsilon^2*w[2](x, y, T[0], T[1])+epsilon^3*w[3](x, y, T[0], T[1])

(10)

We introduce the detuning  to describe the nearness of the edge lengths  and , consider the case of primary resonance, and hence let

tau=epsilon^3*tau(x,y)*convert(cos(Omega*T[0]),exp)

tau = epsilon^3*tau(x, y)*((1/2)*exp(I*Omega*T[0])+(1/2)*exp(-I*Omega*T[0]))

(11)

lhs(EOM)

Error, invalid input: lhs received diff(diff(diff(diff(w(x, y, t), x), x), x), x)+.12*(diff(diff(diff(diff(w(x, y, t), x), x), y), y))+0.11e-2*(diff(diff(diff(diff(w(x, y, t), y), y), y), y))+10-.4*(diff(diff(w(x, y, t), x), x))-0.4e-2*(diff(diff(w(x, y, t), y), y))+diff(diff(w(x, y, t), t), t)-w(x, y, t)-tau, which is not valid for its 1st argument, expr

 

Substituting multiScales, solRule, and scaleRule2 into EOM1, expanding the result for small , and discarding terms of order higher than , we obtain

expr83a:=seq(convert(series(value(subs(multiScales,solRule,lhs(EOM))),epsilon,4),polynom),i=1)

Error, invalid input: lhs received diff(diff(diff(diff(w(x, y, t), x), x), x), x)+.12*(diff(diff(diff(diff(w(x, y, t), x), x), y), y))+0.11e-2*(diff(diff(diff(diff(w(x, y, t), y), y), y), y))+10-.4*(diff(diff(w(x, y, t), x), x))-0.4e-2*(diff(diff(w(x, y, t), y), y))+diff(diff(w(x, y, t), t), t)-w(x, y, t)-tau, which is not valid for its 1st argument, expr

 

NULL

NULL

t0 := time(); ST1_like := map(combine, select(has, select(has, ST, sin(m*Pi*x)), sin(n*Pi*y))); time_taken := time()-t0

.187

 

Error, incorrect number of extra arguments in select

 

0.

(12)

``


 

Download scale.mw

 

Hi!

In Maple, is it possible to define an element of a series like that:

a[n] = n^2

(i actually tried to enter := instead of =, but html editor told me its not valid maple expression)

So at any moment i enter a[5] and maple give me 5^2, or a[70] -> 70^2 ?

i wrote a procedure to  find some functions but at the end  of the procedure gives unexpected string error. i didn't find any way out.

Best regards. 

Download procedureA.mws

On some platforms, my editor of choice has become the aptly named Sublime Text. Unfortunately, it does not seem to have built in syntax highlighting for the Maple programming language and so I set out to write some.  In the end, I wrote enough highlighting to keep me sane when looking at Maple source, but it could use a lot more work.  So in case anyone is interested I've put what I have in a Github repository: SublimeTextMaple

If you use Sublime Text, please download it and add your own enhacements and share in turn.

I Could Not Write An If Then Or Ifelse Statement. Please Help Me.

f := unapply(x^2-2, x); a := 1; b := 2; n := 10; Digits := 10;
      2    
x -> x  - 2
                               1
                               2
                               10
                               10
c := evalf(eval((a*f(b)-b*f(a))/(f(b)-f(a))));
                          1.333333333
if  f(c)*f(a)<0 then ;
          "      k:=evalf(eval(|(f(c))/(b-c)|)) and "

                          /(1 + k) a f(b) - b f(a)\
             x[i] := evalf|-----------------------|
                          \  (1 + k) f(b) - f(a)  /
            "     elif f(x[i])*f(a)<0 then b:=x[i]"
                 "     else b:=c and a:=x[i] "
                  "     if f(c)*f(a)>0 then "
                 "      k:=|(f(c))/(b-c)|and "

                          /a f(b) - b f(a) (1 + k)\
             x[i] := evalf|-----------------------|
                          \  f(b) - f(a) (1 + k)  /
            "     elif f(x[i])*f(a)>0 then a:=x[i]"
              "     else a:=c and b:=x[i] end if"

Error, unterminated 'if' statement
     Typesetting:-mambiguous(Typesetting:-mambiguous(

       if fApplyFunction(c)sdotfApplyFunction(a)lt0 then , 

       Typesetting:-merror("unterminated 'if' statement")))

Previous year I was using Maple 2015 and I had a procedure in which I had used

A := Array((1 .. 3)$3);

And similar use of $. This year I'm using Maple 2016. Now I came back to my old procedure but Maple doesn't compile the procedure anymore and instead shows

Error, `$` unexpected
What is the problem? Is something changed in new version of Maple?

Why I use Array and $ is my old question here http://www.mapleprimes.com/questions/210628-Undefined-For-Loop-Bound which was fine before.

Greetings,

I have been attempting to plot a couple of functions and I keep getting the same error.  I will copying and paste what I have entered and the error messages

with(plots);

with(VectorCalculus);

sphereplot*(rho = theta, theta = 0 .. 4*Pi, phi = 0 .. (1/2)*Pi);

Error, (in simpl/reloprod) invalid terms in product: (rho = theta)*(theta = 0 .. 4*Pi)

 

with(plots);
with(VectorCalculus);
fieldplot*(<-x, y, cos z>, x = 0 .. 5, y = 0 .. 5, z = 0 .. 2*Pi);
Error, (in simpl/reloprod) invalid terms in product: (x = 0 .. 5)*(y = 0 .. 5)

 

Any assistance would be most appreciated.  Thanks in advance.

 

i copy maple code from notepad to maple in maple window,

there is no error

my function in the code

explicit define parameters are Local type

for example

appendto("...");

func1(aaa)

Local aaa;

 

but when i run cmaple to read the code text file in window 8

it return error

missing operator, syntax error

at Local aaa;

originally 

i have defined

Local aaa, ii;

for ii from 1 to nops(aaa) do

etc.

but it has error too,

then i change to one by one

Local aaa;

Local ii;

still have error at Local aaa;

I am getting the following error in one question

Error handling the file: /usr/local/hosted_apps/MapleTA/11/webapps/mapleta-2016.0.3-1148820/WEB-INF/modules/proctoredTest/questionSheet.html
Error in line 26: Error in line 4: Syntax error: Token[gte], line 1 in manage file

Does anyone have any idea what the problem could be? Link to question file:questions.qu

 

 

Dear sir

 

I try the below program and it is not executing because of error and that error is " unable to match delimiters" 

Please can you varify it.

sol1 := dsolve([diff(diff(diff(f(eta),eta),eta),eta)+f(eta)*diff(diff(f(eta),eta),eta)+((2*n)/((n+1)))*(1-diff(f(eta),eta)^2) = 0, 1/(Pr) *diff(diff(theta(eta),eta),eta)+f(eta)*diff(theta(eta),eta)-((2*p)/((n+1)))diff(f(eta),eta)*theta(eta) = 0, f(0) = 0, D(f)(0) = 1+lambda*'@@'(D,2)(f)(0), D(f)(10) = 1, theta(0)=0, theta(0)=1+sigma*D(theta(0)),theta(10)=1], numeric, method = bvp);  plots[odeplot](sol1, [eta, `@@`(D,2)(f)(eta)], color = red,axes=boxed);

system3d := a[1](a[1])+a[2]*a[4]+a[3]*a[7]-a[1](a[1])-a[2]*a[10]-a[3]*a[19], a[1]*a[2]-a[1]*a[2]+a[2]*a[5]-a[2]*a[11]+a[3]*a[8]-a[3]*a[20], a[1]*a[3]-a[1]*a[3]+a[2]*a[6]-a[2]*a[12]+a[3]*a[9]-a[3]*a[21], a[1]*a[4]-a[1]*a[4]-a[2]*a[13]-a[3]*a[22]+a[4]*a[5]+a[6]*a[7], a[2]*a[4]+a[5](a[5])+a[6]*a[8]-a[1]*a[5]-a[2]*a[14]-a[3]*a[23], a[3]*a[4]+a[5]*a[6]+a[6]*a[9]-a[1]*a[6]-a[2]*a[15]-a[3]*a[24], a[1]*a[7]+a[4]*a[8]+a[7]*a[9] = a[1]*a[7]+a[2]*a[16]+a[3]*a[25], a[2]*a[7]+a[5]*a[8]+a[8]*a[9] = a[1]*a[8]+a[2]*a[17]+a[3]*a[26], a[3]*a[7]+a[6]*a[8]+a[9](a[9]) = a[1]*a[9]+a[2]*a[18]+a[3]*a[27];
print(`output redirected...`); # input placeholder
a[2] a[4] - a[2] a[10] + a[3] a[7] - a[3] a[19],

a[2] a[5] - a[2] a[11] + a[3] a[8] - a[3] a[20],

a[2] a[6] - a[2] a[12] + a[3] a[9] - a[3] a[21],

-a[2] a[13] - a[3] a[22] + a[4] a[5] + a[6] a[7], a[2] a[4]

+ a[5](a[5]) + a[6] a[8] - a[1] a[5] - a[2] a[14] - a[3] a[23],
-a[1] a[6] - a[2] a[15] + a[3] a[4] - a[3] a[24] + a[5] a[6]

+ a[6] a[9], a[1] a[7] + a[4] a[8] + a[7] a[9] = a[1] a[7]

+ a[2] a[16] + a[3] a[25], a[2] a[7] + a[5] a[8] + a[8] a[9] =

a[1] a[8] + a[2] a[17] + a[3] a[26], a[3] a[7] + a[6] a[8]

+ a[9](a[9]) = a[1] a[9] + a[2] a[18] + a[3] a[27]

solve({system3d}, {a[1]*a[2], a[1]*a[3], a[1]*a[4], a[1]*a[5], a[1]*a[6], a[1]*a[7], a[1]*a[8], a[1]*a[9], a[2]*a[4], a[2]*a[5], a[2]*a[6], a[2]*a[7], a[2]*a[10], a[2]*a[11], a[2]*a[12], a[2]*a[13], a[2]*a[14], a[2]*a[15], a[2]*a[16], a[2]*a[17], a[2]*a[18], a[3]*a[4], a[3]*a[7], a[3]*a[8], a[3]*a[9], a[3]*a[19], a[3]*a[20], a[3]*a[21], a[3]*a[22], a[3]*a[23], a[3]*a[24], a[3]*a[25], a[3]*a[26], a[3]*a[27], a[4]*a[5], a[4]*a[8], a[5]*a[6], a[5]*a[8], a[6]*a[7], a[6]*a[8], a[6]*a[9], a[7]*a[9], a[8]*a[9], a[1](a[1]), a[5](a[5]), a[9](a[9])});
%;
Warning, solving for expressions other than names or functions is not recommended.
{a[1] a[2] = a[1] a[2], a[1] a[3] = a[1] a[3],

a[1] a[4] = a[1] a[4], a[1] a[5] = a[2] a[10] - a[3] a[7]

+ a[3] a[19] + a[5](a[5]) + a[6] a[8] - a[2] a[14]

- a[3] a[23], a[1] a[6] = -a[2] a[15] + a[3] a[4] - a[3] a[24]

+ a[5] a[6] + a[6] a[9], a[1] a[7] = a[1] a[7], a[1] a[8] = a[

2] a[7] - a[2] a[17] - a[3] a[26] + a[5] a[8] + a[8] a[9], a[1]

a[9] = a[3] a[7] + a[6] a[8] + a[9](a[9]) - a[2] a[18]

- a[3] a[27], a[2] a[4] = a[2] a[10] - a[3] a[7] + a[3] a[19],

a[2] a[5] = a[2] a[11] - a[3] a[8] + a[3] a[20],

a[2] a[6] = a[2] a[12] - a[3] a[9] + a[3] a[21],

a[2] a[7] = a[2] a[7], a[2] a[10] = a[2] a[10],

a[2] a[11] = a[2] a[11], a[2] a[12] = a[2] a[12],

a[2] a[13] = -a[3] a[22] + a[4] a[5] + a[6] a[7],

a[2] a[14] = a[2] a[14], a[2] a[15] = a[2] a[15],

a[2] a[16] = -a[3] a[25] + a[4] a[8] + a[7] a[9],

a[2] a[17] = a[2] a[17], a[2] a[18] = a[2] a[18],

a[3] a[4] = a[3] a[4], a[3] a[7] = a[3] a[7],

a[3] a[8] = a[3] a[8], a[3] a[9] = a[3] a[9],

a[3] a[19] = a[3] a[19], a[3] a[20] = a[3] a[20],

a[3] a[21] = a[3] a[21], a[3] a[22] = a[3] a[22],

a[3] a[23] = a[3] a[23], a[3] a[24] = a[3] a[24],

a[3] a[25] = a[3] a[25], a[3] a[26] = a[3] a[26],

a[3] a[27] = a[3] a[27], a[4] a[5] = a[4] a[5],

a[4] a[8] = a[4] a[8], a[5] a[6] = a[5] a[6],

a[5] a[8] = a[5] a[8], a[6] a[7] = a[6] a[7],

a[6] a[8] = a[6] a[8], a[6] a[9] = a[6] a[9],

a[7] a[9] = a[7] a[9], a[8] a[9] = a[8] a[9],

a[1](a[1]) = a[1](a[1]), a[5](a[5]) = a[5](a[5]),

a[9](a[9]) = a[9](a[9])}

 

 

 

the program runs however the warning message pops ...what can i do to eliminate the problem??? 

yep the errors recieved using some packages are very very specific for maple, for example, the one i got today using the ODE package was profoundly helpful:

 

Error, (in ODEtools/info) unable to handle derivatives as {diff(1/(ln(X)-Psi(1-f(X))-Psi(f(X))), [`$`(X, n-k[1]-k[2])]), diff(1/f(X), [`$`(X, n-k[1]-k[2])]), diff(Psi(1-f(X)), [`$`(X, k[2])]), diff(Psi(f(X)), [`$`(X, k[2])]), diff(f(X), [`$`(X, k[1])])} while solving w.r.t f(X)

1 2 3 4 5 6 7 Page 1 of 8