MaplePrimes Questions

Hello,

In a module, i have defined a global variable GeometricData. I would like to use this variable in procedures which are inside the module. How can i define variables in a module which can be used in procedure inside a module ?

In my code below, the variable GeometricData is not seen by the procedures.

 

MonPackageFonctions:=module()
option package;
export GammaNum,psiNum;
global GeometricData;

GeometricData:=r=0.2,l=1;

GammaNum:=proc(xx)
global GeometricData;
Gamma := Pi-arccos((1/2)*(-x(t)^2+l^2-r^2)/(x(t)*r));
evalf(eval(Gamma,[GeometricData,x(t)=xx]));
end proc;

psiNum:=proc(xx)
global GeometricData;
psi :=-arcsin((1/2)*sqrt(-(x(t)^4-2*x(t)^2*l^2-2*x(t)^2*r^2+l^4-2*l^2*r^2+r^4)/(x(t)^2*r^2))*x(t)/l);
evalf(eval(psi,[GeometricData,x(t)=xx]));
end proc;

end module;


Thanks a lot for your help

Hi, I have the following equation defined in Maple:

f:=-4*a*sin(2*x)+4*b*cos(2*x)=-8*sin(2*x)+20*cos(2*x);

And I want to equate the coefficients of the similar terms (sin with sin and cos with cos), in order to do this:

-4a=-8

+4b=20

And then solve for the variables a, b in that 2 new equations.

Any ideas?

Find the set of solutions of each of the linear congruence:

a) x≡3x≡3 (mod 5).

b) 2x≡52x≡5 (mod 9).

Experts.

In view of the worksheet:

VRP_permute.mw

What I need is
a) a better way to display the Tour_Distances (from 1 to M) and
b) a way to select tour elements where each component is <= to a specified distance (say <=H) and the corresponding tour(s) (from Tour2).
 

My question is: Use the laplace transform to solve the system.

dx/dt + d^2y/dt^2 = 5e^(2t)

dx/dt - x - dy/dt + y = 8e^(2t)

x(0) = 2, y(0) = 1, y'(0) = 1

What I've done in Maple:

with(inttrans);
with(DEtools);
eq5 := (diff(x(t), t)+diff(y(t), t$2) = 5*exp(2*t), t, s);

eq5s := laplace(%, t, s);

eq6 := (diff(x(t), t)-x-(diff(y(t), t))+y = 8*exp(2*t), t, s);

eq6s := laplace(%, t, s);

solve({eq5s, eq6s}, {laplace(x(t), t, s), laplace(y(t), t, s)});

subs({x(0) = 2, y(0) = 1, (D(y))(0) = 1}, %);

eq3 := invlaplace(%, s, t);

How do I simplify?  If you plug it into maple I come up with an answer that has x and y on each side.  I guess I'm just wondering how I can set them equal to each other to solve and get rid of the variable x and y.  I know answer is correct as I've also ran it through ODEtest.  Please help.

However you figure out getting rid of the variables I assume will help me also in solving the next problem:

Use the Laplace Transform to solve the system

dx/dt = 7x - y + 6z

dy/dt = -10x + 4y - 12z

dz/dt = -2x + y - z

x(0) = 5, y(0) = 7, z(0) = 2

I have attempted the second problem much like the first.  Thank you for your time.

Hi!

If somebody could help me it would be awesome!

I would like to be able to switch the independent variable onto the vertical axis!

If that is not possible, what i'm trying to do is modelise in a function a set of points, but with multiple values for the same x, but not more than one for the y, so the best option would be to switch the variables, to have x dependant of y. My graphic has to be vertical though, so I can't just switch the points.

Thank you a lot

Charlotte

I'm not sure if this is possible but I have a very accurate fraction, say something like 1,000 digits / 1,000 digits. What I'm wanting to do is effectively turn this into a fraction like 100 digits / 100 digits.

For example (on a much smaller scale) I have 151/11 and would like to turn this into 41/3 From 3 digits/2 digits to 2 digits/1 digits.

How would I do that?

Thanks

Experts,

This may sound like a dumb question, but i'm seeking a procedure to do it better.
 

``

 

with(combinat, setpartition) :
P := [$2..5] :

Tours := setpartition(P);M:=nops(Tours)

[[[5], [2, 3, 4]], [[2], [5], [3, 4]], [[3], [5], [2, 4]], [[4], [5], [2, 3]], [[2], [3], [4], [5]], [[2, 3, 4, 5]], [[2, 5], [3, 4]], [[2], [3, 4, 5]], [[2, 4], [3, 5]], [[3], [2, 4, 5]], [[2, 3], [4, 5]], [[4], [2, 3, 5]], [[3], [4], [2, 5]], [[2], [4], [3, 5]], [[2], [3], [4, 5]]]

 

15

(1)

 

number of elements in each 'group'

seq(nops(Tours[i]),i=1..nops(Tours))

2, 3, 3, 3, 4, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3

(2)

 

i need to add 1 to each 'subgroup' : These are the first two:

[[[1,op(Tours[1,1])],[1,op(Tours[1,2])]],[[1,op(Tours[2,1])],[1,op(Tours[2,2])],[1,op(Tours[2,3])]]]

[[[1, 5], [1, 2, 3, 4]], [[1, 2], [1, 5], [1, 3, 4]]]

(3)

 

I need to add 1 to each 'subgroup' in a more automatic way.

``


 

Download add_1.mw

 

Please sir,

I am trying to solve this problem and is giving me the error code "Error, (in thaw) numeric exception: division by zero
". Anyone with useful informations please.

Thanking you in anticipations for your response. 

restart

h := proc (x) options operator, arrow; 1+x*tan(theta)/delta+phi*sin(2*Pi*x) end proc:

A := M*(1+K):

theta[1] := sqrt((-B+sqrt(-4*A*C+B^2))/(2*A)):

xi := H[a]^2+(1+K)/K[p]:

L := xi[1]*cosh(theta[1]*h(x))+beta*xi[1]*theta[1]*sinh(theta[1]*h(x))*sinh(theta[2]*h(x))-xi[2]*cosh(theta[2]*h(x))-beta*xi[2]*theta[2]*sinh(theta[2]*h(x))*sinh(theta[1]*h(x)):

F := proc (x) options operator, arrow; (2*xi[1]/theta[1]-2*xi[2]/theta[2])*sinh(theta[1]*h(x))*sinh(theta[2]*h(x))-2*L*h(x) end proc:

w := S*(sinh(theta[1]*y)*sinh(theta[2]*h(x))-sinh(theta[2]*y)*sinh(theta[1]*h(x)))/(L*xi):

u := S*(xi[1]*cosh(theta[1]*y)*sinh(theta[2]*h(x))-xi[2]*cosh(theta[2]*y)*sinh(theta[1]*h(x))-L)/(L*xi)-1:

psi := S*(xi[1]*sinh(theta[1]*y)*sinh(theta[2]*h(x))/theta[1]-xi[2]*sinh(theta[2]*y)*sinh(theta[1]*h(x))/theta[2]-L*y)/(L*xi)-y:

q := int(u, y = -h(x) .. h(x)):

"(&PartialD;P)/(&PartialD;x):=((q+2*h(x))*L*xi)/(F(x)):"

Error, recursive assignment

 

"Deltap:=(&int;)[0]^(1)(&PartialD;P)/(&PartialD;x) &DifferentialD;x"


 

Download 123.mw

Dear all;

I have a function  C(S,t)  and I would like to show that this function is the solution of Partial differential equation ( denotes by PDES). I introduce all my function but when I try to simplify my PDES, I can not get zero as result. 

Many thanks for your help to simplify the PDES to get PDES=0. So, that C(S,t) is the solution of my PDEs.

simplification.mw

 

I am trying to construct a random set of angles measured in degrees with pairs that are the equivalent in radians.  for example [0,0],[90,Pi/2],[-30,-Pi/6],etc...  but completely random.

so far I have the following:

restart;
randomize();
a := rand(-90 .. 90);
seq([a(i), convert(a(i)*degrees, radians)], i = 1 .. 4);

the trouble is it appars it is randomizing a both times it is called in the sequence.  I would like to have it randomize for each iteration in the sequence.

thanks in advance.

hi
I want to solve a pde equation:
 

equa1 := diff(u(x,y), x, x)-y(1+x) = 0;

# with codition:

con:=u(0,y) = 0, (D(u[x]))(0,y) = 0;

the anwer must be :    u(x,y)= y(x2/2  + x3/6)
How can i solve that with maple?

Please excuse my bad English
thanks

I am plotting a pair of lists of points using

pointplot(Listap, Listbp, symbol = point, symbolsize = 1, size = [1200, 1200])

 

How could is do this with plot so I can add colours? Along the lines Listap(i)^2+Listbp(i)^2 =R, R is in the range 0..1,then colour =R*256 or any other imaginative way of adding colour.
 

restart

with(plots):

with(plottools):

``

``

NULL

``

z := (m+I*n)/(p+I*q)

(m+I*n)/(p+I*q)

(1)

g := proc (z) options operator, arrow; (z-I)/(z+I) end proc;

proc (z) options operator, arrow; (z-I)/(z+I) end proc

(2)

bz := simplify(evalc(Im(z)));

(-m*q+n*p)/(p^2+q^2)

(3)

a := simplify(evalc(Re(g(z))));

(m^2+n^2-p^2-q^2)/(m^2-2*m*q+n^2+2*n*p+p^2+q^2)

(4)

b := simplify(evalc(Im(g(z))));

(-2*m*p-2*n*q)/(m^2-2*m*q+n^2+2*n*p+p^2+q^2)

(5)

``
"  r:=15;   Lista:=Vector();  Listb:=Vector();  j:=1;  for m from -r to r do   for n from -r to r do   for p  from -r to r do   for q from -r to r do  if p<>0 and q<>0 and m^2-2 m q+n^2+2 n p+p^2+q^2<>0 and bz>=0 then  Lista(j):=a; Listb(j):=b;  j:=j+1;  end if;  end do:  end do;  end do;  end do:  j; :"

435713

(6)

``

``

``

``

``

pointplot(Lista, Listb, symbol = plottools:-point, symbolsize = 1, size = [1200, 1200])

 

NULL

``

``


 

Download 096-Chayley_transform_for_MP_question.mw

Hello,

On a plot, how do I change the size of the probe info text box ? I cannot read the very small text displayed when the probe info is active. My laptop screen size is only 13 inches.

Thank you

So I have the following:

And I want to create an animation similar to something like:

Not necesarily 3D. Just the interative slider part. 

I want to create a slider that adjusts the value of the exponent k1 (from the red curve) from 1 to say, 1000. 

I also want it to show the corresponding value of  G[1] on the application.

I'm sure its pretty simple, it's just that I have no idea where to start.

 

First 984 985 986 987 988 989 990 Last Page 986 of 2428