Maple 16 Questions and Posts Maple 16 Questions and Posts Feed

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

I'm calculating the geodesics to a parametrized system in R3. When trying to solve the geodesic equations for a surface of revolution, I'm getting a strange error. The goal is to write the code for any parametrized surface, not just revolution (hence I didn't use the short cut for surfaces of revolution).

For the code, I find the first fundamental for, then the geodesics, then turn the christoffel symbols into a time-variant array. (Gamma for the position of (u,v) in the uv-plane, and C as the array so I can take derivatives with respect to time.)

The code for creating the Christoffel Symbols and the parametrization of the paraboloid:

restart; with(LinearAlgebra):
V := (u, v) -> <v*cos(u), v*sin(u), v^2+1>;

Christoff := proc (X)
local x1, x2, M, N, i, j, k, s, E, F, G, g, Q, Delta, Prelim, cyclicPrelim;
global Gamma, C; #GAMMA
x1 := (u, v) -> <diff(X[1], u), diff(X[2], u), diff(X[3], u)>;
x2 := (u, v)-> <(diff(X[1], v), diff(X[2], v), diff(X[3], v))>;
E :=  (u, v) -> DotProduct(x1(u, v), x1(u, v), conjugate = false);
F := (u, v) -> DotProduct(x1(u, v), x2(u, v), conjugate = false);
G := (u, v) -> DotProduct(x2(u, v), x2(u, v), conjugate = false);
simplify([E(u, v), F(u, v), G(u, v)]);
M := (u, v) -> <E(u, v), F(u, v); F(u, v), G(u, v)>;
simplify(M(u,v));
printlevel := 3;
Delta := simplify(Determinant(M(u, v)));
N := (1/Delta)*<G(u, v), -F(u, v); -F(u, v), E(u, v)>;
Q[1] := simplify(map(diff, M(u, v), u));
Q[2] := simplify(map(diff, M(u, v), v));
for i to 2 do for j to 2 do for k to 2 do
Prelim[i, j, k] := Q[k][i, j];
simplify(Prelim[i, j, k] ); end do end do end do;
#(OPTIONAL PRINTOUT) print(Prelim);
for i to 2 do for j to 2 do for k to 2 do
cyclicPrelim[i, j, k] := Prelim[i, j, k]+Prelim[j, k, i]-Prelim[k, i, j] ;
end do end do end do;
#(OPTIONAL PRINTOUT)  print(cyclicPrelim);
for i to 2 do for j to 2 do for k to 2 do
Gamma[i, j, k] := simplify((1/2)*add(N[i, s]*cyclicPrelim[j, s, k], s = 1 .. 2));
end do end do end do;
# for k from 1 to 2 do
#print(`GAMMA[i,j,k] =` Matrix([[ `%a` , `%a` ],[ `%a` , `%a` ]])` \n`, Gamma[1,1,k], [Gamma[1,2,k], Gamma[2,1,k], Gamma[2,2,k]);
# end do;
#printf('GAMMA[%a,%a,%a] = %a \n', i,j,k, Gamma[i,j,k]);

print([Gamma[1,1,1], Gamma[1,2,1], Gamma[2,1,1], Gamma[2,2,1], Gamma[1,1,2], Gamma[1,2,2], Gamma[2,1,2], Gamma[2,2,2]]);

for i from 1 to 2 do
for j from 1 to 2 do
for k from 1 to 2 do
C[i,j,k]:= apply(Gamma[i,j,k],t);
end do end do end do;
C:=Array(1..2,1..2,1..2,[ [ [ apply(Gamma[1,1,1],t), apply(Gamma[1,2,1],t) ], [ apply(Gamma[1,1,2],t), apply(Gamma[1,2,2],t) ] ], [ [ apply(Gamma[2,1,1],t), apply(Gamma[2,2,1],t) ],  [ apply(Gamma[2,1,2],t), apply(Gamma[2,2,2],t) ] ] ]);
print(C);

end proc;

 

The differential equation solver:

inits:=[u(0)=1, D(u(t))(0)=1,v(0) = 1, D(v(t))(0)=1];

sys1:= [D[1$2](u(t))+C[1,1,1]*(D(u(t)))^(2)+2*C[1,1,2]*(D(u(t)))*(D(v(t)))+C[1,2,2]*(D(v(t)))^2=0, D[1$2](v(t))+C[2,1,1]*(D(u(t)))^(2)+2*C[2,1,2]*(D(u(t))*D(v(t)))^(2)+C[2,2,2]*(D(v(t)))^2=0];

L:=dsolve({sys1} union {inits});

 

The error message that comes up is:

"Error, (in unknown) invalid input: op expects 1 or 2 arguments, but received 0"

 

 

Any help would be greatly appreciated.

Hy guys,

I'm starting in Maple and I have a problem, my Maple 16 does not calculate a simple trigonometric function.

When I do:

>cos(pi);

The maple return:

cos(π)

 

 

Thanks a lot!

I have Maple 16 for Windows 64-bit. How to get a printable Maple 16 Quick Reference Card? Also, how to save the Maple 16 Quick Reference Card as a separate file? (When I try to copy the Card I get en error message "selection too large").

 

I am having trouble printing out a limit cylce on maple 16.  I have the attached file and if anybody could look at it and perhaps help me out it would be greatly appreciated.  The first limit cycle is supposed to look somewhat like the second one.  I'v tried many different things but nothing seems to be working.  an explenation would also be nice too.  if the file does not open correctly also let me know. thank you very much.  

 Math_4710_Hilbert_16.mw

Hi, 

I want to animate this code 

plots[odeplot](Trajectoire, [[x1(t), y1(t), t], [x2(t), y2(t), t], [x3(t), y3(t), t], [x4(t), y4(t), t], [x5(t), y5(t), t], [x6(t), y6(t), t], [x7(t), y7(t),t], [x8(t), y8(t), t], [x9(t), y9(t), t], [xA(t), yA(t), t]], TempsInitial..TempsFinal, numpoints = 10000,axes=boxed, scaling = constrained);

However, Maple 16 is giving me an error message :

Error, (in plots/animate) the first argument must be a procedure


I don't know how I can do to animate this code.

 

Thanks!

Hello,

sometimes I observe extreme delays when simply entering a variable name like fooBar; right after starting a Maple session. This happens when the current directory contains a file with that name, because Maple automatically loads this file.

For example, if I create an empty file fooBar.m and start a Maple session,

> fooBar;
Error, `./fooBar.m` is an incorrect or outdated .m file

raises an error. More often however, I have some huge Maple files in the working directory and whenever I use (by chance) a variable name in the Maple session that matches a filename, Maple tries to load the corresponding file.

Is there a documentation of this behaviour and a possibility to stop this automatic loading of files?

Thanks,

Erik

Dear All,

 

I would like perform a symbolic integration to the following integrand with Heaviside function:

 

The integral I defined is as follows:

The output I got is

 

Could any one explain me how to avoid the undefined in the output. I tried to define the assumtions to constrain the solution. However, I failed to supress the undefined.

I expect a result of the integration should also be piecewise function.

 

Appreciate you constructive inputs.

 

Thanks!

 

 

Hello,

I have trouble in using the function factors. For example, I expect

factor(Pi*(t^2+1), {I});

to output

-Pi*(-t+I)*(t+I)

but instead the result is

Pi*(t^2+1)

This problem does not appear if Pi gets replaced by a general symbol:

factor(pi*(t^2+1), {I});

produces (as I expect it should)

-pi*(-t+I)*(t+I)

The problem seems to be tied to symbols representing constants, as for example replacing Pi by Catalan also results in no factorization being performed. It further seems to be tied to specifying a splitting field, because

factor(Pi*(t^2-1));

results in

Pi*(t-1)*(t+1)

Is this behaviour intended? Probably the reason is that the polynomial does not have algebraic coefficients (as it includes Pi). Indeed,

factor(Pi*(t^2-1),{});

produces the error message

Error, (in factor) expecting a polynomial over an algebraic number field

But why does this error then not appear for the call factor(Pi*(t^2-1))? If this would assume complex coefficients, it should factor using I. Considering coefficients in an algebraic number field, also the original call factor(Pi*(t^2+1), {I}); should raise an error!?

Thanks,

Erik

I have tried to use Maple to solve ordinary differential equations but i have this error. Could you please help me to fix this problem

> eq1 := diff(v1(t), t) = v2(t);
> eq2 := diff(v2(t), t) = -v1(t)+(3*(v1(t)^2-1))*v2(t);
> init1 := v1(0) = 2;
> init2 := v2(0) = 0;
> with(DEtools);
> DEplot({eq1, eq2}, [v1(t), v2(t)], 0 .. 3*Pi, {[0, 0, 0]}, scene = [v1, v2], stepsize = .1);

Error, (in DEtools/DEplot/direction) division by zero

 

thank you

I've been poking around with convolutions on Maple, and some weird behavior came up---if I let it compute the convolution of a piecewise function, then take the convolution of that, it comes out differently than if I enter a function from scratch as the middle step---file attached (PiecewiseProblem.mw).  I'm not really a Maple pro, so am I'm doing something crazy here?

Thanks!

Dear all;

 

I want to plot the error defined in the last line.   the error is defined by the difference entre step h and step 2h for Heun method.

The code for Heun1 work well ( stepsize 2h),

Heun2 don't working. Please, I need a Help, maybe there is somethong missing.

here the code with maple code, without pciture.

f :=(x,y)-> 1/(1+sin(y));

ode:=diff(y(x),x)=f(x,y);

## Heun Method with stepsize 2*h

Heun1 := proc(f, x0, h)
local x, y, i, N, k;
N := round((1/2)*x0/h);
y := Array(0 .. N);
x := Array(0 .. N);
x[0] := 0;
y[0] := (1/4)*Pi;
for i from 0 to N-1 do
x[i+1] := (i+1)*2*h;
k[1] := f(x[i], y[i]);
k[2] := f(x[i]+h, y[i]+h*k[1]);
y[i+1] := y[i]+(1/2)*h*(k[1]+k[2]);
 end do;
 evalf([seq([x[i], y[i]], i = 0..N)])
 end proc

 

## Heun Method with stepsize h

Heun2 := proc(f, x0, h)
local x, y, i, N, k;
N := round((1/2)*x0/h);
y := Array(0 .. 2*N);
x := Array(0 .. 2*N);
x[0] := 0;
y[0] := (1/4)*Pi;
for i from 0 to 2*N-1 do
x[i+1] := (i+1)*h;
k[1] := f(x[i], y[i]);
k[2] := f(x[i]+h, y[i]+h*k[1]);
y[i+1] := y[i]+(1/2)*h*(k[1]+k[2]);
 end do;
 evalf([seq([x[2*i], y[2*i]], i = 0..N)])
 end proc


 Heun1((x,y)->f(x, y), 1,1e-2);  ## Heun1 work very well


 Heun2((x,y)->f(x, y), 1,1e-2); ## Dont working...

## The error

x0:=1;

epsilon:= (x0,h)->sqrt(1/(( round(x0/(2*h))+1))*add(( Heun1((x,y)->f(x,y),x0,round(x0/(2*h)))[i][2]-Heun2((x,y)->f(x,y),x0,  round(x0/(2*h)))[i][2])^(2),i=1..N+1));

data[Heun] := [seq([h,epsilon(x0,h)], h =1e-2..1)];

loglog(epsilon(1,h),h=1e-2..1);

 

Dear all,

Thank you for your Help.

h: stepsize;

x in [0,x0];

I give all the step of my code, but I think there is a mistake. I wait for your Help.

I would like to compute the error between  Method Huen with step size h and step size 2h using the definition of epsilon given below:

 ## The error written epsilon(x0,h)= sqrt(1/(N+1) * sum_i=0^N  (y_i^{2h}-y_(2i)^h)^2 ), where y_i^(2h) is the approximation of y(i*2*h).

 ## We want : loglog epsilon versus h.

  epsilon:=(x0,h)->sqrt( 1/(N+1)*add( (Heun1(f,x0,i)-Heun2(f,x0,i))^2,i=0..N ) );

  f:=(x,y)=1/(1+cos(y)); 

  ode:=diff(y(x),x)=f(x,y);

ic:=y(0)=1;  h:=x0/(2*N);

## Method Heun with step size 2h

> Heun1 := proc (f, x0,)

local x, y, i, h, k;

y := Array(0 .. N);

x := Array(0 .. N);

h := evalf((1/2)*x0/N);

x[0] := 0;

y[0] := 1;

for i from 0 to N do

x[i+1] := (2*i+2)*h;

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

k[2] := f(x[i]+h, y[i]+h*k[1]);

y[i+1] := y[i]+h*((1/2)*k[1]+(1/2)*k[2]);

end do;

[seq([x[i], y[i]], i = 0 .. N)];

end proc;

### Now Heun with step size h  ( the same h)

> Heun2 := proc (f, x0,)

local x, y, i, h, k;

y := Array(0 .. N);

x := Array(0 .. N);

h := evalf((1/2)*x0/N);

x[0] := 0;

y[0] := 1;

for i from 0 to N do

x[i+1] := (i+1)*h;

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

k[2] := f(x[i]+h, y[i]+h*k[1]);

y[i+1] := y[i]+h*((1/2)*k[1]+(1/2)*k[2]);

end do;

[seq([x[2*i], y[2*i]], i = 0 .. N)];

end proc;

 

 

Thanks you for your help.


                                

                        

 

Hi There,

 

Could you let me know how to tell Maple to use the ln simplification to give -ln(x)+ln(y) = ln(y/x).

 

I tried following command.

simplify(-ln(x)+ln(y), ln)

 

However, it is not able to give the required simplification.

Hi,

I wrote the following code which is properly run

 


restart:

# parametrs

MUR:=(1-phi)^2.5:
RhoUR:=(1-phi+phi*rho[p]/rho[f]):
RhoCPR:=(1-phi+phi*rhocp[p]/rhocp[f]):
BetaUR:=(phi*rho[p]*beta[p]+(1-phi)*rho[f]*beta[f])/(RhoUR*rho[f])/beta[f]:

dqu3:=diff(h(x),x$1)-RhoUR*BetaUR*T(x);
dqu2:=5*diff(T(x),x$2)+k[f]/k[nf]*Pr*RhoCPR*f(x)*diff(T(x),x$1);
dqu1:=5/(MUR)*diff(f(x),x$3)
+ 2*(diff(h(x),x$1)*x-h(x))
+RhoUR*(3*f(x)*diff(f(x),x$2)-diff(f(x),x$1)^2);
rho[f]:=998.2: cp[f]:=4182: k[f]:=0.597:   beta[f]:= 2.066/10000:
rho[p]:=3380: cp[p]:=773: k[p]:=36:   beta[p]:= 8.4/1000000:

k[nf]:=((k[p]+2*k[f])-2*phi*(k[f]-k[p]))/((k[p]+2*k[f])+phi*(k[f]-k[p])):
rhocp[nf]:=rho[p]*cp[p]*phi+rho[f]*cp[f]*(1-phi):
rhocp[p]:=rho[p]*cp[p]:
rhocp[f]:=rho[f]*cp[f]:

phi:=0.00:
binfinitive:=6: Pr:=7: lambda:=0:


with(plots):
pppe:=dsolve( {dqu1=0,dqu2=0,dqu3=0,T(0)=1,T(binfinitive)=0,f(0)=0,D(f)(0)=lambda,D(f)(binfinitive)=0,h(binfinitive)=0}, numeric );
-pppe(0);
print(odeplot(pppe,[x,diff(f(x),x)],0..binfinitive,color=black,numpoints=400));
print(odeplot(pppe,[[x,diff(f(x),x)]],0..binfinitive,color=black,numpoints=400));
print(odeplot(pppe,[[x,T(x)]],0..binfinitive,color=black,numpoints=400));


However, in some range of parameters, I must increase the value of binfinitive (for example binfinitive=50). however, my code is doesnt converge for higher values of 10 (at most). Can anyone change this algorithm in a way that it insensitive to the value of binfinitive?

Many thanks for your attention in advance

 

Amir

I plot a curve with "plot" command, how to export the figure to .emf format file?

1 2 3 4 5 6 7 Last Page 2 of 35