Items tagged with syntax syntax Tagged Items Feed

I have the following construct:
for i from 1 to 10 do
cubeprod:=i^3;
if irem(cubeprod,3)=0  and if(modp(cubeprod,2)<>0 then
cubesum(cubeprod);// I need both if statements to be true in order to invoke cubesum(). I've noticed that using an and between both if statements is incorrect but :

for i from 1 to 10 do
cubeprod:=i^3;
if irem(cubeprod,3)=0 then 
 if modp(cubeprod,2)<>0 then cubesum(cubeprod) fi;
end if;
end do;

gives me an error as well. What is the right syntax to achieve this?

My assignment is to plot 3 graphs when u0=65.70 and 95 and I thought I did my code properly but now I am getting weird errors

 

a0:=80;
a1:=-5;
b1:=-5*(3)^0.5;
w:=Pi/12;
k:=0.2;
u0:=65;

t=0:0.001:100;
c0=u0-a0-(k^2*a1-k*w*b1)/(k^2+w^2);
c1=(k^2*a1-k*w*b1)/(k^2+w^2);
d1=(k*w*a1+k^2*b1)/(k^2+w^2);
u=a0+c0*exp(-k*t)+c1*cos(w*t)+d1*sin(w*t);
plot(t,u,'r');

I am getting an error here that says Error, (in plot) unexpected options: [65., r] and I don't know how to fix this


legend('u(0)=65');


hold on;
u0=70;
c0=u0-a0-(k^2*a1-k*w*b1)/(k^2+w^2);
c1=(k^2*a1-k*w*b1)/(k^2+w^2);
d1=(k*w*a1+k^2*b1)/(k^2+w^2);
u=a0+c0*exp(-k*t)+c1*cos(w*t)+d1*sin(w*t);
plot(t,u,'-');

I am also getting an error with the '-' portion of my plot "Error, invalid uneval"

legend('u(0)=70');


hold on;
u0=95;
c0=u0-a0-(k^2*a1-k*w*b1)/(k^2+w^2);
c1=(k^2*a1-k*w*b1)/(k^2+w^2);
d1=(k*w*a1+k^2*b1)/(k^2+w^2);
u=a0+c0*exp(-k*t)+c1*cos(w*t)+d1*sin(w*t);
plot(t,u,'g');

I am getting an error yet again with my plot and this time it is "Warning, expecting only range variable u in expression t to be plotted but found name t"


legend('u(0)=90');

I have the function:   f(x,y) = 1/(sqrt(2*Pi)) * e-1/2(x^2+y^2)

I need to take the total derivative of this function in maple, but I don't know the syntax.

Hi, I'm new to Maple and was trying to use it to solve 3 equations with 3 unknowns, in terms of another 2 parameters. This is what I put in, and the error that came up:

solve({(1-x)/(1+b) = b*y, (1-y)(1-a)/(-a*b+1) = b*z, (1-z)(1-b)/(-a*b+1) = a*x}, {x, y, z}); 

Error, (in SolveTools:-LinearSolvers:-Algebraic) unable to compute coeff

I want to solve the equations to get x,y,z in terms of a,b but I don't understand the error coming up - have I done something wrong or is it because not all the variables appear in all of the equations? As there are 3 equations and 3 unknowns there is a solution, but I want to check the answer I found on paper with something (the algebra got a bit messy!)

Any help greatly appreciated! :)

I am trying to learn the <> notation to enter matrices and vectors. But I find this page very confusing

http://www.maplesoft.com/support/help/maple/view.aspx?path=examples%2FLA_Syntax_Shortcuts

it says:

but we see clearly the vertical bars are used to separate columns.

Isn't a column the thing that goes from the top to bottom and not from left to right in Maple LinearAlgebra?

 

For my research at my school, I need to plot the Schrodinger equation using my given wave function. I am having issues though as I am receiving an error telling me that I need to submit my argument in standard or parametric form.

 

restart;

schro := {[4*(x^2-1)*(diff(psi(x, y), x, x))/(x^2-y^2)+2*x*(diff(psi(x, y), x))-(y^2-1)*(diff(psi(x, y), y, y))-2*y*(diff(psi(x, y), y))+(-2/(x+y)-2/(x-y)+1)*psi(x, y)] = energy};

psi := proc (x, y) options operator, arrow; e^((-1)*.5*[2*x+2*y])+e^((-1)*.5*[2*x-2*y]);

plot3d(schro, x= 1..100, y = -1 ..1);

 

Unfortunately, I am unable to plot my function. I was able to substitute my psi(x,y) function into my schro equation, but I am unable to do much else. I want to plot my function such that my energy is represented in the z-axis as a relationship between x and y which are a specific coordinate system (conical coordintes). 

Greetings,

Maple 15 allows the following syntax

omega := sqrt(w0^2*(1+((z-zf)/z0)^2))

But it does not allow this one 

omega^2 := sqrt(w0^2*(1+((z-zf)/z0)^2))

Why is this so for functions and variables? Is there any way around this, I am really bugged by this issue. The Maple Math told me that the syntax was invalid so I had type the commands directly.

 

Hello, Im trying to do a jocobian

http://www.maplesoft.com/support/help/Maple/view.aspx?path=VectorCalculus/Jacobian

but when I try the example code

jacobian([rcos(t), rsin(t), r^2*t], [r, t])

 

i only get the output as 

 

jacobian([rcos(t), rsin(t), RandomMatrix(4, 4*density = .75, outputoptions = [shape = tringular*lowe])^2*t], [RandomMatrix(4, 4*density = .75, outputoptions = [shape = tringular*lowe]), t])

 

I want the output as a matrix as in the example url.

Thanks

Hi everyone,

I have to create a double wishbone suspesione model that can be edited by different users, only introducing some reference point values (called Hard Points). So I need some tool that, in some way, passes from the entered reference point values to the actual values of the bodyframes link. 

I found an already done model (from this link) that seems to be perfect to me because contains an attached Maple document that does exactly what I need working on the base of symbolic parameters applied to the MapleSim model. Now my problem is that I need to deeply change the model and so having the possibility to change the parameter set and insert for example nex parameters. But when I try to do that some problems come out with the Maple document: the syntax of the nex parameter set is different from the default (in the sense of already built in the model I downloaded) one and there are some syntax errors. Below I'll put a screenshot of the error.

 

under the XData code line, you can also see the syntax of one of the parameters that is very long and complicated: below I'll insert another image from which it can be seen the syntax with the original parameter set.

Now if you another idea for solving the initial problem, that would be great! Instead do you have an idea on how to fix the problem with the downloaded model? In my opinion there is a different MapleSim version problem, in the sense that could be thatn the model I downloaded has been done in another MapleSim version in which the parameter set syntax was different.

i want to solve an equation by fsolve but i cant assign a value as an input for next step!

please help me

s := fsolve(G), x = -1 .. 1     

s := .1449607418, x = -1 .. 1  

 a:=s+1  

Error, invalid input: subs received .1449607418, which is not valid for its 1st argument                  

Hello,

how to write a^tilde , a^check on maple

thank,

Gerard.

Hi everyone

Right now I am working on a command that calculates the molar mass of molecules. Mostly it is working like a charm but in some cases the interpretation of the input goes wrong.
The command converts the input to a string, e.g.:

f:=convert(Ca3(PO4)2, string) = "Ca[3](PO[4])[2]"

f := StringTools:-Remove("[]_*^+-", f) = "Ca3(PO4)2"

 

However, sometimes information such as parentheses is lost (which is understandable considering the fact that maple does not know chemical syntax):

f := convert(NH[3][3]*PO[4], string) = "NH[3][3]*PO[4]"

f := StringTools:-Remove("[]_*^+-", f) = "NH33PO4"

 

In special cases it goes completely nuts (I am aware this is not a real molecule):

f := convert(Al(OH)2(NH3)2, string) = "Al(`#msub(mfenced(mi("OH")),mn("2"))`)(NH[3])[2]"

 

The problem could of course simply be solved by typing the input as a string with no subscripts but is looks much nicer with the correct chemical syntax as input.

Do any of you know a way to translate the input charactor by charactor into a (understandable) string?

 

Thanks in anvance,
Mads 

 



I'm used to Mathcad, and I am very new to Maple. Something I cannot figure out right now is how to define multiple elments of a matrix using a function.


Input Data

Define system dimensions as n:=2;

i:=1..n;

j:=1..n;

lambda:=Matrix(n);

Lambda:=Matrix(n);

upsilon:=vector(n); 

Minor side note: I originaly had upsilon defined using the syntax "Vector[row](ncomp)", but this was giving me an 'exponentiation' operation error, so I changed it to what it is now (basically a list/array, which I guess has different type definitions that no longer cause the error?).

lambda[1,2]:=471.0433;

lambda[2,1]:=883.7530;

upsilon[1]:=58.69;

upsilon[2]:=18.07;

The Problem I'm Having

Now I just want to define Lambda using a function to define all elements (like I would in Mathcad).

Lambda[i,j]:= (upsilon[j]/upsilon[i]) * exp (-lambda[i,j]/2853);

which gives me an extremely long error message:

Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Matrix(2, 2, {(1, 1) = -0.3504976272e-3, (1, 2) = -.16509955895845776, (2, 1) = -.30975332953088164, (2, 2) = -0.3504976272e-3}, datatype = float[8]

As far as I can tell (keep in mind that this is my very first Maple project) that it doesn't like lambda as a matrix? But shouldn't it just evaluate to the element? and why is (2,2) and (1,1) giving values, because it should intialize to zero, so exp(0) = 1 in these cases??

I tried to simplify further by just trying

Lambda[i,j]:=(upsilon[j]/upsilon[i]);

but then it just gives me 1, and when I look into Lambda all the elements are now 1 when only the diagnol elements should be 1 (the rest some fractional amount)??

I am at a complete loss. I thought about doing something like For i = 1 to n etc. but then it just looks like coding, which defeats the purpose of trying to make a calculation sheet documenting the procedure...

Any help and/or insights into what I am doing wrong here would be most welcomed :)

P.S. I've just noticed that there is an upload option :/ Wilson_Equation.mw.

 

Here's an example compound inequality I'm working on.

Working it out manually.... 

Compound Inequality
4477.25 <= 4477.25+.25*(t-32450) <= 16042.25;

Distribute the coefficient
4477.25 <= 4477.25+.25*t - 8112.50 <= 16042.25;

Combine like terms
4477.25 <= -3635.25+.25*t <= 16042.25;

Add 3635.25 to all sides
8112.50 <= .25*t <= 19677.50;

Divide all sides by .25
32450 <= t <= 78710;

 

How can I ask Maple to simplify this compound inequality? Obviously this is not the correct syntax, It seems Maple doesn't understand what I want it to do.

4477.25 <= 4477.25 + .25 * (t-32450) <= 16042.25;

                       0.00 <= 0.25 t - 8112.50 and 0.25 t <= 19677.50                (112)

 

Also is there a way to ask Maple to only perform one step? In the above example, is it possible to ask Maple to "Distribute the .25", then show the result, next ask it to combine like terms, etc?

Hello i want to solve the differentiel equation but i have these problem i don't understund  why !?

``

``

restart:with(plots):

mb:=765 : mp:=587 :Ib:=76.3*10^3 :Ip:=7.3*10^3 :l:=0.92 :d:=10:F:=0.042:omega:=0.56 :

eq1:=(mb+mp)*diff(x(t),t$2)+mp*l*cos(alpha(t))*diff(alpha(t),t$2)+mp*[l*[diff(alpha(t),t)]^2*sin(alpha(t))]-F*sin(omega*t)=0;

1352*(diff(diff(x(t), t), t))+540.04*cos(alpha(t))*(diff(diff(alpha(t), t), t))+[540.04*[diff(alpha(t), t)]^2*sin(alpha(t))]-0.42e-1*sin(.56*t) = 0

(1)

eq2:=-mp*l*sin(alpha(t))*diff(alpha(t),t$2)+mp*[l*[diff(alpha(t),t)]^2*cos(alpha(t))]-9.81*(mp+mb)-F*sin(omega*t)=0;

-540.04*sin(alpha(t))*(diff(diff(alpha(t), t), t))+[540.04*[diff(alpha(t), t)]^2*cos(alpha(t))]-13263.12-0.42e-1*sin(.56*t) = 0

(2)

eq3:=mp*[d+l*cos(alpha(t))]*diff(x(t),t$2)+[Ip+mp*l^2+mp*d*l*cos(alpha(t))]*diff(alpha(t),t$2)-mp*sin(alpha(t))*[-l*d*alpha(t)^2]+mp*[l*9.81*sin(alpha(t))]=0;

587*[10+.92*cos(alpha(t))]*(diff(diff(x(t), t), t))+[7796.8368+5400.40*cos(alpha(t))]*(diff(diff(alpha(t), t), t))-587*sin(alpha(t))*[-9.20*alpha(t)^2]+[5297.7924*sin(alpha(t))] = 0

(3)

eq4:=mp*l*cos(alpha(t))*diff(x(t),t$2)+(Ip+mp*l^2)*diff(alpha(t),t$2)-mp*9.81*l*sin(alpha(t))=0;

540.04*cos(alpha(t))*(diff(diff(x(t), t), t))+7796.8368*(diff(diff(alpha(t), t), t))-5297.7924*sin(alpha(t)) = 0

(4)

CI:= x(0)=0,alpha(0)=0,D(x)(0)=0,D(alpha)(0)=0;

x(0) = 0, alpha(0) = 0, (D(x))(0) = 0, (D(alpha))(0) = 0

(5)

sys := eq1, eq2, eq3, eq4:

``

solution:=dsolve([sys,CI],numeric);

Error, (in DEtools/convertsys) unable to convert to an explicit first-order system

 

 

NULL


thanks for your help

Download tangage.mw

1 2 3 4 Page 1 of 4