Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

a:=sin(theta3(t))*(diff(theta3(t), t))^2*cos(theta1(t))*l1*l3*m3+sin(theta3(t))*(diff(theta3(t), t))^2*cos(theta1(t))*l1*l3*mi+sin(theta3(t))*(diff(theta3(t), t))^2*cos(theta1(t))*l1*l3*m4+l1^2*m2*(diff(theta1(t), t, t))-sin(theta3(t))*(diff(theta3(t), t))^2*cos(theta1(t))*l1*lc3*m3+sin(theta4(t))*(diff(theta4(t), t))^2*cos(theta1(t))*l1*l4*mi+sin(theta4(t))*(diff(theta4(t), t))^2*cos(theta1(t))*l1*l4*m4-sin(theta4(t))*(diff(theta4(t), t))^2*cos(theta1(t))*l1*lc4*m4+sin(theta6(t))*(diff(theta6(t), t))^2*cos(theta1(t))*h2*l1*ml+sin(theta6(t))*(diff(theta6(t), t))^2*cos(theta1(t))*h2*l1*m3+l1^2*ml*(diff(theta1(t), t, t))+l1^2*mr*(diff(theta1(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*l2*ml*(diff(theta2(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*l2*mc*(diff(theta2(t), t, t))+sin(theta5(t))*sin(theta1(t))*h2*l1*mi*(diff(theta5(t), t, t))-cos(theta3(t))*cos(theta1(t))*l1*l3*m4*(diff(theta3(t), t, t))+cos(theta5(t))*cos(theta1(t))*h2*l1*mc*(diff(theta5(t), t, t))+sin(theta6(t))*(diff(theta6(t), t))^2*cos(theta1(t))*h2*l1*mi+sin(theta6(t))*(diff(theta6(t), t))^2*cos(theta1(t))*h2*l1*m4-sin(theta5(t))*(diff(theta5(t), t))^2*cos(theta1(t))*h2*l1*mi-sin(theta5(t))*(diff(theta5(t), t))^2*cos(theta1(t))*h2*l1*m4-sin(theta5(t))*(diff(theta5(t), t))^2*cos(theta1(t))*h2*l1*m3-sin(theta5(t))*(diff(theta5(t), t))^2*cos(theta1(t))*h2*l1*mr-sin(theta5(t))*(diff(theta5(t), t))^2*cos(theta1(t))*h2*l1*mc-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*l2*m3-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*lc2*m2-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*l2*mr+sin(theta2(t))*sin(theta1(t))*l1*l2*ml*(diff(theta2(t), t, t))+cos(theta5(t))*cos(theta1(t))*h2*l1*mi*(diff(theta5(t), t, t))+l1^2*m4*(diff(theta1(t), t, t))+sin(theta5(t))*sin(theta1(t))*h2*l1*m3*(diff(theta5(t), t, t))+cos(theta3(t))*cos(theta1(t))*l1*lc3*m3*(diff(theta3(t), t, t))-sin(theta3(t))*sin(theta1(t))*l1*l3*m4*(diff(theta3(t), t, t))-cos(theta6(t))*cos(theta1(t))*h2*l1*m4*(diff(theta6(t), t, t))-sin(theta4(t))*sin(theta1(t))*l1*l4*m4*(diff(theta4(t), t, t))-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*l2*mi-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*l2*mc-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*l2*ml-sin(theta2(t))*(diff(theta2(t), t))^2*cos(theta1(t))*l1*l2*m4-sin(theta7(t))*(diff(theta7(t), t))^2*cos(theta1(t))*h3*l1*mc-cos(theta4(t))*cos(theta1(t))*l1*l4*mi*(diff(theta4(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*l2*mr*(diff(theta2(t), t, t))-cos(theta6(t))*(diff(theta6(t), t))^2*sin(theta1(t))*h2*l1*mi-cos(theta6(t))*(diff(theta6(t), t))^2*sin(theta1(t))*h2*l1*m4+cos(theta5(t))*(diff(theta5(t), t))^2*sin(theta1(t))*h2*l1*m3+cos(theta5(t))*(diff(theta5(t), t))^2*sin(theta1(t))*h2*l1*mi+cos(theta5(t))*(diff(theta5(t), t))^2*sin(theta1(t))*h2*l1*mc+cos(theta5(t))*(diff(theta5(t), t))^2*sin(theta1(t))*h2*l1*mr+cos(q2(t))*sin(theta1(t))*l1*l2*mi*(diff(theta2(t), t))*(diff(theta1(t), t))+cos(q2(t))*sin(theta1(t))*l1*l2*m4*(diff(theta2(t), t))*(diff(theta1(t), t))+cos(q2(t))*sin(theta1(t))*l1*lc2*m2*(diff(theta2(t), t))*(diff(theta1(t), t))+cos(q2(t))*sin(theta1(t))*l1*l2*m3*(diff(theta2(t), t))*(diff(theta1(t), t))+cos(q2(t))*sin(theta1(t))*l1*l2*mc*(diff(theta2(t), t))*(diff(theta1(t), t))+cos(q2(t))*sin(theta1(t))*l1*l2*ml*(diff(theta2(t), t))*(diff(theta1(t), t))+cos(q2(t))*sin(theta1(t))*l1*l2*mr*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*l2*mc*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*l2*m4*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*l2*mr*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*l2*m3*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*l2*mi*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*l2*ml*(diff(theta2(t), t))*(diff(theta1(t), t))-sin(q2(t))*cos(theta1(t))*l1*lc2*m2*(diff(theta2(t), t))*(diff(theta1(t), t))-cos(theta3(t))*(diff(theta3(t), t))^2*sin(theta1(t))*l1*l3*mi+cos(theta3(t))*(diff(theta3(t), t))^2*sin(theta1(t))*l1*lc3*m3-cos(theta4(t))*(diff(theta4(t), t))^2*sin(theta1(t))*l1*l4*m4-cos(theta4(t))*(diff(theta4(t), t))^2*sin(theta1(t))*l1*l4*mi+cos(theta4(t))*(diff(theta4(t), t))^2*sin(theta1(t))*l1*lc4*m4-cos(theta6(t))*(diff(theta6(t), t))^2*sin(theta1(t))*h2*l1*ml-cos(theta6(t))*(diff(theta6(t), t))^2*sin(theta1(t))*h2*l1*m3-cos(theta3(t))*(diff(theta3(t), t))^2*sin(theta1(t))*l1*l3*m4-cos(theta3(t))*(diff(theta3(t), t))^2*sin(theta1(t))*l1*l3*m3+l1^2*mc*(diff(theta1(t), t, t))-cos(theta4(t))*cos(theta1(t))*l1*l4*m4*(diff(theta4(t), t, t))+cos(theta5(t))*cos(theta1(t))*h2*l1*mr*(diff(theta5(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*lc2*m2*(diff(theta2(t), t, t))+cos(theta1(t))*g*l1*mr+cos(theta1(t))*g*l1*m3+cos(theta1(t))*g*l1*m2+cos(theta1(t))*g*l1*m4+cos(theta1(t))*g*l1*ml+cos(theta1(t))*g*l1*mc+m1*g*lc1*cos(theta1(t))+cos(theta1(t))*g*l1*mi+cos(theta5(t))*cos(theta1(t))*h2*l1*m3*(diff(theta5(t), t, t))-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*l2*m4*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*l2*mc+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*l2*mc*(diff(theta2(t), t))+cos(theta7(t))*(diff(theta7(t), t))^2*sin(theta1(t))*h3*l1*mc+l1^2*m3*(diff(theta1(t), t, t))+l1^2*mi*(diff(theta1(t), t, t))+cos(theta5(t))*(diff(theta5(t), t))^2*sin(theta1(t))*h2*l1*m4-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*l2*m3*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*l2*ml+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*l2*ml*(diff(theta2(t), t))-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*lc2*m2*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*l2*mr+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*l2*mr*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*l2*m4+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*l2*m4*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*l2*mi+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*l2*mi*(diff(theta2(t), t))-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*l2*mr*(diff(theta2(t), t))-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*l2*mi*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*l2*m3+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*l2*m3*(diff(theta2(t), t))-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*l2*mc*(diff(theta2(t), t))-cos(theta2(t))*sin(theta1(t))*(diff(theta1(t), t))*l1*l2*ml*(diff(theta2(t), t))+cos(theta2(t))*(diff(theta2(t), t))^2*sin(theta1(t))*l1*lc2*m2+sin(theta2(t))*cos(theta1(t))*(diff(theta1(t), t))*l1*lc2*m2*(diff(theta2(t), t))+sin(theta2(t))*sin(theta1(t))*l1*l2*m3*(diff(theta2(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*l2*m3*(diff(theta2(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*l2*mi*(diff(theta2(t), t, t))+cos(theta5(t))*cos(theta1(t))*h2*l1*m4*(diff(theta5(t), t, t))+sin(theta2(t))*sin(theta1(t))*l1*l2*mr*(diff(theta2(t), t, t))+m1*lc1^2*(diff(theta1(t), t, t))-sin(theta6(t))*sin(theta1(t))*h2*l1*m4*(diff(theta6(t), t, t))+sin(theta5(t))*sin(theta1(t))*h2*l1*mr*(diff(theta5(t), t, t))+sin(theta5(t))*sin(theta1(t))*h2*l1*mc*(diff(theta5(t), t, t))-cos(theta6(t))*cos(theta1(t))*h2*l1*mi*(diff(theta6(t), t, t))-sin(theta6(t))*sin(theta1(t))*h2*l1*mi*(diff(theta6(t), t, t))-cos(theta6(t))*cos(theta1(t))*h2*l1*m3*(diff(theta6(t), t, t))-sin(theta6(t))*sin(theta1(t))*h2*l1*m3*(diff(theta6(t), t, t))+sin(theta2(t))*sin(theta1(t))*l1*lc2*m2*(diff(theta2(t), t, t))+cos(theta2(t))*cos(theta1(t))*l1*l2*m4*(diff(theta2(t), t, t))+sin(theta2(t))*sin(theta1(t))*l1*l2*mc*(diff(theta2(t), t, t))+sin(theta3(t))*sin(theta1(t))*l1*lc3*m3*(diff(theta3(t), t, t))-cos(theta3(t))*cos(theta1(t))*l1*l3*mi*(diff(theta3(t), t, t))-sin(theta3(t))*sin(theta1(t))*l1*l3*mi*(diff(theta3(t), t, t))-cos(theta3(t))*cos(theta1(t))*l1*l3*m3*(diff(theta3(t), t, t))-sin(theta3(t))*sin(theta1(t))*l1*l3*m3*(diff(theta3(t), t, t))+cos(theta7(t))*cos(theta1(t))*h3*l1*mc*(diff(theta7(t), t, t))-cos(theta6(t))*cos(theta1(t))*h2*l1*ml*(diff(theta6(t), t, t))+sin(theta7(t))*sin(theta1(t))*h3*l1*mc*(diff(theta7(t), t, t))-sin(theta6(t))*sin(theta1(t))*h2*l1*ml*(diff(theta6(t), t, t))+sin(theta4(t))*sin(theta1(t))*l1*lc4*m4*(diff(theta4(t), t, t))+cos(theta4(t))*cos(theta1(t))*l1*lc4*m4*(diff(theta4(t), t, t))-sin(theta4(t))*sin(theta1(t))*l1*l4*mi*(diff(theta4(t), t, t))+sin(theta2(t))*sin(theta1(t))*l1*l2*m4*(diff(theta2(t), t, t))+sin(theta2(t))*sin(theta1(t))*l1*l2*mi*(diff(theta2(t), t, t))+sin(theta5(t))*sin(theta1(t))*h2*l1*m4*(diff(theta5(t), t, t))

I want to manipulate polynomials in two non-commuting variables, over the field of rational numbers.  I read some of the help concerning Ore algebras, and also some of the help concerning the Physics package (where there are non-commuting variables), but unfortunately I could not understand much of what I read!  For someone who is not a Maple virtuoso, is there a simple way to work with non-commutative polynomials?  

 
I also tried the “do-it-yourself” approach, i.e., defining a non-commutative multiplication via a neutral operator &*.  This time I had some success, but I ran into problems when I tried to extract the coefficient of a given monomial in a given polynomial.  In the file  NonCommutPolynomials.mw  you can see that the Maple command “coeff” gives me the correct answer only when the degree of the monomial is strictly greater than 1.  I have no idea how to extract the coefficient of x, or of y, or how to get the constant term of the polynomial — and extracting coefficients is something I need to do!
 
Thanks!
 

Hi all,

I wanted to know if there's a tool in Maple for solving (globally) non convex optimization problems?

specifically, I need to solve the following problem:

min||Ax-b||_1 s.t. ||x||_2=1

where A is a given matrix of size nxd

b is a given vector of size nx1

x is an unkown vector of size dx1 that should be a unit vector (hence the contraint ||x||_2=1).

The closest function I found in Maple is LSSolve but this function is intended for convex problems.

I'm able to solve the problem using Yalmip in matlab.

Here's an example code in matlab+yalmip that finds the unit vector x that globally minimizes ||Ax-b||_1.

clear;
close all;
clc;

n = 10;
d = 3;

A = rand(n,d);
b = rand(n,1);
x = sdpvar(d,1);

Objective = norm(A*x-b,1);
cons = x'*x==1;
options = sdpsettings('solver','bmibnb');
sol= optimize(cons,Objective, options);

x_sol = value(x)

 

Is there a way to write a similar code in Maple?

 

Thanks

 

I'm a student and I've recently been introduced to Maple. I've been given the task to create a polynomial in Maple that goes through the following points: 

[2, 2], [12, 6], [37, 42], [49, 21], [73, 49], [91, 2]

Once the polynomial has been created, I would like to know the formula. 

What do I need to do to solve this task?

I'm looking for the specific commands etc.

Thanks.

 

Hello

If 0 occurs in the first element, I want to remove the list containing zero and the associated number.

example

p := [[[0, 5], [3, 10], [1, 20], [0, 50]], [[2, 5], [0, 10], [2, 20], [0, 50]]]

after processing:

[[[3, 10], [1, 20]], [[2, 5], [2, 20]]]

I tried in vain...

select(i -> (subs(p,p[1,i,1])>0), [$1..nops(p)]);
 

 

[[1,2],[5,7]]intersect [[1,2]]

return [1,2]

there is error when run this.

search start from a, b, c, ... for each sequence if input a,b,c,d,e,f,g,h,i,j,k

is there a function like accumulate in haskell in maple instead of using for loop?

would like to search something if found, then return the length of it searched from the starting position

when start from a search a from b to g whether is a,  if find , return the length from c to the found position,

when start from b search b from c to h whether is b,  if find , return the length from c to the found position

....

then save the length into a list

a b c d e f g

   b c d e f g h

      c d e f g h i

         d e f g h i j

            ef g h i j k

 


 

Solving PDEs with initial and boundary conditions:

Sturm-Liouville problem with RootOf eigenvalues

 

Computer algebra systems always failed to compute exact solutions for a linear PDE with initial / boundary conditions when the eigenvalues of the corresponding Sturm-Liouville problem cannot be solved exactly - that is, when they can only be represented at most abstractly, using a RootOf construction.

 

This post illustrates then a new Maple development, to tackle this kind of problem (work in collaboration with Katherina von Bülow), including testing and plotting the resulting exact solution. To reproduce the computation below in Maple 2018.1 you need to install the Maplesoft Physics Updates (version 134 or higher).

 

As an example, consider

pde := diff(u(x, t), t) = k*(diff(u(x, t), x, x)); iv := u(x, 0) = 1-(1/4)*x^3, eval(diff(u(x, t), x), x = 0) = 0, eval(diff(u(x, t), x), x = 1)+u(1, t) = 0

diff(u(x, t), t) = k*(diff(diff(u(x, t), x), x))

 

u(x, 0) = 1-(1/4)*x^3, eval(diff(u(x, t), x), {x = 0}) = 0, eval(diff(u(x, t), x), {x = 1})+u(1, t) = 0

(1)

This problem represents the temperature distribution in a thin rod whose lateral surface is insulated over the interval 0 < x and x < 1, with the left end of the rod insulated and the right end experiencing a convection heat loss, as explained in George A. Articolo's Partial Differential Equations and Boundary Value Problems with Maple, example 3.6.4.

 

The formulation as a Sturm-Liouville problem starts with solving the PDE by separating the variables by product

pdsolve(pde, HINT = `*`)

PDESolStruc(u(x, t) = _F1(x)*_F2(t), [{diff(_F2(t), t) = k*_c[1]*_F2(t), diff(diff(_F1(x), x), x) = _c[1]*_F1(x)}])

(2)

Substituting this separation by product into the last two (out of three) initial/boundary conditions (iv), the original pde and these conditions are transformed into an ODE system with initial conditions

{_F1(1)+(D(_F1))(1) = 0, diff(_F2(t), t) = -k*_c[1]*_F2(t), diff(_F1(x), x, x) = -_c[1]*_F1(x), (D(_F1))(0) = 0}

{_F1(1)+(D(_F1))(1) = 0, diff(_F2(t), t) = -k*_c[1]*_F2(t), diff(diff(_F1(x), x), x) = -_c[1]*_F1(x), (D(_F1))(0) = 0}

(3)

This is a problem in actually three variables, including _c[1], and the solution can be computed using dsolve

dsolve({_F1(1)+(D(_F1))(1) = 0, diff(_F2(t), t) = -k*_c[1]*_F2(t), diff(diff(_F1(x), x), x) = -_c[1]*_F1(x), (D(_F1))(0) = 0}, {_F1, _F2, _c[1]})

{_c[1] = 0, _F1(x) = 0, _F2(t) = _C5}, {_c[1] = _C2, _F1(x) = 0, _F2(t) = _C5/exp(k*_C2*t)}, {_c[1] = RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2, _F1(x) = _C4*cos((RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2)^(1/2)*x), _F2(t) = _C5/exp(k*RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2*t)}

(4)

We are interested in a solution of the form u(x, t) = _F1(x)*_F2(t) and _F1(x)*_F2(t) <> 0, so discard the first two in the above and keep only the third one

solution_to_SL := ({_c[1] = 0, _F1(x) = 0, _F2(t) = _C5}, {_c[1] = _C2, _F1(x) = 0, _F2(t) = _C5/exp(k*_C2*t)}, {_c[1] = RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2, _F1(x) = _C4*cos((RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2)^(1/2)*x), _F2(t) = _C5/exp(k*RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2*t)})[3]

{_c[1] = RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2, _F1(x) = _C4*cos((RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2)^(1/2)*x), _F2(t) = _C5/exp(k*RootOf(tan(_Z)*(_Z^2)^(1/2)-1)^2*t)}

(5)

If we were able to express _c[1] in closed form, with a formula depending on an integer parameter identifying one of the roots of the expression, the rest of the method is straightforward, the product u(x, t) = _F1(x)*_F2(t) is a solution that by construction satisfies the boundary conditions in (1) , and we have one of them for each value of _c[1](for each root of the expression within the RootOf construction). The first condition in iv is used to adjust the remaining constant (combine _C4 times _C5 into one) using orthogonality properties , and by linearly superimposing these different solutions we construct an infinite series solution. All this is explained in standard textbooks.

 

The problem is what to do when _c[1] cannot be expressed in closed form, as in the example above. To understand the situation clearly, remove that RootOf and plot its contents:

RootOf(tan(_Z)*sqrt(_Z^2)-1) = lambda[n]

RootOf(tan(_Z)*(_Z^2)^(1/2)-1) = lambda[n]

(6)

DEtools[remove_RootOf](RootOf(tan(_Z)*(_Z^2)^(1/2)-1) = lambda[n])

tan(lambda[n])*(lambda[n]^2)^(1/2)-1 = 0

(7)

This equation has infinitely many roots. For instance between -2*Pi and 2*Pi, NULL

plot(lhs(tan(lambda[n])*(lambda[n]^2)^(1/2)-1 = 0), lambda[n] = -2*Pi .. 2*Pi)

 

A closed form solution to represent these values of `&lambda;__n` (also called the eigenvalue of the Sturm-Liouville problem) are necessary in the intermediate solving steps, and to express in closed form the solution to the original problem.

 

We cannot do magic to overcome this mathematical limitation, but there are in Maple representational abstract alternatives: we can use, in all the intermediate computations, a RootOf construction with a label  identifying each of the roots and, at the end, remove the RootOf construction, presenting something readable, understandable.

 

This is the representation of the solution that we are proposing, whose automatic derivation from given pde and iv is already implemented:

pdsolve([pde, iv])

u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})

(8)

So an expression restricted by equations, inequations and possibly subject to conditions. This is the same type of representation we use in pdsolve, PDEtools:-casesplit and the FunctionAdvisor.

 

Note that, since there are infinitely many roots to the left and to the right of the origin, we assumed for simplicity that `&lambda;__n` >= 0, which suffices to construct the infinite series solution above. The initial value for the summation index n could be 0 or 1, it doesn't matter, since n itself does not appear in the summand, it only identifies one of the values of lambda solving tan(lambda[n])*lambda[n]-1 = 0. This is a very nice development.

 

So we can now compute and represent the solution algebraically even when the eigenvalue `&lambda;__n` cannot be expressed in closed form. But how do you test such a solution? Or even plot it?

 

For now that needs some human intervention. Start with testing (part of what follows is in the plans for further development of pdetest). Separate the solution expressed in terms of `&lambda;__n`from the equation defining it

solution := lhs(u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})) = op(1, rhs(u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})))

u(x, t) = Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity)

(9)

op([2, 2, 1, 1], u(x, t) = `casesplit/ans`(Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])}))

tan(lambda[n])*lambda[n]-1 = 0

(10)

By inspection, solution has sin(lambda[n]) and cos(lambda[n]), not tan(lambda[n]), so rewrite (10), and on the way isolate cos(lambda[n])

condition := isolate(convert(tan(lambda[n])*lambda[n]-1 = 0, sincos), cos(lambda[n]))

cos(lambda[n]) = sin(lambda[n])*lambda[n]

(11)

Start by pdetesting

pdetest(solution, [pde, iv])

[0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, Sum(-3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*sin(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^2*sin(2*lambda[n])+4*lambda[n]^3), n = 0 .. infinity)+Sum(3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*cos(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)]

(12)

A further manipulation, substituting condition and combining the sums results in

simplify(subs(condition, combine([0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, Sum(-3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*sin(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^2*sin(2*lambda[n])+4*lambda[n]^3), n = 0 .. infinity)+Sum(3*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))*cos(lambda[n])*exp(-k*lambda[n]^2*t)/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)], Sum)))

[0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, 0]

(13)

So from the four elements (one PDE and three iv), three are satisfied without having to specify who is `&lambda;__n` - it sufficed to say that cos(lambda[n]) = sin(lambda[n])*lambda[n], and this is the case of most of the examples we analyzed. You really don't need the exact closed form of `&lambda;__n` in these examples.

For the one expression which remains to be proven equal to zero, there is no clear way to perform the sum and show that it is equal to 1-(1/4)*x^3 without further information on the value of `&lambda;__n`.  So this part needs to be tested using a plot.

 

We need to perform the summation, instead of using infinite terms, using, say, the first 100 of them, and for that purpose we need the first 100 positive values of `&lambda;__n`. These values can be obtained using fsolve. Increase Digits to get a better approximation:

Digits := 20

20

(14)

L := [fsolve(condition, lambda[n], 0 .. 10^10, maxsols = 100)]

[.86033358901937976248, 3.4256184594817281465, 6.4372981791719471204, 9.5293344053619636029, 12.645287223856643104, 15.771284874815882047, 18.902409956860024151, 22.036496727938565083, 25.172446326646664714, 28.309642854452012364, 31.447714637546233553, 34.586424215288923664, 37.725612827776501051, 40.865170330488067836, 44.005017920830842726, 47.145097736761031075, 50.285366337773650463, 53.425790477394666341, 56.566344279821518125, 59.707007305335457045, 62.847763194454453706, 65.988598698490388394, 69.129502973895260447, 72.270467060308959618, 75.411483488848152399, 78.552545984242931733, 81.693649235601687434, 84.834788718042289254, 87.975960552493213068, 91.117161394464748699, 94.258388345039861151, 97.399638879073768561, 100.54091078684231954, 103.68220212628958019, 106.82351118369472752, 109.96483644107604716, 113.10617654902325890, 116.24753030393208866, 119.38889662883081820, 122.53027455715460386, 125.67166321895208822, 128.81306182910932798, 131.95446967725504430, 135.09588611907366660, 138.23731056880233903, 141.37874249272782439, 144.52018140353123171, 147.66162685535436266, 150.80307843948249426, 153.94453578055557821, 157.08599853323391302, 160.22746637925593824, 163.36893902483538786, 166.51041619835300015, 169.65189764830461611, 172.79338314147304750, 175.93487246129575380, 179.07636540640428965, 182.21786178931479917, 185.35936143525164220, 188.50086418108862526, 191.64236987439434602, 194.78387837256989967, 197.92538954206868814, 201.06690325768935430, 204.20841940193396857, 207.34993786442454883, 210.49145854137182078, 213.63298133509084236, 216.77450615355873900, 219.91603291001033966, 223.05756152256797778, 226.19909191390213620, 229.34062401091997921, 232.48215774447913415, 235.62369304912436649, 238.76522986284504017, 241.90676812685147396, 245.04830778536849850, 248.18984878544468993, 251.33139107677590895, 254.47293461154190896, 257.61447934425489811, 260.75602523161904694, 263.89757223240002997, 267.03912030730377471, 270.18066941886366904, 273.32221953133554631, 276.46377061059982966, 279.60532262407027259, 282.74687554060878265, 285.88842933044586060, 289.02998396510622761, 292.17153941733925030, 295.31309566105380609, 298.45465267125726198, 301.59621042399826673, 304.73776889631308125, 307.87932806617519465, 311.02088791244799345]

(15)

For convenience, construct a procedure, as a function of n, that returns each of these values

Lambda := proc (n) options operator, arrow; if n::nonnegint then L[n+1] else 'procname(args)' end if end proc

proc (n) options operator, arrow; if n::nonnegint then L[n+1] else 'procname(args)' end if end proc

(16)

Replace `&lambda;__n` by "Lambda(n), "infinity by 99 and the expression to be plotted is

remain := subs(lambda[n] = Lambda(n), infinity = 99, [0, Sum(3*cos(lambda[n]*x)*((I*lambda[n]^3+(2*I)*lambda[n]-lambda[n]^2+2)*exp(-I*lambda[n])-4+(-I*lambda[n]^3-(2*I)*lambda[n]-lambda[n]^2+2)*exp(I*lambda[n]))/(2*lambda[n]^3*sin(2*lambda[n])+4*lambda[n]^4), n = 0 .. infinity)-1+(1/4)*x^3, 0, 0][2])

Sum(3*cos(Lambda(n)*x)*((I*Lambda(n)^3+(2*I)*Lambda(n)-Lambda(n)^2+2)*exp(-I*Lambda(n))-4+(-I*Lambda(n)^3-(2*I)*Lambda(n)-Lambda(n)^2+2)*exp(I*Lambda(n)))/(2*Lambda(n)^3*sin(2*Lambda(n))+4*Lambda(n)^4), n = 0 .. 99)-1+(1/4)*x^3

(17)

Perform the sum and plot. The plotting range is the one present in the iv (1), x goes from 0 to 1

R := eval(remain, Sum = add)

plot(R, x = 0 .. 1)

 

This result is very good. With the first 100 terms (constructed using the first 100 roots of tan(lambda[n])*lambda[n]-1 = 0) we verified that this last of the four testing conditions is sufficiently close to zero, and this concludes the verification.

To plot the solution, the idea is the same one: in (9), give a value to k - say k = 1/5 - then construct the sum of the first 100 terms as done in (17), but this time using (9) instead of (13)

 

subs(k = 1/5, lambda[n] = Lambda(n), infinity = 99, u(x, t) = Sum(3*exp(-k*lambda[n]^2*t)*cos(lambda[n]*x)*((-lambda[n]^2+2)*cos(lambda[n])-2+(lambda[n]^3+2*lambda[n])*sin(lambda[n]))/(lambda[n]^3*(sin(2*lambda[n])+2*lambda[n])), n = 0 .. infinity))

u(x, t) = Sum(3*exp(-(1/5)*Lambda(n)^2*t)*cos(Lambda(n)*x)*((-Lambda(n)^2+2)*cos(Lambda(n))-2+(Lambda(n)^3+2*Lambda(n))*sin(Lambda(n)))/(Lambda(n)^3*(sin(2*Lambda(n))+2*Lambda(n))), n = 0 .. 99)

(18)

S := eval(u(x, t) = Sum(3*exp(-(1/5)*Lambda(n)^2*t)*cos(Lambda(n)*x)*((-Lambda(n)^2+2)*cos(Lambda(n))-2+(Lambda(n)^3+2*Lambda(n))*sin(Lambda(n)))/(Lambda(n)^3*(sin(2*Lambda(n))+2*Lambda(n))), n = 0 .. 99), Sum = add)

plot3d(rhs(S), x = 0 .. 1, t = 0 .. 1)

 

Compare with the numerical solution one could obtain using pdsolve with the numeric option . So substitute k = 1/5, and from the corresponding help page rewrite the initial/boundary conditions using D notation and this is the syntax and corresponding plot

pds := pdsolve(subs(k = 1/5, pde), convert({iv}, D), numeric, time = t, range = 0 .. 1)

_m5021120320

(20)

pds:-plot3d(t = 0 .. 1, x = 0 .. 1)

 

``


 

Download PDE_and_BC_Example_with_RootOf_eigenvalues.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi, I ran the following code:

solve({a > 0, b*d*(abs(c)^2-abs(a)^2) = 0, -a*c*(abs(b)^2-abs(d)^2) = 0, -abs(b)^2*a*d+abs(d)^2*b*c = 0, abs(c)^2*a*d-abs(a)^2*b*c = 0}, {a, b, c, d})

and we can easily see that a=a, b=0, c=0, d=d, should be a solution but Maple does not give me that answer. The result is:

{b = 0, c = 0, d = 0, 0 < a}, {b = 0, c = a, d = 0, 0 < a}, {b = d, c = a, 0 < a, 0 < d}, {b = 0, c = -a, d = 0, 0 < a}, {b = -d, c = -a, 0 < a, d < 0}, {b = d, c = a, 0 < a, d < 0}, {b = -d, c = -a, 0 < a, 0 < d}

Am I missing something?

I am interested in taking a complex number and repeatedly raising it to a power and graphing the result to see if it looks cool (i think it will) to do this i wrote this program

iterativepower := proc (base, index, n)

local out, i;
out := vector(n+1, 1);

out[1] := base;

for i to n do out[i+1] := out[i]^index end do;

out;

end proc;


this can be run with:

iterativepower(2, 2, 5)


This doesn't return a vector, it returns the word out. Why is that, and how do i fix it?

Is it just me, or did the insert->subsection disappear from the menus in the latest maple??

i'm using 2018.1 on linux.

thanks

Hello everyone,
My name's Rafael, I am a master's student in Dentistry in Brazil.
I need your help.
I have several points with X, Y and Z coordinates. I would like to create a curve that represents these points in a 3-dimensional plane.
I'm new using Maple and managed to use the "plots [pointplot3d]" function to represent the points in the chart. However I have a list in excel with several point (over 100) and would like to know how to import these points to use this function.
Thank you very much


How can you get maple to evaluate i^i?

when i type in
I^I

i just get

I^I

and similarly when i raise numbers to complex powers i get results like 2^(2I+6)

 

Hi,

This more a warning to focus your attention on a specific point than a true question.
 

I submit you this test case which works in Maple 2015 and Maple 2016 but not in Maple 2018.

In a few words:

  • let X and Y two independant random variables with respective distributions Normal(mu__x, sigma__x) and  
    Normal(mu__y, sigma__y)
     
  • let Z := q -> cos(q)
     
  • You can easily verify that Maple can compute the formal expression of Mean(Z(X)) and Variance(Z(X))
    (which means that it could compute Z(X+Y) for X+Y is just another gaussian RV)
     
  • What I found is that:
    1. Mean(Z(X+Y)) returns same expressions in Maple 2015 and Maple 2016, but a different one in Maple 2018.
      Luckily the later is more readable than the former ones, and closer to the one of Mean(Z(U))  where U=X+Y is the RV of distribution Normal(mu__x+mu__y, sqrt(sigma__x^2+sigma__y^2))
      This suggest that the integration algorithm has evolved somewhere in between Maple 2016 and Maple 2018
       
    2. While Maple 2015 and Maple 2016 return an evaluated result for Variance(Z(X+Y)) Maple 2018 fails.
       

Can this "failure" be fixed by some adhoc option of Variance?
Or could it come from a "regression" in the implementation of this procedure (or of the underlying int procedure) in Maple 2018?

PS: I did not try to compute Variance(Z(X+Y)) from an explicit double integration


Stat_2015.mw

Why does the following not get simplified?

simplify(conjugate(b) * I - conjugate(a) + conjugate(b*I+a));

It seems Maple does not know conjugation is linear, since the following

simplify(conjugate(b) * I                + conjugate(b*I  ));
simplify(                 - conjugate(a) + conjugate(    a));

do get simplified to 0.

The function does simplify to 0, but it assumes my and are real, which they are not. 

First 635 636 637 638 639 640 641 Last Page 637 of 2097