Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

What is the best and accurate way to export a large symbolic matrix (200*300) from Maple to Matlab? The Marix have a lot of variables, symbols and operators such as diiff, int, ....

Here is a simple example:

NULL

restart

NULL

A := Matrix(2, 6, {(1, 1) = x*y*z, (1, 2) = (1/2)*tau[2], (1, 3) = sin(x*y*z), (1, 4) = ln(x*y*z), (1, 5) = tau[1]*exp(x*y*z), (1, 6) = sin(x+y)+cos(x+y), (2, 1) = x^2+1, (2, 2) = x^2+1/sin(x*y*z), (2, 3) = 2*exp(y), (2, 4) = tau[1], (2, 5) = diff(f(x, y, z), x), (2, 6) = int(f(x, y, z), x)})

A := 1/sin(protected)

(1)

``

CodeGeneration[Matlab](codegen[makeproc](A, [x, y, tau[1], tau[2]]))

Error, (in codegen/makeproc) optional arguments must be equations [x, y, tau[1], tau[2]]

 

``

``

``

``

``

``

Download export.mw

I would appreciate any recommendation on these games and puzzles with maple implementation. The purpose is to inspire the math interest of children (say 16-) . Benefits from the assistance of Maple:

1. Learn and build the habit of math modelling: eg by playing with this n-queen problem - https://www.maplesoft.com/Applications/Detail.aspx?id=154482

Children can realize that, for many problems, modelling is doable for them - question formation in math/programming and finding all the constraints - while solution method is simply a small step if done by computer. This is already a big step forward for them and they may enjoy the modelling process. For more math-eager kids, they may start to explore the documentation behind the solution methods.

2. Learn the art of automatic proof by witnessing the efficiency gain by themselves - I don't think I have to explain such to the community here. I note Doron Zeilberger has collected many in such a spirit on his website.

I have read some in the Application Center (eg under the tag game) and by searching here by the "puzzle". Is there some more systematic collection/books? The applications I have seen is mostly on logical/combinatorial problems. Love to see the games/puzzles under a broader range of math fields good for children.

Even though this question is related to this one 
https://www.mapleprimes.com/questions/234781-How-Can-I-Get-The-Desired-Answer-From-solve
feel it is about a different issue. If any of you feel otherwise feel free to move it to the original one.

In this notional example  the name _Z1~ is created by RootOf: and here is an ad hoc way to catch it.

restart:

f := RootOf(cos(x)-z, x):
u := indets(f, name);
s := series(f, z):
v := remove(type, indets(s, name), constant);
w := v minus u

{z}

 

{_Z1, z}

 

{_Z1}

(1)

 

Download Example_1.mw

In this more complex example an assumption must be made on M to obtain ths desired solution g and the previous method no longer works.

restart

f := 10*cos((-1+t)/sqrt(1+M))-10*cos(t/sqrt(1+M)):
assume(M::nonnegative):
u := indets(f, name);
g := solve({diff(f, t), t>0 }, t, allsolutions)[1][1];
v := remove(type, indets(rhs(g), name), constant);
w := v minus u

{M, t}

 

t = Pi*_Z2*(1+M)^(1/2)-arctan((cos(1/(1+M)^(1/2))+1)/sin(1/(1+M)^(1/2)))*(1+M)^(1/2)

 

{M, _Z2}

 

{M, _Z2}

(1)

 

Download Example_2.mw

I have tried using select to "capture" the name _Z2~ but I can't know how to distinguish M~ from _Z2~ (is there a type which could be used?).

Can you helpm fix this?
TIA

Is there an assumption or some other way I can tell Maple to avoid such errors when using odetest, as I get many of them.

I think the solution Maple gives is correct. But odetest generates these strange innternal error that it does not know the sign of a complex number.

restart;
ode:=x^2*diff(y(x), x$2) + (cos(x)-1)*diff(y(x), x) + exp(x)*y(x) = 0;
sol:=dsolve(ode,y(x),series):
odetest(sol,ode,series,point=0);

Error, (in odetest/series) need to determine the sign of I*3^(1/2)

I've seen such error many times before and it is still not fixed in release after release.

I am using Maple 2022.1 on windows 10.

I don't understand why the solution of sys_2 isn't those of sys_1 when M__p=1 and M__a=0 ?

Traces of the computation seem to indicate that dsolve proceeds exactly the same for sys_2 and sys_1 .

Please note that sol_1 contains a term of the form t*cos(t) that sol_2 doesn't, thus the question: "Is sol_2 correct?"

Could you help me to fix this?
TIA

restart

infolevel[dsolve] := 4;

4

(1)

sys_1 := {diff(x(t), t$2)=sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_1 := dsolve(sys_1)

{diff(diff(x(t), t), t) = sin(t)-x(t), x(0) = 0, (D(x))(0) = 0}

 

Methods for second order ODEs:
--- Trying classification methods ---
trying a quadrature
trying high order exact linear fully integrable
trying differential order: 2; linear nonhomogeneous with symmetry [0,1]
trying a double symmetry of the form [xi=0, eta=F(x)]
-> Try solving first the homogeneous part of the ODE
   checking if the LODE has constant coefficients
   <- constant coefficients successful
   -> Determining now a particular solution to the non-homogeneous ODE
      building a particular solution using variation of parameters
<- solving first the homogeneous part of the ODE successful

 

x(t) = (1/2)*sin(t)-(1/2)*cos(t)*t

(2)

sys_2 := {(M__p+M__a)*diff(x(t), t$2)=M__p*sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_2 := dsolve(sys_2)

{(M__p+M__a)*(diff(diff(x(t), t), t)) = M__p*sin(t)-x(t), x(0) = 0, (D(x))(0) = 0}

 

Methods for second order ODEs:
--- Trying classification methods ---
trying a quadrature
trying high order exact linear fully integrable
trying differential order: 2; linear nonhomogeneous with symmetry [0,1]
trying a double symmetry of the form [xi=0, eta=F(x)]
-> Try solving first the homogeneous part of the ODE
   checking if the LODE has constant coefficients
   <- constant coefficients successful
   -> Determining now a particular solution to the non-homogeneous ODE
      building a particular solution using variation of parameters
<- solving first the homogeneous part of the ODE successful

 

x(t) = sin(t/(M__p+M__a)^(1/2))*M__p*(M__p+M__a)^(1/2)/(M__p+M__a-1)-M__p*sin(t)/(M__p+M__a-1)

(3)

eval(sol_2, [M__p=1, M__a=0])

Error, numeric exception: division by zero

 

 

Download SomethingWrong.mw

PS: Already, in the following case, dsolve doesn't return the solution of sys_1.

sys_3 := {(A+B)*diff(x(t), t$2)=(A+B)*sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_3 := dsolve(sys_3)

If I do this

sys_4 := {(A+B)*diff(v(t), t)=(A+B)*sin(t)-x(t), diff(x(t), t)=v(t), x(0)=0, v(0)=0}:
sol_4 := dsolve(sys_4)

I get a very complex solution wich contains a piecewise function which separates the cases A+B=1 and A+B<>1.
Evaluating sol_4 for A+B=1 gives the same expression than sys_1:

simplify(eval(sol_4, A=1-B), trig)
       /       1                  1          1         \ 
      { v(t) = - sin(t) t, x(t) = - sin(t) - - cos(t) t }
       \       2                  2          2         / 

Here is a workaround to get the correct solution of sys_2:

sys_5 := {(M__P+M__A)*diff(v(t), t)=(M__P+C)*sin(t)-x(t), diff(x(t), t)=v(t), x(0)=0, v(0)=0}:
sol_5 := dsolve(sys_5):
simplify(eval(sol_5, [M__P=1, M__A=0, C=0]), trig)
       /       1                  1          1         \ 
      { v(t) = - sin(t) t, x(t) = - sin(t) - - cos(t) t }
       \       2                  2          2         / 

e

Hi, 

Please how I do plot: theta := -(65.7014900075861*(cos(-4.536529763+45365.29764*z)+.1749541674))*exp(-1.603200636*t) for z=0..d.

I tried this: 

display(plot([seq(subs(t = i, theta), i = [seq(0.1*ii, ii = 1 .. 7)])], z = 0 .. d));

But I want this sequence: [seq(subs(t = i, theta), i = [seq(0.1*ii, ii = 1 .. 7)])] to include Pi/2 such that t_0 = Pi/2 in the plot. I.e., I want the Pi/2 to be the initial value in the sequence.

I compute the solution of this differential system

shock := piecewise(t <0, 0, t < 1, 10, 0):
sys   := {(M__p+M__a)*diff(x(t), t$2)=M__p*shock-x(t), x(0)=0, D(x)(0)=0}
sol   := unapply(rhs(dsolve(sys)), (M__p,M__a))

I'm interested in 3 quantities:

  • the first time tend > 0 such that sol(tend) = 0,
  • the time tmax in (0..tend) where sol(tmax) reaches its maximum value,
  • the value xmax = sol(tmax).

Since sol has a relatively simple expression, I first attempted to use solve for calculating tend, but that didn't work.
The conclusion is still the same for tmax and xmax.

The values of these 3 quantities that I expect solve to provide, are those obtained using fsolve.

Can you explain me the failures I faced and show me how to force solve to get these values?
TIA

ToyProblem.mw

Paulina Chin of Maplesoft and I are pleased to annouce Maple Transactions Volume 2 Issue 1, the Proceedings of the 2021 Maple Conference.

Articles can be found at mapletransactions.org

Some articles are written directly in Maple and are published via the Maple Cloud.  There is also a Demo Video by Michael Monagan of his new GCD code.  There are articles on Math Education, on Applications of Maple, on software, and on mathematics research.  We draw particular attention to the article by Veselin Jungic, 3M Teaching Fellow at SFU and a Fellow of the Canadian Math Society, on Indigenising mathematics.  We hope that, as members of the Maple Community, you find much of interest.

Best wishes,

Rob Corless, Editor-in-Chief

Maple Transactions

Forest of ethnomathematics and its root.  Colourful natural trees growing in a forest above ground while below ground is a colourful mathematical tree going to a single glowing root

Let S be a set S={E1,E2,E3,E4,.....,Ek}  where E1 is a set of edges, E2 is another set of edges etc.

that like E1={{1,2},{2,3},..}, E2={{3,4},{1,2},....} , now we need to pick all possible  distinct sets of  size L  from the k sets of S such that the 

{E1,E2,E3,....,EL} are mutually disjoint with each other in other.

Ei intersect Ej is null no edge in common for i  not equal to j    where i, j varies from 1 to L.

F is the function which takes to parameters set S and L.

F(S,L)  then returns all possible sets which are such that {E1,E2,E3,....,EL} are mutually disjoint with each other in other.

Here mutually disjoint in graph theory terms they are edge-disjoint mutually 

I hava a recursive formula with variable n. The answer has the variable n and also N1.  What doe N1 mean?

Currrently maple exports it in huge fonts do the pdf is really big. I would like to make the pdf smaller by decreaseasing the font size. I cant seem to find any options for that online.


 

New generalized unit vectors in Physics:-Vectors

 

The Physics:-Vectors package, written many years ago to teach Vector Analysis to 1st year undergrad students in Physics courses, introduces several things that are unique in computer algebra software. Briefly, this package has the ability to compute sums, dot and cross products, and differentiation with

• 

abstract vectors, like `#mover(mi("A"),mo("&rarr;"))` or `#mover(mi("A"),mo("&rarr;"))`(x, y, z), symbols or functions with an arrow on top that indicates to the system that they are vectors, not scalars;

• 

projected vectors of algebraic (non-matrix) type in any of the Cartesian, cylindrical or spherical basis and/or associated systems of coordinates, including for that purpose an implementation of the corresponding unit vectors of the three bases;

• 

abstract or projected differential operators that involve Nabla, Gradient, Divergence, Laplacian and Curl;

• 

inert vectors or vectorial differential operators, including related expansion of operations and simplification; 

• 

path, surface and volume vector integrals.

 

In addition to the above, the display is as in textbooks, the input resembles paper and pencil handwriting, and examples of the use of Physics:-Vectors in Vector Analysis are presented in the Physics,Examples page.

 

Download New_generalized_unit_vectors.mw

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

Hi ---

      I know how to add the Angstrom symbol to a plot's axis label using my mouse and the palette menu.  How can I add the Angstroms symbol programmatically to the plot command?  Thanks!

David

Hi

I want to solve two equations (Eqmin and Eqmax) numerically  and plot curves of Mmin and Mmax versus "sigma" in one frame, But the  second curve (Mmax) is not plotted !  What should I do? 
(We know that only real and positive roots are acceptable)
Eq.mw

First 280 281 282 283 284 285 286 Last Page 282 of 2218