Items tagged with syntax syntax Tagged Items Feed

Every time I try to write a procedure I get stuck.

This time is no different:

restart;

global a:=0.081819221, PI:=3.1415926535897932384626433832795;
Ecce:=proc(lt)
lat:=lt*(PI/180);
b:=((1-a*sin(lat))/(1+a*sin(lat)))^(a/2));
t:=ln((tan(PI/4)+lat/2));
d:=3437.7468*t*b;
return d;
end proc;

I digit the following to get a result
Ecce(45.2112);

and this is what I get (in blue)
Ecce(45.2112)

Every single time. I can never have a procedure that works right away. It's getting on my nerves

People im with error to show a plot, this is a wor for universty about mechanic materials, and i'm with this error... do not show the plot... before, i've a error because the variable x has values, and i've to unassign to have this.. without unassign, has error in domin of the plot... i dont know how to do this ! And ive to send the work today. 

Someone can help me about this?


Value of variables:
functions
plot algoritm...
plot algoritm

Thanks !

Hello, dear experts.
I have a question...
solve the system of differential equations,where one of the initial conditions need to be chosen so thatcondition is metat the end of integration.
The task is not difficult, but I'm having trouble with the syntax.

1.I can't "pull"the desired function from the solution and find its value at a certain point.
I try to do so:
r_ravn:=s->subs(F,r(s));
evalf(r_ravn(s_end));
evalf(r_ravn(0));
but there is no result

2.In this case,instead of"for"it is better to use a while loop, but again the problem arises 1.
Tell me, please,how to implemen my program.

 

restart:
R:=0.3:
theta_min:=Pi/6:
theta_max:=Pi/2:
betta_max:=evalf(Pi/180*80);
p:=2*10^5:

theta0:=s->Pi/3/s_end*s+Pi/6:
r0:=s->R*sin(theta0(s)):
s_end:=evalf(R*(theta_max-theta_min)):

sol1:=solve({sin(betta_max)=c/r0(0)},{c});
const1:=0.1477211630;

betta0:=s->arcsin(const1/r0(s)):
betta:=s->arcsin(r(s)/r0(s)*sin(betta0(s))):
A:=s->cos(betta(s))/cos(betta0(s)):
T1:=s->rT1(s)/r(s):
T2:=s->T1(s)*tan(betta(s))^2:

step:=0.001:
delta:=0.001:
for i from 1 to 3000 do
r_min:=0.3-step:
rT1_n:=p*Pi*r_min^2/2/Pi/sin(theta_min):

sys := diff(rT1(s), s)-A(s)*T2(s)*cos(theta(s)),diff(theta(s), s)-A(s)/T1(s)*(p-T2(s)*sin(theta(s)/r(s))),diff(r(s),s)-A(s)*cos(theta(s)),diff(z(s),s)-A(s)*sin(theta(s));
fcns := {rT1(s),theta(s),r(s), z(s)};
F := dsolve({sys,rT1(0)=rT1_n, theta(0)=theta_min,r(0) = r_min, z(0) = 0}, fcns, numeric,output=listprocedure):
r_ravn:=s->subs(F,r(s)):
if abs(evalf(r_ravn(s_end))-R)=delta then break:
print(r_min):
end if:
end do:

r_ravn:=s->subs(F,r(s));
evalf(r_ravn(s_end));
evalf(r_ravn(0));
plot([r_ravn(s),r(s)],s=0..s_end);

Hello. I have a question. If you can help me, i am pleasure.

Have nice day. :)

 

restart;
soru := proc(n,x)
local top::0;
for x from 2 to n do
top =top+(((x^(2+i))*top)^(1/(n+2-i)));
print(top);
od;
end proc;

 

soru(5,1);

Error, (in soru) illegal use of a formal parameter

Hello, I am newbie in Maple...

I tried to make a simple iteration, and I would like to get complex results for Z2, Z4 and Z5, as they have complex tag in them.

Would anybody to be so kind, to have a look at my file, and tell me, what's the mistake?
zernike_BB.mw

Thank you:

Attila

hi. please help me about modeling population migration. i am writing a sample for drawing plot in maple, however maple has not any error, but working incorrectly. my program is:


> u := am+bm*m0*x*t+cm*n0*y*t;
> v := an+bn*m0*x*t+cn*n0*y*t;
> eq1 := diff*(x*t, t) = 2*A*(sinh(u)-x*t*cosh(u));
> eq2 := diff*(y*t, t) = 2*A*(sinh(v)-y*t*cosh(v));
> init := x*0 = X, y*0 = Y;
> sol := dsolve*({eq1, eq2, init}, {x(t), y(t)}, numeric);
> param :=A=1/(2) ,am=0 , bm=1.2*(e)^(-4) ,cm= 0.5*(e)^(-5) ,;
> m0 = 10000, an = 0, bn = -exp(-4), cn = 1.2*exp(-3), n0 = 1000;
> save u, v, param, " narm.sav";
> init := x*0 = 0, y*0 = 0.1e-1;
> eq1 := subs*(param, eq1);
> eq2 := subs*(param, eq2);
> sol := dsolve*({eq1, eq2, init}, {x(t), y(t)}, numeric);
> with*plots;
> odeplot*(sol, [x*t, y*t], 0 .. 60, numpoints = 300, view = [-1 .. 1, -1 .. 1]);
> odeplot*(sol*d, [t, x*t, y*t], 0 .. 60, numpoints = 300, orientation = [70, 55], colour = black, axes = normal);
> init := x*0 = -1, y*0 = 1;
> sold := dsolve*({eq1, eq2, init}, {x(t), y(t)}, numeric);
> odeplot*(sold, [x*t, y*t], 0 .. 60, numpoints = 300, view = [-1 .. 1, -1 .. 1], color = black);

Here is my code

ma[1] := [-885.880598855072776, [bh = 0., g0h = 0., g1h = 0.825946224722250e-4]]

ma[2] := [-877.957885609114328, [bh = 347.116836805625, g0h = 0., g1h = 0.164861392564e-3]]

ma[3] := [-863.445203144006655, [bh = 0., g0h = 0., g1h = 0.787090377403668e-4]]

avb := 90.5276611129000; avg0 := 0; avg1 := 0.92225359e-4;

for j from 1 to 3 do

assign(ma[j][2]);

A[j] := [(avb-bh)^2, (avg0-g0h)^2, (avg1-g1h)^2] 

end do;

 

Result is that

A[1] := [4763.19965962732, 0., 1.13103562500664*10^(-10)]

Error, invalid left hand side in assignment

 it only shows A[1], but no A[2] and A[3]

Please help!

Hello Everyone,

 

I would like  to write a code to calculate the riemann sum approximation of the curve sin(sqrt(x^2+y^2)+1 

calculate the actual volume using integration

use the ranges x=[-2pi to 2pi]=y, and 20 subdivisions.

also display the curve and the parallelepiped approximations on the same plot.

 my code give me  an error..please someone can advise me which part of my code is not correct..

Thanks very much in advance!

> g := proc (x, y) options operator, arrow; sin(sqrt(x^2+y^2))+1 end proc;

 Z := g(x, y);

 

 X := Array(0 .. n); Y := Array(0 .. n); Z := Array(0 .. n);

 

c := -2*Pi; d := 2*Pi;

a := -2*Pi; b := 2*Pi;

n := 15;

s := 0;

X[0] := a; Y[0] := c; Z := g[X[0], Y[0]]; s := 0;

dX := (b-a)/N;dY := (d-c)/N;

    for i from 0 to N do      for j from o to N do     s:=s+Z[i]*dX*dY     X[i]:=X[i-1]+dX: Y[i]:=Y[i-1]+dY: Z[i]:=g([Xi],[Yi])  end do;

This the error message i am getting (Error, unterminated loop)

 

 

 

 

 

 

 

 

When I take the derivative of abs(x), I use the chain rule and get this

When I ask Maple to differentiate abs(x), I get this:

I read the help file on "signum", and I expected this to work, but it does not.

 

 

How can I represent signum in normal calculus syntax when working the derivative of functions involving abs(x)?

 

 

 

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). 

1 2 3 4 Page 1 of 4