Maple 2018 Questions and Posts

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

Hi,

I'm trying to use "Matlab()" command to convert Maple expression into Matlab's expression.

but for some reason it doesn't work.

it works for simple expressions but not this one. It is just a long expression with only some symbols, and the most basic math operations. I don't see why it fails.

It says: "Error, (in Translate) options... not recognized"

I'm attaching the maple code so you can see the error.  

The reason I'm using it is because Matlab could not solve the equation in the file (even numerically). So I wrote the same equation symbolically in Maple so I can copy the symbolic solutions to matlab and use them instead of matlab's 'solve' command.

Hope anyone can help with it.

Here's the code attached:

calc_theta.mw

Good day all.

If I generate a list containing (say) 100 elements or more, and each element is an ordered pair - is it possible to assign a letter to each element? The first 26 elements will have equal A to Z, the next 26 will take A1 to Z1, and so on.

For example if the list is [ [5,3], [2,5], ..., [3,1]], how do I construct it to become [A=[5,3], B=[2,5], ..., V3=[3,1]]?

Please see attached.

Thank's a lot for your time.

MaplePrimes_Label_Lists.mw

how to draw these 3 lines and then project them on the plans Oxy,Oxz,Oyz;
3 given lines a := [3*t-7, -2*t+4, 3*t+4]; b := [m+1, 2*m-9, -m-12];c:={x = -200/29-2*t, y = 114/29+3*t, z = 119/29+4*t}, how to show these lines and the projections on the 3 planes ? Thank you.

A := [1, -2, 3]:u := `<,>`(0, -2, 2):v := `<,>`(5, 8, -3):
PL := proc (A, u, v) local d, Det, AP, t, U, V;
AP := `<,>`(x-A[1], y-A[2], z-A[3]);
Matrix(`<|>`(`<,>`(AP), `<,>`(u), `<,>`(v)));
Det := LinearAlgebra:-Determinant(%); d := igcd(coeff(Det, x), coeff(Det, y), coeff(Det, z), tcoeff(Det));
print(`Une équation cartésienne du plan est :`);
t := Det/d; print([t = 0]);
print('Une*représentation*paramétrique*du*plan*est; -1');
U := convert(u, list); V := convert(v, list);
[x = lambda*U[1]+mu*V[1]+A[1], y = lambda*U[2]+mu*V[2]+A[2], z = lambda*U[3]+mu*V[3]+A[3]] end proc;
PL(A, u, v);

plan3p := proc (A::list, B::list, C::list)
local d, M, N, P, Mat, Det, t, U, V;
M := `<,>`(x-A[1], B[1]-C[1], C[1]-A[1]); N := `<,>`(y-A[2], B[2]-C[2], C[2]-A[2]); P := `<,>`(z-A[3], B[3]-C[3], C[3]-A[3]);
Mat := Matrix([M, N, P]);
Det := LinearAlgebra:-Determinant(%);
d := igcd(coeff(Det, x), coeff(Det, y), coeff(Det, z), tcoeff(Det));
print(`Une équation cartésienne du plan est :`);
t := Det/d; print([t = 0]); print('Une*représentation*paramétrique*du*plan*est; -1');
U := A-B; V := B-C;
[x = lambda*U[1]+mu*V[1]+A[1], y = lambda*U[2]+mu*V[2]+A[2], z = lambda*U[3]+mu*V[3]+A[3]] end proc;
A := [-6, 3, -2]; B := [5, 2, 1]; C := [2, 5, 2];plan3p(A, B, C);
How to know if these procedures are correct or not. Thank you.

We consider a fixed circle (C) tangent to a fixed line Δ at a given point O of this line. 
Circles Γ tangent to circles C in M and to the right Δ in N are studied.
 Show that the MN line passes through a fixed point I. Infer that the circles Γ remain orthogonal to a fixed circle.
My code is :
 restart; with(geometry);with(plots);
_EnvHorizontalName := 'x';_EnvVerticalName := 'y';
dist := proc (M, N) sqrt(Vdot(expand(M-N), expand(M-N))) end proc;
point(oo, 0, 3); p := 6;
point(N, 5, 0);
line(Delta, y = 0, [x, y]);
para := x^2 = 2*p*y;
solve(subs(x = 5, para), y); point(varpi, 5, 25/12);
line(alpha, [oo, varpi]); k := 3/(25/12);
point(M, (0+5*k)/(1+k), (3+25*k*(1/12))/(1+k)); 
circle(C, x^2+(y-3)^2 = 9, [x, y]);cir := implicitplot(x^2+(y-3)^2 = 9, x = -5 .. 5, y = -5 .. 7, color = blue);
Para := implicitplot(para, x = -40 .. 40, y = 0 .. 40, linestyle = 3, color = coral);
homothety(J, N, -k, M); coordinates(J);
circle(C1, (y-25/12)^2+(x-5)^2 = (25/12)^2, [x, y]);line(lNJ, [N, J]);
triangle(T1, [J, oo, M]); triangle(T2, [N, varpi, M]);
C1 := implicitplot((y-25/12)^2+(x-5)^2 = (25/12)^2, x = 2 .. 8, y = 0 .. 5, color = magenta);dr1 := draw([oo, Delta, varpi, N, M, J], printtext = true); dr2 := draw([alpha(color = black), lNJ(color = black), T1(color = green, filled = true), T2(color = green, filled = true)]);
inversion(M, M, C);
inversion(N, M, C);
Fig := proc (xOm)
local cir, c2, C2, C1, c3, C3, k, M, N, J, sol, dr, varpi;
global p, para, Para;
sol := solve(subs(x = xOm, para), y);
cir := (y-sol)^2+(x-xOm)^2 = sol^2; c2 := x^2+(y-3)^2 = 9;
geometry:-point(N, xOm, 0); sol := solve(subs(x = xOm, para), y);
geometry:-point(varpi, xOm, sol); k := 3/sol;
geometry:-point(M, xOm*k/(k+1), (3+k*sol)/(k+1));
geometry:-homothety(J, N, -k, M);
c3 := (x-(1/2)*xOm)^2+(y-3)^2 = (1/4)*dist(N, J)^2;
C1 := plots:-implicitplot(cir, x = -xOm .. 3*xOm, y = 0 .. 3*xOm, color = magenta);
C2 := plots:-implicitplot(c2, x = -xOm .. 2*xOm, y = 0 .. 2*xOm, color = blue);
C3 := plots:-implicitplot(c3, x = -xOm .. 2*xOm, y = 0 .. 2*xOm, color = blue);
dr := geometry:-draw([varpi, M, J]);
plots:-display([Para, C2, C1, C3, dr], view = [-xOm .. 3*xOm, -1 .. 3*xOm], axes = normal, scaling = constrained) end proc;

Fig(8);
display([seq(Fig(4+.8*i), i = 4 .. 15)]);
display({C1, Para, cir, dr1, dr2}, view = [-8 .. 8, -1 .. 8], axes = normal, scaling = constrained, size = [500, 500]);
I don't know what is that orthogonal circle to each tangent circles. Thank you to help me.

.

Hi !

Sorry but there is a bug in the "combine" command when combining double summations.
 Maple 2017,2018 and 2020 all give me a wrong answer. I have an old version of Maple which gives the correct answer.
I have put an example in the attached file.

bugcombine.mw

Best regards
Réjean 

restart;
with(plots); with(LinearAlgebra);
_EnvHorizontalName := 'x';

_EnvVerticalName := 'y';

x1,y1,x2,y2,x3,y3:=0,-3,3,1,5,-2:   
A := [x1, y1]: B := [x2, y2]: C := [x3, y3]:

Barycentre := proc (A, B, t) description "Barycentre de 2 points A(1) et B(t) dans le rapport t";
return [(1-t)*A[1]+t*B[1], (1-t)*A[2]+t*B[2]] end proc;
ellip := proc (r1, r2) local a, b, c, d, e, f, D, E, F, eq1, eq2, eq3, eq4, eq5, eq6, x0, y0, EE, r3, sol, Ff, Tg;
global A, B, C;
r3 := -1/(r2*r1);
D := Barycentre(C, B, 1/(1-r1)); E := Barycentre(A, C, 1/(1-r2)); F := Barycentre(B, A, 1/(1-r3));
Ff := proc (x, y) options operator, arrow; a*x^2+2*b*x*y+c*y^2+2*d*x+2*e*y+f end proc;
Tg := proc (x0, y0, x, y) options operator, arrow; a*x*x0+b*(x*y0+y*x0)+c*y*y0+d*(x+x0)+e*(y+y0)+f end proc;
eq1 := Ff(D[1], D[2]);
eq2 := Ff(E[1], E[2]);
eq3 := Ff(F[1], F[2]);
eq4 := Tg(F[1], F[2], x1, y1);
eq5 := Tg(D[1], D[2], x2, y2);
eq6 := Tg(E[1], E[2], x3, y3);
sol := op(solve([eq1, eq2, eq3, eq4, eq5, eq6], [a, b, c, d, e]));
assign(sol);
EE := subs(f = 1, Ff(x, y) = 0) end proc;

ellip(-1, -7); tri := plot([A, B, C, A], color = blue):
 
po := plot([A, B, C], style = point, symbolsize = 15, symbol = solidcircle, color = red);
tp := textplot([[A[], "A"], [B[], "B"], [C[], "C"]], 'align' = {'above', 'left'});
x := 'x'; y := 'y';
ELL := seq(implicitplot(ellip(-7/11-(1/11)*j, -1/17-3*j*(1/17)), x = 0 .. 5, y = -3 .. 1, color = ColorTools:-Color([rand()/10^12, rand()/10^12, rand()/10^12])), j = 1 .. 17);
display([tri, ELL, po, tp], view = [-.5 .. 5.5, -4 .. 1.5], axes = none, scaling = constrained, size = [500, 500]);
Explore(implicitplot(ellip(r1, r2), x = 0 .. 5, y = -3 .. 1), parameters = [r1 = -2.18 .. -.7, r2 = -3 .. -.23]);
Can you tell me why this last instruction does't work ? Thank you.
 

Hi, I have a problem with tensor calculus. Please guide me.

I have two Tensors B[mu, nu] and A[~mu, ~nu].

Furthermore, I have two mixed tensors as U[~1, mu, nu] and U[~2,mu,nu]

rho, mu, and nu can run from 1 to 2. Hence, A, B, and both Us are 2*2 matrices.

Note that there was only one U, but since it is a mixed tensor, hence I have separated it into two tensors for making it easy.

Now I want to compute the following summation:

U[~rho,mu,nu] U[~alpha,beta,gamma] B[rho,alpha] A[~mu,~beta] A[~nu,~gamma].

Maple must give a number for rho, mu, nu, alpha, beta, and gamma (which can take 1 and 2) and compute "all" possible summations. Since the result will be just "a number", hence I could not use TensorArray.

How can I do it and get a result?

The forms of all tensors are in the attached maple file:
question.mw

Download question.mw

We consider a triangle ABC, its circumscribed circle (O), of radius R, its inscribed circle (I) of centre I. We designate by α, β, γ the points of contact of BC, CA, AB with the circle (I), by A', B', C' the points of meeting other than A, B, C, of AI, BI, CI with the circle (O), by the media of BC, CA, AB.
.Establish that there is a conic (E), focus I, tangent to βγ, γα, αβ.
My code : 

restart;
with(geometry);
with(plots); _local(gamma);
_EnvHorizontalName := x; _EnvVerticalName := y;
alias(coor = coordinates);
point(A, -5, -5); point(B, 7, -1); point(C, 1, 5);
triangle(ABC, [A, B, C]); circumcircle(_O, ABC, 'centername' = OO); incircle(_I, ABC, 'centername' = Io);
line(lBC, [B, C]); sol := solve({Equation(_I), Equation(lBC)}, {x, y}); point(alpha, subs(sol, x), subs(sol, y));
line(lCA, [C, A]); sol := solve({Equation(_I), Equation(lCA)}, {x, y}); point(beta, subs(sol, x), subs(sol, y));
line(lAB, [A, B]); sol := solve({Equation(_I), Equation(lAB)}, {x, y}); point(gamma, subs(sol, x), subs(sol, y));
line(lAO, [A, OO]); intersection(Ap, lAO, lBC);
line(lBO, [B, OO]); intersection(Bp, lBO, lCA);
line(lCO, [C, OO]); intersection(Cp, lCO, lAB);
midpoint(l, B, C); midpoint(m, A, C); midpoint(n, A, B);
triangle(T, [alpha, beta, gamma]);
dr := draw([ABC(color = blue), _O(color = red), _I(color = magenta), lAO(color = black), lBO(color = black), lCO(color = black), T(color = red), alpha, beta, gamma, Ap, Bp, Cp, l, m, n], printtext = true);
display([dr], axes = normal, scaling = constrained, size = [800, 800]);
How to find the Equation of (E); Thank you.

how this integration can be computed and plotted? tnx in advance

 

restart:Digits:=20:

T := 10^(-6);
delta := 10;
m := 1;
alpha:= 75/10;
v := 65;
mu := 8;

1/1000000

 

10

 

1

 

15/2

 

65

 

8

(1)

z := sqrt((omega^2 - 4*m^2)/alpha^2 - v^2/alpha^2*(4 *delta/alpha*tan(theta)^2 - v^4/alpha^4*tan(theta)^4))

(2/135)*(81*omega^2-324-1825200*tan(theta)^2+1930723600*tan(theta)^4)^(1/2)

(2)

a := sec(theta)/sqrt(2)*sqrt((2 *delta)/alpha - v^2/alpha^2*tan(theta)^2 + z)

(1/90)*sec(theta)*2^(1/2)*(5400-152100*tan(theta)^2+30*(81*omega^2-324-1825200*tan(theta)^2+1930723600*tan(theta)^4)^(1/2))^(1/2)

(3)

f1 := 1/(exp(( omega/2 - mu)/T) + 1);
f2 := 1/(exp((- (omega/2) - mu)/T) + 1);

1/(exp(500000*omega-8000000)+1)

 

1/(exp(-500000*omega-8000000)+1)

(4)

A1 := evalf(-(f1 - f2)*abs(omega/(4*a*alpha*cos(theta)^2*(-delta+ a^2 *alpha* cos(theta)^2) + 2*a*v^2*sin(theta)^2 + 1/10000)))

-1.*(1/(exp(500000.*omega-8000000.)+1.)-1./(exp(-500000.*omega-8000000.)+1.))*abs(omega/(.47140452079103168293*sec(theta)*(5400.-152100.*tan(theta)^2+30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*cos(theta)^2*(-10.+0.18518518518518518519e-2*sec(theta)^2*(5400.-152100.*tan(theta)^2+30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))*cos(theta)^2)+132.77894002280725736*sec(theta)*(5400.-152100.*tan(theta)^2+30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*sin(theta)^2+0.10000000000000000000e-3))

(5)

b := sec(theta)/sqrt(2)*sqrt((2*delta)/alpha - v^2/alpha^2*tan(theta)^2 - z)

(1/90)*sec(theta)*2^(1/2)*(5400-152100*tan(theta)^2-30*(81*omega^2-324-1825200*tan(theta)^2+1930723600*tan(theta)^4)^(1/2))^(1/2)

(6)

f3 := 1/(exp(( omega/2 - mu)/T) + 1);
f4 := 1/(exp((- (omega/2) - mu)/T) + 1);

1/(exp(500000*omega-8000000)+1)

 

1/(exp(-500000*omega-8000000)+1)

(7)

A2 := evalf(-(f3 - f2)*abs(omega/(4*b*alpha*cos(theta)^2*(-delta+ b^2 *alpha* cos(theta)^2) + 2*b*v^2*sin(theta)^2 + 1/10000)))

-1.*(1/(exp(500000.*omega-8000000.)+1.)-1./(exp(-500000.*omega-8000000.)+1.))*abs(omega/(.47140452079103168293*sec(theta)*(5400.-152100.*tan(theta)^2-30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*cos(theta)^2*(-10.+0.18518518518518518519e-2*sec(theta)^2*(5400.-152100.*tan(theta)^2-30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))*cos(theta)^2)+132.77894002280725736*sec(theta)*(5400.-152100.*tan(theta)^2-30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*sin(theta)^2+0.10000000000000000000e-3))

(8)

plot(int(A1+A2,theta=0..2*Pi),omega=0..50);

Warning,  computation interrupted

 

 


 

Download code.mw

I would like to show : in a quadrilateral circumscribed to an ellipse, the line passing through the middle of the diagonals passes through the centre of the ellipse.
My code is :

restart; with(geometry): with(plots): `local`(O):
_EnvHorizontalName := x: _EnvVerticalName := y:

alias(coor = coordinates):
ell := x^2/a^2+y^2/b^2 = 1:
point(P1,a*cos(omega), b*sin(omega)):
point(P2,a*cos(omega-(1/2)*Pi), b*sin(omega-(1/2)*Pi)): 
point(P3,a*cos(omega+(8/7)*Pi), b*sin(omega+(8/7)*Pi)):
point(P4,a*cos(omega+5*Pi*(1/2)), b*sin(omega+5*Pi*(1/2))):
a := 5: b := 3: omega := (1/5)*Pi:
Ell := implicitplot(ell, x = -a .. a, y = -b .. b, color = red): 
dr := draw([seq(P || k, k = 1 .. 4)], axes = normal, printtext = true):

for i from 1 to 4 do tgP||i := x*coor(P||i)[1]/a^2+y*coor(P||i)[2]/b^2 = 1 od:
poly := Matrix([coor(P1), coor(P2), coor(P3), coor(P4)]):
Quadri := polygonplot(poly, axes = normal, color = "DarkGreen", transparency = .8):

with(combinat): with(ListTools):
L := [1, 2, 3, 4]:
for i from 1 to 4 do Rotate(L, i)[1] od:
for i to 4 do solve({(tgP || Rotate)(L, i)[1], tgP || i}, {x, y}); point(S || i, subs(%, x), subs(%, y)); coor(S || i) end do;
Error, invalid input: subs received 1, which is not valid for its 1st argument
#otherwise
solve({tgP1, tgP2}, {x, y}): point(S1, subs(%, x), subs(%, y)); coor(S1):
                               S1
solve({tgP2, tgP3}, {x, y}): point(S2, subs(%, x), subs(%, y)); coor(S2):
                               S2
solve({tgP3, tgP4}, {x, y}): point(S3, subs(%, x), subs(%, y)); coor(S3):
                               S3
solve({tgP1, tgP4}, {x, y}): point(S4, subs(%, x), subs(%, y)); coor(S4):
                               S4

poly := Matrix([coor(S1), coor(S2), coor(S3), coor(S4)]):
Quadri2 := polygonplot(poly, axes = normal, color = "DarkGreen", transparency = .9):
#dr2:=draw(seq(S||k,k =1..4), axes = normal, printtext = true):
line(diag13, [S1, S3]): line(diag24, [S2, S4]): midpoint(M1, S1, S3): midpoint(M2, S4, S2): 
line(Lm, [M1, M2]):
dr2 := draw([S1, S2, S3, S4, M1, M2, Lm(color = black), diag13, diag24], axes = normal, printtext = true):
for i from 1 to 4 do
TgP||i := implicitplot(tgP||i, x = -a-5 .. a+5, y = -b-5 .. b+5, color = blue) od:
display([Ell, seq(TgP||i,i=1..4), Quadri, Quadri2,dr,dr2], view = [-a-5 .. a+3, -b-2 .. b+2], 
scaling = constrained, size = [700, 700]); Thank you for your answere.

Hello. Plotting a graph in the polar coordinate system using polar plot (example). Is it possible to make it display 90 degrees instead of Pi/2, 45 degrees instead of Pi/4, and so on. Thanks

hello guys,

I want to plot the phase plane between F and m when:

F := 736*R^4/sqrt((-1380*Pi*R*m(r)^3 + 368*R^4 - 1587*m(r)^2*R^2 + 1280*m(r)^2*a)^2);
R := X^(1/3)/(-l^2 + 4*a) - 3*l^2*m(r)^2/X^(1/3);
X := m(r)*l^2*(sqrt((27*l^2*m(r)^4 - 16*a^2*l^2 + 64*a^3)/(-l^2 + 4*a)) + 4*a)*(-l^2 + 4*a)^2;
 

and

m := (l^2*r^2 + r^4 + a*l^2)/(2*l^2*r)

for positive constant a and l

please guide me,

thanks

How to find the location of the poles of a normal chord in an ellipse ?
Here is my code :

restart; with(geometry); with(plots); `local`(O);
_EnvHorizontalName := x; _EnvVerticalName := y;
corde := a*x/cos(theta)-b*y/sin(theta) = a^2-b^2;
isolate(corde, a/cos(theta));
Error, (in isolate) a*x/cos(theta)-b*y/sin(theta) = a^2-b^2 does not contain a/cos(theta)
eq1 := (a^2-b^2)*X/a^2 = a/cos(theta);
c := solve(eq1, cos(theta));
eq2 := (a^2-b^2)*Y/b^2 = -b/sin(theta);
s := solve(eq2, sin(theta));
lieu := simplify(expand((a^2-b^2)^2*X^2*Y^2*(c^2+s^2 = 1)));
allvalues(eliminate({eq1, eq2}, theta))[1][2];
ell := x^2/a^2+y^2/b^2 = 1;
P := [a*cos(theta), b*sin(theta)];
tgP := x*P[1]/a^2+y*P[2]/b^2 = 1;

sol := solve({corde, ell}, {x, y});
tgP1 := simplify(x*rhs(sol[2][1])/a^2+y*rhs(sol[2][2])/b^2 = 1);

Drawing in a case
a := 5; b := 3; theta := (1/6)*Pi;

line(l1, corde); conic(co, ell);
Pole(P1, l1, co); coordinates(P1);
a := 5; b := 3; theta := (1/6)*Pi;
Ell := implicitplot(ell, x = -a .. a, y = -b .. b, color = red);
Cor := implicitplot(corde, x = -a-1 .. a, y = -b-1 .. b, color = blue);
TgP := implicitplot(tgP, x = 0 .. 10, y = -5 .. 10, color = magenta);
TgP1 := implicitplot(tgP1, x = -5 .. 10, y = -5 .. 10, color = magenta);
lieu := subs(X = x, Y = y, lieu);
subs(x = 125*sqrt(3)*(1/24), y = -27/8, lieu);
Lieu := implicitplot(lieu, x = -a .. a, y = -b .. b, color = green);
dr := draw(P1);
display([Ell, Cor, Lieu, TgP, TgP1, dr], axes = normal, view = [-10 .. 10, -10 .. 10], scaling = constrained);

Why the drawin of the location (lieu) does not appear ? Thank you.

Hi,

I have two coupled algebraic equations (not differential equations; but only simple algebraic equations; call them "equ1" and "equ2") in which there are three parameters: "x", "y", and "z".

I want to use "fsolve" (Numerical solve) for solving them and then plotting. But since there are three parameters and two equations hence one of the parameters must be given. I want to give a range for "z", for example [2..9], and step size, for example "0.5", such that maple first puts "2" in both equations and solve them numerically and get the values of "x" and "y" and then record them, and then set the value "2.5" for "z" and again repeat the above cycle until the value "z=9". Finally plot both "x" and "y" in terms of "z".

How do I write this?

Thanks in advance

2 3 4 5 6 7 8 Last Page 4 of 57