Maple 12 Questions and Posts

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

I would like to convert a symbolic expression to text commands.  I recently used the expression palette to create a series summation; however, I was confused whether the sigma represented Sum vs sum.  I attempted to convert to string, but MAPLE attempts to evaluate the symbolic series prior to outputting the text commands.  Unfortunately, the evaluation of the series is computationally expensive & MAPLE will run out of memory.  I do not need MAPLE to evaluate the series.  How can it simply spell out the text commands that represent the symbolic form without resorting to evaluating the expression?


 

restart; T := M*tau; w := N*tau; M := Kappa*N; Ck := -2*(T*(4*tau^2*k^2*Pi^2*(4*tau-w)-w*T^2)*exp(-(1/2)*w/tau)*sin(w*Pi*k/T)+2*Pi*k*tau*(4*tau^2*k^2*Pi^2*(2*tau-w)-T^2*(2*tau+w))*exp(-(1/2)*w/tau)*cos(w*Pi*k/T)+4*Pi*k*tau^2*(T^2-(2*Pi*k*tau)^2))/(T^2+(2*Pi*k*tau)^2)^2

-2*(Kappa*N*tau*(4*tau^2*k^2*Pi^2*(4*tau-N*tau)-N^3*tau^3*Kappa^2)*exp(-(1/2)*N)*sin(Pi*k/Kappa)+2*Pi*k*tau*(4*tau^2*k^2*Pi^2*(2*tau-N*tau)-Kappa^2*N^2*tau^2*(2*tau+N*tau))*exp(-(1/2)*N)*cos(Pi*k/Kappa)+4*Pi*k*tau^2*(Kappa^2*N^2*tau^2-4*Pi^2*k^2*tau^2))/(Kappa^2*N^2*tau^2+4*Pi^2*k^2*tau^2)^2

(1)

sum(Ck*sin(2*Pi*k*x/T), k = 1 .. m)

``

``


 

Download convert_to_text_command.mw

I believe I am having memory issues which is causing the MAPLE kernal to terminate.  If I assign m a value then it seems to work, but I would like to leave m unassigned so that S1 can later be evaluated for any arbitrary m.  Is there a way around this?


 

T := M*tau;

`assuming`([simplify(expand(combine(S1)))], [m::integer])

``


 

Download MAPLE_crashing.mw

Below is my attempt to distinguish between add vs sum commands.  In principle, the sum command is symbolic.  I attempt the comparison in general, but get an error for the add command.  This error appears to occur if I do not assign numeric values to the general variables in the function.  I would like to execute the comparison symbolically.  Can this be done or does add only execute numerical evaluations?

Download sum_vs_add.mw

sum_vs_add.mw

Below I successfully employed the is command to compare Q1 & Q2.  However, attempting to compare T1 & T2 which is essentially Q1 & Q2 but defined as a functions dependent on m does not work so well.  Can I do this comparison?  If so what is the proper syntax to do this?


 

Ck1 := sin(Pi*k)/(Pi*k);

a[0]+Sum(-(-1+cos(Pi*k))*sin(2*Pi*k*t/T)/(Pi*k), k = 1 .. m)

(1)

Q1 := 2*sin(alpha)*(diff(S11, t)); -1; Q2 := sum(2*sin(alpha)*(2*Ck2*Pi*k*cos(2*Pi*k*t/T)/T), k = 1 .. m); -1; is(Q1 = Q2), is(expand(Q1 = Q2)), is(combine(Q1 = Q2)), is(eval(Q1 = Q2)), is(value(Q1 = Q2)), simplify(Q1-Q2)

true, true, true, true, true, 0

(2)

T1 := proc (m) options operator, arrow; Q1 end proc; 1; T2 := proc (m) options operator, arrow; Q2 end proc; 1; is(T1 = T2), is(expand(T1 = T2)), is(combine(T1 = T2)), is(eval(T1 = T2)), is(value(T1 = T2)), simplify(T1-T2)

false, false, false, false, false, T1-T2

(3)

``


 

Download is_command.mw

In MAPLE 12 there is an option in the dropdown menu for the conversions command to convert a complex exponential expression into the cartesian form of a + bi.  However, when I review the HELP menu for the convert command I do not see this option.  Below is an example.  How do I execute the conversion via command line option as opposed to the GUI option?

convert_complex_exponential.mw

Hi,

I am writing a simple program on Maple with the command :

som:=0;

for a from 3000 to 5000 by 100 do

for b from 100 to 1000 by 100 do

for c from 3000 to 3000 by 100 do

for d from 1000 to 1000 by 100 do

for e from 1000 to 10000 by 1000 do

for f from 200 to 2000 by 100 do

for p from 1 to 10 by 1 do

tot:=0;

 

C2:=c*d-N^2*(f^2-b*d);

C3:=a*d-e*f;

C4:=c*e-N^2*(a*f-e*b);

 

if (C2>0 and C3>0 and C4>0)

then

print(a,b,c,d,e,f,p);

som:=som+1;

fi;

od;od;od;od;od;od;od;

som;

 

That gives me the error messsage: Error, numeric exception: division by zero

Is there a simple way to say to the program to continue to execute even it falls at some point to « bad » parameter constellations with division by zero ?

Thank you for your help !

Best regards,

Basak

Dear All,

I am having problem in plotting two function(which themselves are functions of elliptical integrals of first and third kind) together.

If I plot them separately, it has no issues but while combining it plots just one.

I am attaching the maple worksheet here, I have to plot alpha and beta together with 'z' as independent variable.

Please reply asap.
 

restart

a := .5:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

b__sc := -a+2*s*sqrt(3*(3-x))*cos((1/3)*arccos(-s*sqrt(3*a/(3-x)))):

d__sc := -a+2*t*sqrt(3*(3-x))*cos((1/3)*arccos(-t*sqrt(3*a/(3-x)))):

--------------------------------------------------------------------------------------------------------------------

b := proc (z) options operator, arrow; s*b__sc/(1-z) end proc:

d := proc (z) options operator, arrow; t*b__sca/(1-z) end proc:

--------------------------------------------------------------------------------------------------------------------

w__s := proc (z) options operator, arrow; a/b(z) end proc:

v__s := proc (z) options operator, arrow; a/d(z) end proc:

--------------------------------------------------------------------------------------------------------------------

h__sc := proc (z) options operator, arrow; (b(z)+a)/(b(z)-a) end proc:

j__sc := proc (z) options operator, arrow; (d(z)+a)/(d(z)-a) end proc:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

r := proc (z) options operator, arrow; (1/3)*x+2*sqrt(b(z)^2-a^2-(1/3)*x^2)*cos((1/3)*arccos(-(3/2)*sqrt(3)*(2*(b(z)-a)^2-(1/3)*x*(-a^2+b(z)^2)-(2/27)*x^3)/(b(z)^2-a^2-(1/3)*x^2)^(3/2)))/sqrt(3) end proc:

u := proc (z) options operator, arrow; (1/3)*x+2*sqrt(d(z)^2-a^2+(1/3)*x^2)*cos((1/3)*arccos(-(3/2)*sqrt(3)*(2*(d(z)-a)^2-(1/3)*x*(-a^2+d(z)^2)-(2/27)*x^3)/(d(z)^2-a^2+(1/3)*x^2)^(3/2)))/sqrt(3) end proc:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

H := proc (z) options operator, arrow; 1/r(z) end proc:

J := proc (z) options operator, arrow; 1/u(z) end proc:

---------------------------------------------------------------------------------------------------------------------------------------------------------

M := proc (z) options operator, arrow; ((h__sc(z)-2*H(z))*(6*H(z)+h__sc(z))+8*x^2/(b(z)^2*(1-w__s(z))^2))^(1/2) end proc:

P := proc (z) options operator, arrow; ((j__sc(z)-2*J(z))*(6*J(z)+j__sc(z))+8*x^2/(d(z)^2*(1-v__s(z))^2))^(1/2) end proc:

---------------------------------------------------------------------------------------------------------------------------------------------------------

n__1 := proc (z) options operator, arrow; evalf((1-6*H(z)/h__sc(z)+M(z)/h__sc(z))/(1-2*H(z)/h__sc(z)-(4+2*x)/(h__sc(z)*(a^2+2*x))+M(z)/h__sc(z)+sqrt((2+x)^2-4*a^2-8*x)/(h__sc(z)*(a^2+2*x)))) end proc:

n__3 := proc (z) options operator, arrow; evalf((1-6*J(z)/j__sc(z)+P(z)/j__sc(z))/(1-2*J(z)/j__sc(z)-(4+2*x)/(j__sc(z)*(a^2+2*x))+P(z)/j__sc(z)+sqrt((2+x)^2-4*a^2-8*x)/(j__sc(z)*(a^2+2*x)))) end proc:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

n__2 := proc (z) options operator, arrow; evalf((1-6*H(z)/h__sc(z)+M(z)/h__sc(z))/(1-2*H(z)/h__sc(z)-(4+2*x)/(h__sc(z)*(a^2+2*x))+M(z)/h__sc(z)-sqrt((2+x)^2-4*a^2-8*x)/(h__sc(z)*(a^2+2*x)))) end proc:

n__4 := proc (z) options operator, arrow; evalf((1-6*J(z)/j__sc(z)+P(z)/j__sc(z))/(1-2*J(z)/j__sc(z)-(4+2*x)/(j__sc(z)*(a^2+2*x))+P(z)/j__sc(z)-sqrt((2+x)^2-4*a^2-8*x)/(j__sc(z)*(a^2+2*x)))) end proc:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

k := proc (z) options operator, arrow; evalf((1/2)*2^(1/2)*(h__sc(z)/M(z))^(1/2)*(M(z)/h__sc(z)+6*H(z)/h__sc(z)-1)^(1/2)) end proc:

l := proc (z) options operator, arrow; evalf((1/2)*2^(1/2)*(j__sc(z)/P(z))^(1/2)*(P(z)/j__sc(z)+6*J(z)/j__sc(z)-1)^(1/2)) end proc:

----------------------------------------------------------------------------------------------------------------------------------------------------------------

psi := proc (z) options operator, arrow; evalf(arcsin((1-2*H(z)/h__sc(z)-M(z)/h__sc(z))/(1-6*H(z)/h__sc(z)-M(z)/h__sc(z)))) end proc:

phi := proc (z) options operator, arrow; evalf(arcsin((1-2*J(z)/j__sc(z)-P(z)/j__sc(z))/(1-6*J(z)/j__sc(z)-P(z)/j__sc(z)))) end proc:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Omega__1 := proc (z) options operator, arrow; evalf((4*(1-w__s(z))*(2+x+sqrt((2+x)^2-4*a^2-8*x))-4*a^2-8*x)/(a*((2+x)^2-4*a^2-8*x)^(1/2)*((4+2*x)/(a^2+2*x)+2*H(z)-h__sc(z)+M(z)+sqrt((2+x)^2-4*a^2-8*x)/(a^2+2*x)))) end proc:

Omega__3 := proc (z) options operator, arrow; evalf((4*(1-v__s(z))*(2+x+sqrt((2+x)^2-4*a^2-8*x))-4*a^2-8*x)/(a*((2+x)^2-4*a^2-8*x)^(1/2)*((4+2*x)/(a^2+2*x)+2*J(z)-j__sc(z)+P(z)+sqrt((2+x)^2-4*a^2-8*x)/(a^2+2*x)))) end proc:

----------------------------------------------------------------------------------------------------------------------------------------

Omega__2 := proc (z) options operator, arrow; evalf((4*(1-w__s(z))*(2+x+sqrt((2+x)^2-4*a^2-8*x))+8*x+4*a^2)/(a*((2+x)^2-4*a^2-8*x)^(1/2)*((4+2*x)/(a^2+2*x)+2*H(z)-h__sc(z)+M(z)-sqrt((2+x)^2-4*a^2-8*x)/(a^2+2*x)))) end proc:

Omega__4 := proc (z) options operator, arrow; evalf((4*(1-v__s(z))*(2+x+sqrt((2+x)^2-4*a^2-8*x))+8*x+4*a^2)/(a*((2+x)^2-4*a^2-8*x)^(1/2)*((4+2*x)/(a^2+2*x)+2*J(z)-j__sc(z)+P(z)-sqrt((2+x)^2-4*a^2-8*x)/(a^2+2*x)))) end proc:

---------------------------------------------------------------------------------------------------------------------------------------------

alpha := proc (z) options operator, arrow; evalf(-Pi+4*(Omega__1(z)*(EllipticPi(n__1(z), k(z))-EllipticPi(psi(z), n__1(z), k(z)))+Omega__2(z)*(EllipticPi(n__2(z), k(z))-EllipticPi(psi(z), n__2(z), k(z))))/((1-w__s(z))*(M(z)*h__sc(z))^(1/4))) end proc:

beta := proc (z) options operator, arrow; evalf(-Pi+4*(Omega__3(z)*(EllipticPi(n__3(z), l(z))-EllipticPi(phi(z), n__3(z), l(z)))+Omega__4(z)*(EllipticPi(n__4(z), l(z))-EllipticPi(phi(z), n__4(z), l(z))))/((1-v__s(z))*(P(z)*j__sc(z))^(1/4))) end proc:

plot([alpha, beta], 0 .. 1);

Warning, unable to evaluate 1 of the 2 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

``


 

Download deflection-angle-comd.mw

Below is a link to my worksheet that evaluates 6 expressions that are presumably equivalent.  However, there seems to be a region for 7<n<100 where the results diverge.  All other values of n yield identical results.  I am at a TOTAL loss as to what is happening.  I hope that someone here might shed some light on this quirk.

divergent_behavior.mw

CodeTools:-Usage lists information on CPU time & memory used in later versions of MAPLE.  I do not see Usage as an option for MAPLE 12.  Is there a comparable command & can you provide an example so that I have the proper syntax?

Am I applying improper syntax for the is command?  Out of the 5 attempts to equate X with the time derivative of S11 only the combine command yields the expected result.  If only combine works then why do the others not work?
 

Ck1 := sin(Pi*k)/(Pi*k); 1; Ck2 := (1-cos(Pi*k))/(Pi*k); 1; S11 := a[0]+int(sum(2*Ck2*Pi*k*cos(2*Pi*k*x/T)/T, k = 1 .. m), x = 0 .. t); -1; Q1 := 2*sin(alpha)*(diff(S11, t)); -1; Q3 := sum(2*Ck2*Pi*k*(sin(alpha+2*Pi*k*t/T)+sin(alpha-2*Pi*k*t/T))/T, k = 1 .. m); -1; is(Q1 = Q3)

true

(1)

sum1 := sum(2*Ck2*Pi*k*cos(2*Pi*k*x/T)/T, k = 1 .. m):

true

(2)

subs(x = t, simplify(expand(combine(2*sin(alpha)*sum1)))) = simplify(expand(combine(Q3)))"(->)"true

NULL

m := 2*n;

-4*sin(Pi*t/T)*sin(Pi*t*n/T)*cos(Pi*t*n/T)*(2*cos(Pi*t*n/T)^2-1)/(T*cos(Pi*t/T)*(-1+cos(Pi*t/T)^2))

(3)

is(`assuming`([X = diff(S11, t)], [n::integer])), is(`assuming`([expand(X = diff(S11, t))], [n::integer])), is(`assuming`([combine(X = diff(S11, t))], [n::integer])), is(`assuming`([eval(X = diff(S11, t))], [n::integer])), is(`assuming`([value(X = diff(S11, t))], [n::integer])), simplify(`assuming`([combine(X-(diff(S11, t)))], [n::integer]))

false, false, true, false, false, 0

(4)

X

-4*sin(Pi*t/T)*sin(Pi*t*n/T)*cos(Pi*t*n/T)*(2*cos(Pi*t*n/T)^2-1)/(T*cos(Pi*t/T)*(-1+cos(Pi*t/T)^2))

(5)

`assuming`([combine(X-(diff(S11, t)))], [n::integer])

0

(6)

`assuming`([X-combine(diff(S11, t))], [n::integer])

-4*sin(Pi*t/T)*sin(Pi*t*n/T)*cos(Pi*t*n/T)*(2*cos(Pi*t*n/T)^2-1)/(T*cos(Pi*t/T)*(-1+cos(Pi*t/T)^2))-(2*cos((-Pi*t+4*Pi*t*n)/T)-2*cos((Pi*t+4*Pi*t*n)/T))/(T*cos(Pi*t/T)-T*cos(3*Pi*t/T))

(7)

"(=)"

0

(8)

``


 

Download syntax_for_is.mw

 

Below is an attempt to evaluate an integral from t to ZERO.  I believe the issue is that sin(x) in the denominator is causing a problem.  However, in actuality sin(nx) is in the numerator so at the lower integral bound approaching ZERO the factor of n remains.  So how can I get MAPLE to evaluate this correctly?
 

int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x = 0 .. t)"(=)"int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x = 0 .. t)"="int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x = 0 .. t)

``


 

Download evaluating_integral.mw

In the link below I attempt to solve 2 trig series which are essentially equivalent as indicated by the numerical output of eq (5).  The series  represented by S13 & S14 has arguments of the trig functions that realizes that only the odd terms for k yield non-zero results.  The case represented S11 & S12 by makes no such presumption; nonetheless, all cases agree within reason numerically.  Now to find min/max values taking the derivative is needed which is simply done by removing the integral as indicated by Q1 through Q6.

Now resolving the roots works OK for Q6 because beta = 2*pi *t/T conveniently collapsed the numerator into factorable expressions.  Resolving the roots for Q3 did not work so well because what I think is that the expression in red has multiple roots so it only spits out t as the solution?  I expressed the angle alpha in terms of beta & probably need to resolve kappa to somehow get the expression in red to collapse into a factored expression, but I am not sure how to execute this.  When I solve for kappa I get ZERO.

Does anyone have suggestions?  Remember I demonstrated that both series are practically idendical numerically; hence, there derivatives should be as well as long as both series are well behaved functions.  So the solutions must be the same as well.

trig_series_solns.mw

with(plots):
xy := MatrixMatrixMultiply(Matrix([[cos(t),sin(t)],[sin(t),cos(t)]]),Matrix([[x],[y]]));
animate3d([t, xy[1][1], xy[2][1]], x = 1 .. 10, y = 1 .. 10, t = -Pi .. Pi,coords=spherical);
animate3d([x, xy[1][1], xy[2][1]], x = 1 .. 10, y = 1 .. 10, t = -Pi .. Pi,coords=spherical);
animate3d([t, xy[1][1], xy[2][1]], x = -10 .. 10, y = -10 .. 10, t = -Pi .. Pi,coords=spherical);
 
would like to see how it rotate a ball
 

See below, why the difference + what is the distinction between the 2?  Notice that they yield different results with the is command.

restart; P := a[0]+sum(4*(int(cos(2*Pi*(2*k-1)*x/T), x = 0 .. t))/T, k = 1 .. n); Q := a[0]+4*(int(sum(cos(2*Pi*(2*k-1)*x/T), k = 1 .. n), x = 0 .. t))/T; is(expand(P = Q)), is(combine(P = Q)); is(value(eval(P = Q, n = 10)))

false

(1)

restart; P := a[0]+Sum(4*(Int(cos(2*Pi*(2*k-1)*x/T), x = 0 .. t))/T, k = 1 .. m); Q := a[0]+Int(Sum(4*cos(2*Pi*(2*k-1)*x/T)/T, k = 1 .. m), x = 0 .. t); is(expand(P = Q)), is(combine(P = Q)); is(value(eval(P = Q, m = 10)))

true

(2)

sum(4*(int(cos(2*Pi*(2*k-1)*x/T), x = 0 .. t))/T, k = 1 .. n)

((1/2)*I)*(-ln(-(1+exp((2*I)*Pi*t/T))/(exp((2*I)*Pi*t/T)-1))+exp((2*I)*Pi*(1+2*n)*t/T)*LerchPhi(exp((4*I)*Pi*t/T), 1, 1/2+n)+ln((1+exp((2*I)*Pi*t/T))/(exp((2*I)*Pi*t/T)-1))-LerchPhi(exp(-(4*I)*Pi*t/T), 1, 1/2+n)*exp(-(2*I)*Pi*(1+2*n)*t/T))/Pi

(3)

a[0]+Sum(4*(Int(cos(2*Pi*(2*k-1)*x/T), x = 0 .. t))/T, k = 1 .. m)

a[0]+Sum(4*(Int(cos(2*Pi*(2*k-1)*x/T), x = 0 .. t))/T, k = 1 .. m)

(4)

``


 

Download sum_versus_Sum.mw

 

Below is the output from test relation that seems contradictory.  All I did was swap the order of operation from summing an integral to taking the integral of the sum.  The summation and integration variables are independent so I would think the statement for S4 would yield a TRUE result.  Also, I got a FALSE return on a well known trig identity.

Am I missing something subtle or even obvious?

equivalence_discrepancy.mw

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