MaplePrimes Questions

 


Dear the specialst in programmation, please I need to put a conditon if in this procedure with this form: Can you correct me this code please. Thank you.


aaa:=proc(x,y,f,N)
local bb,
for i= from 1 to N do

bb[i]:=f(x[i],y);

if bb[i]<=2 then y:=3*x[i] else y::=x[i]^2end if ;

end do:

end proc

 

 

> with(DEtools);
> L := -1.576674; MU := 0; DE13 := {(D(x))(t) = x(t)*(1+4*x(t)*x(t)-y(t)*y(t))+MU*y(t)*(x(t)*x(t)-.43*y(t)*y(t)-L), (D(y))(t) = y(t)*(1+x(t)*x(t)-.5*y(t)*y(t))+MU*x(t)*(x(t)*x(t)-.43*y(t)*y(t)-L)}; DEplot(DE13, [x(t), y(t)], t = 0 .. 20, [[x(0) = 0.1e-1, y(0) = .99], [x(0) = -.1, y(0) = -.9], [x(0) = 1.1, y(0) = 0], [x(0) = 0, y(0) = .2], [x(0) = 0, y(0) = .6], [x(0) = .6, y(0) = 0], [x(0) = .75, y(0) = 1], [x(0) = .1, y(0) = .1], [x(0) = .5, y(0) = 1.0], [x(0) = -.5, y(0) = 1], [x(0) = .5, y(0) = -1], [x(0) = -.5, y(0) = -1], [x(0) = -0.1e-1, y(0) = .99], [x(0) = 0.1e-1, y(0) = -.99], [x(0) = -0.1e-1, y(0) = -.99], [x(0) = .5, y(0) = -1], [x(0) = -.5, y(0) = -1], [x(0) = 0.1e-1, y(0) = .9]], stepsize = 0.1e-1, scene = [x(t), y(t)], title = "phaseplane 3 prime plot", linecolor = black, thickness = 1);
-1.576674
0
/ / 2 2\
{ D(x)(t) = x(t) \1 + 4 x(t) - y(t) /,
\

/ 2 2\\
D(y)(t) = y(t) \1 + x(t) - 0.5 y(t) / }
/
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .93908020e-1, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .26367741, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .23463732, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of 1.7040014, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .62484768, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .62484768, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .62484768, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
cannot evaluate the solution further right of .62484768, probably a singularity

 

what do i need to do so there are no more singularites?

i cant find the error the program is saying i have 

> L := -1.576674; MU := 0; DE13 := {D(y)*t = -x(t)*(1-2*x(t)*x(t))+MU*y(t)*(x(t)*x(t)-3*y(t)*y(t)-L), (D(x))(t) = y(t)*(1-y(t)*y(t))+MU*y(t)*(x(t)*x(t)-3*y(t)*y(t)-L)}; DEplot(DE13, [x(t), y(t)], t = -20 .. 20, [[x(0) = 0.1e-1, y(0) = .99], [x(0) = 0.5e-1, y(0) = .95], [x(0) = .1, y(0) = .9], [x(0) = 0.4e-1, y(0) = .96]], stepsize = 0.1e-2, scene = [x(t), y(t)], title = "phaseplane plot", linecolor = black, thickness = 1, number = 1000);
 
Error, (in DEtools/DEplot/CheckInitial) too few initial conditions: [x(0) = 0.1e-1, y(0) = .99]

it might be hard to read but if someone could help me it would be very appreciated 

int(BesselJ(2, r*k)*BesselJ(1, 1500*k), k = 0 .. infinity);

(of course, calculated numerically) against r=0..40 ?

PS. It is possible in Mathematica 9.0.1.0 .

 

I have a procedure which give an approximate solution for ode.

This our procedure

RKadaptivestepsize := proc (f, a, b, epsilon, N).

It's working ( afther some 3 mistake found by a member in Mapleprime).

Then I would like to compute the error between exact and approximate.

RKadaptivestepsize: compute the approximate solution

analyticsol: analytic solution

 

## here, I compute the error
for N from 2 by 2 to 500 do
dataerror:= N->evalf(abs(RKadaptivestepsize(f,0,1,epsilon,N)[1+N][2]-(eval(analyticsol, x = 1))));
##  sequence of data error
data[error] := [seq([N, dataerror(N)], N = 2 .. 500, 2)]:
if  data[error][k][2]<=epsilon then   
printf("%a  is the number of steps required using 3-step Runge Kutta Method to achieve an  eroor of 1e-6 .", k)
break ;
end if;   
end do;
end do;

But its gives an error.: Error, reserved word `error` unexpected

Have any one an idea.

 

Hello,

I am having trouble using the programmer entry point interface to convert/parfrac. As an example consider x/(I*x-1): While

> convert([x, [I*(x+I), 1]], parfrac, x);                   

         [-I, [(I + x) I, -I]]

correctly computes a partial fraction decomposition, the equivalent input

> convert([x, [I*x-1, 1]], parfrac, x);  

results in the error message (both in Maple 16 and 17)

Error, (in convert/parfrac) denominator factors must be coprime

which does not make any sense to me, since there is only a single denominator factor present (and it is even the same factor as in the previous call, only written differently).

What is the reason for this behaviour and how can I use convert/parfrac in a way that avoids such errors?

Thanks,

Erik

I am trying to numerically evaluate the following integral

 

integral to solve

 

I have currently used the maple commands

 

int(exp(10*(-2*y^2+y^4))*exp(-10*(-2*z^2+z^4)), [z = -infinity .. y, y = -1 .. 0], numeric)

evalf(int(exp(10*(-2*y^2+y^4))*exp(-10*(-2*z^2+z^4)), [z = -infinity .. y, y = -1 .. 0]))

evalf(Int(exp(10*(-2*y^2+y^4))*exp(-10*(-2*z^2+z^4)), [z = -infinity .. y, y = -1 .. 0]))

 

but all of them return the integral unevaluated. Any help?

Hello

I'm doing some calculation reports in maple. These reports are to be submitted to various classification societies - which all have different requirements to the calculations.

I would like to make a report, where the class specific calculations would be append based on a selection of class in the main calculation.

How do I do this?

 

If I was using latex, matlab, APDL or something like that, I would do and *IF Class=class1, *INPUT class.calc, *ENDIF, but how to do this in maple?

Hi

I need a temperature distribution inside a barrier during a heating process.
I will be appreciated for any help.

 

wz

How to animete BC using varying temperature in time?  How to obtain animated solution?

restart

Diffusivity coefficent...

a := 0.1e-5:

Thickness of barrier...

L := .2:

Heating curve:
Time in heating curve (in hours form exmaple)...

Time := seq(i, i = 1 .. 10):

Varying temperature in time [K]....

Temp_in_Time := [433.15, 568.15, 703.15, 838.15, 973.15, 1108.15, 1243.15, 1378.15, 1513.15, 1616.15]:

Initial temperature [K]

Tot := 298:

PDE := diff(T(x, t), t) = a*(diff(T(x, t), x, x)):

--->>>

BC1 := {T(0, t) = Temp_in_Time[2], T(L, t) = Temp_in_Time[2], T(x, 0) = Tot}:

sol := pdsolve(PDE, BC1, numeric, timestep = 50):

sol:-plot(t = 3*3600, thickness = 3, colour = red);

 

``



Download heating.mw

Hi

I use Maple perhaps only one time per year and thus i'm a beginner with the product (even if i use it since 1996). I'm trying to make the following script work in Maple 17:

http://www.maplesoft.com/applications/view.aspx?SID=4268&ref=Feed&L=F

but i fail.... Some help will be appreciate

restart:

Eq1:=1/r*diff(r*diff(w(r),r),r)-(cos(z1))^2*(w(r)+1)-DP;

dsolve({Eq1});

bcs:=D(w)(0)=0,w(r2)=A1;

dsolve({Eq1,bcs},w(r)):

where z1, Dp, r2, A1 are constants.

 

Hi, can I get some help with this?


The question is:

Consider the following IVP for a mass of m = 2 kg attached to a spring with a spring constant k = 9 N/m. The spring mass system is in a medium with damping constant b.

2y" + by' + 9y = 0

y(0) = 0, D(y)(0) = -3 

 

It then asks find three values b1, b2, b3 where b1 is underdamped, b2 is critical, b3 is over. 

I set b1 as 1, b2 as sqt 72, b3 as 9. 

 

Then it asks to find the quasi period. 

I can't get my quasi period right. My answer is 2pi/ sqrt (4.5).

 

Any help?  

Dear all;

Please I need your help to find the error in my code.

I want to solve an ode, with condition on step size.

ode := diff(y(x), x) = 2*x+y(x);
f:=(x,y)->2*x-y;

analyticsol := rhs(dsolve({ode, y(0) = 1}));
RKadaptivestepsize := proc (f, a, b, epsilon, N)
local x, y, n, h,k,z,R,p;
p:=2;
h := evalf(b-a)/N; ## we begin with this setpsize
x[0] := a; y[0] := 1; ## Initialisation
for n from 0 to N-1 do  ##loop
x[n+1] := a+(n+1)*h;  ## noeuds
k[1] := f(x[n], y[n]);
k[2] := f(x[n]+h, y[n]+h*k[1]);
k[3] := f(x[n]+h/2, y[n]+h/4*(k[1]+k[2]));
z[n+1] := z[n]+(h/2)*(k[1]+k[2]);## 2-stage runge Kutta.
y[n+1] := y[n]+(h/6)*(k[1]+k[2]+4*k[3]);
R:=abs(y[n+1]-z[n+1]); ## local erreur
hstar:=sqrt(epsilon/R)
if R=<=epsilon    then
   x[n] := x[n+1]+h;
   y[n]:=y[n+1];
   n:=n+1;

else

h:=hstar;
end if
 end do;
[seq([x[n], y[n]], n = 0 .. N)];
[seq([x[n], z[n]], n = 0 .. N)];
end proc:

epsilon:=1e-8;
RKadaptivestepsize((x,y)->2*x-y,0,1, epsilon,20)

I am trying to display a graph where there is a rotating square. My code is 

   for k to 30 do

RotSquare := Trans(1.5, 1.5).HomRot(k*Pi/15).Trans(-1.5, -1.5).HomSquare;

graph[k] := plot(Transpose(<RotSquare[1], RotSquare[2]>), x = -3..3, y = -3..3):

od:

display(seq(graph[k], k = 1..30), insequence = true);

with HomRot being 

HomRot := theta ->((cos(theta), sin(theta), 0)(-sin(theta), cos(theta), 0) (0 0 1))

However, when I run this code, my output is 

display(PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), PLOT(...), insequence = true)

and I'm not sure what I am doing wrong. Help would be greatly appreciated

Hi.

Please, I need a code in maple for adaptative setp size control for runge Kutta.

Thank you.

First 1446 1447 1448 1449 1450 1451 1452 Last Page 1448 of 2426