Maple 2020 Questions and Posts

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

Hello! Sorry if this question was already asked, I just can't find my answer and I don't really know how to form the question since I'm new to using Maple. My question is: How can I find a point on a plot I did in Maple? When I use the cursor position(from when I click Probe info) I can never align it right enough for me to not get a decimal answer. For instance, I can't figure out the y-value for when x=2 because the closest I can get to 2 is like 2.1 which isn't exact enough for me. 

When a real matrix have repeated eigenvalue (i.e. multiplicity >1) and the matrix is not the identity matrix, then it is called defective eigenvalue. 

For example if the eigenvalue is repeated 2 times, there will be only one eigevector associated with it.

There is an algorithm to generate another (linearly independent) eigenvector from this same eigenvalue called the defective eigenvalue method.

My question is: Does Maple have support for finding such additional eigenvectors?  The standard Eigenvectors does not seem to do this. Here is an example.

restart;
A :=Matrix([[1,-2],[2,5]]);
(eigen_values, eigen_vectors) := LinearAlgebra:-Eigenvectors(A);

By hand, using the defective eigenvalue method it is possible find second eigenvector for this eigenvalue, which is linearly independent of the one returned by Maple. Such as 

The method to find these additional eigenvector is described in number of places such as 

https://en.wikipedia.org/wiki/Defective_matrix

And the pdf at the bottom show a more detailed example.

I can code this method by hand to find complete set of L.I. eigenvectors for this defective eigenvalue.  

But before doing that, I thought to ask if Maple have buildin support for this, such as a single command to do this or some package.

I looked at help for LinearAlgebra and I am still not able to see anything, It only says this:

With an eigenvalue of multiplicity  k>1 , there may be fewer than  k linearly independent eigenvectors. In this case, the matrix is called defective.  By design, the returned matrix always has full column dimension.  Therefore, in the defective case, some of the columns that are returned are zero.  Thus, they are not eigenvectors.  With the option, output=list, only eigenvectors are returned.  For more information, see LinearAlgebra[JordanForm] and LinearAlgebra[SchurForm].
 

This PDF also describes using Maple, how to do it for one example

https://wps.prenhall.com/wps/media/objects/884/905485/chapt5/proj5.4/proj5-4.pdf

This PDF also describes how to do it by hand without using Maple, starting at end of page 3

http://www.math.utah.edu/~zwick/Classes/Fall2013_2280/Lectures/Lecture23_with_Examples.pdf

It is not too hard to code this method in Maple. But if Maple allready can do it, using some command, it will be better ofcourse.

 

Using latest Physics, I found case where it is not giving the Latex.

Please see attached worksheet.  This is on windows 10, Maple 2020.1.1

 

restart;

interface(version);

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 804 and is the same as the version installed in this computer, created 2020, September 7, 12:31 hours Pacific Time.`

ode:=diff(y(t),t) = -2*arctan(y(t))/(1+y(t)^2);

diff(y(t), t) = -2*arctan(y(t))/(1+y(t)^2)

sol:=dsolve(ode)

t+Intat((1/2)*(_a^2+1)/arctan(_a), _a = y(t))+_C1 = 0

Physics:-Latex(sol)

Error, (in unknown) invalid range for string subscript

latex(sol)

t+\int ^{y \left( t \right) }\!{\frac {{{\it \_a}}^{2}+1}{2\,\arctan
 \left( {\it \_a} \right) }}{d{\it \_a}}+{\it \_C1}=0

 


By trial and error, I found that the error was introduced in Physics 797. Since in Physics 796 it did work.

Here is screen shot

Download latex_issue_11.mw

Here are the inputs and output:

Why is it not possible to simplify the meter and the second (which are units).  If I do "simplify(pmin), the unit MeV becomes J and that is not what I want.  Simply said, is Maplesoft planning to include particle physics where c = h = 1 in the future version of the package "Physics"?

Until that happens, does someone knows how to give the answer in MeV/c.  The preceding problem was asking the mass of a particle in MeV/c^2.

Thank you in advance for your trouble.

Mario Lemelin

Geometry := 2;
if Geometry = 1 then
    f_obj := 4.5;
    f_fluo := 125;
    f_TIE := 45;
    d_sample := f_obj;
    d_max := 250;
    d_cam := f_TIE;
    d_interlens := d_max - d_cam;
end if;
if Geometry = 2 then
    f_obj := 4.5;
    f_fluo := 125;
    f_TIE := 45;
    d_sample := 4.6;
    d_max := 250;
    d_interlens := d_max - d_cam;
end if;
                               2

                              4.5

                              125

                               45

                              4.6

                              250

                          250 - d_cam

TIE := (((((Distance(d_cam)) . (Lens(f_TIE))) . (Distance(d_interlens))) . (Lens(f_obj))) . (Distance(d_sample))) . (Vector(2, [distance, angle]));
           Vector[column](%id = 18446746239510517390)

d_cam_solved := fsolve(coeff(TIE[1], angle, 1), d_cam, d_cam = 20 .. 100);
Error, `,` unexpected

Hello, if I set d_sample to 4.6 then I get "Error, ',' unexpected when I try to find a solution using fsolve. However if I set it to 4.5 then the fsolve computes no problem and I get a solution. Does somebody know if this means fsolve has no solution or have I made a mistake somewhere else? Thanks

When I give symgen a HINT, using functional form f(x),g(x)*y it does not generate the infinitesimals of the Lie group for this ODE.

But from the answer given using way=abaco1 it is clear they have this form, where f(x)=-1/x and g(x)=1/x^2

From help, it says

HINT=[e1,e2], indicates to the solver that it should take e1 and e2 as the infinitesimals, where e1 and e2 can contain a maximum of two indeterminate functions. The solver tries to determine the infinitesimals to solve the problem.

And I am using only two indeterminate functions. These are f(x) and g(x)

Am I making a mistake somewhere? Please see worksheet below.


 

restart;

interface(version)

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 801 and is the same as the version installed in this computer, created 2020, September 7, 14:32 hours Pacific Time.`

restart;
ode:=diff(y(x),x)=(1-y(x)^2)/(x*y(x))+1;
#why this below do not give result?
DEtools:-symgen(ode,HINT=[f(x),g(x)*y]);

diff(y(x), x) = (1-y(x)^2)/(x*y(x))+1

DEtools:-symgen(ode,way=abaco1);

[_xi = -1/x, _eta = y/x^2]

#it works for this though. May be the two functions
#can  not be both functions of x at same time?
#one function must be function of x and the other of y?
#But help does not say that.

ode :=diff(y(x),x)=(x+cos(exp(-x)*(1+x)+exp(y(x))))/(exp(x+y(x)));
DEtools:-symgen(ode,HINT=[f(x),x*g(y)]);

diff(y(x), x) = (x+cos(exp(-x)*(1+x)+exp(y(x))))/exp(x+y(x))

[_xi = exp(x), _eta = x*exp(-y)]

 


 

Download symgen_issue_2.mw

Hi. I recently downloaded Maple 2020 for school and I've run into some issues when trying to use it. I downloaded it for MS-Windows. I got the activation code from my school (it was provided for me for free) and inputed it during set up when I was prompted for the code. After I open Maple and start trying to use it I can't because it doesn't let me edit anything I typed (won't let me use backspace) and when I try to press enter to evaluate something nothing happens. When I try to use anything in the context bar it just freezes the application entirely and won't even let me close it so I have to restart my computer. How do I fix this and actually be able to use Maple? 

I am trying to plot the equation diff(P(t),t) = P(t)*(7-P(t))-10 on a direction field but I keep getting this error code: Error, (in DEtools/DEplot/CheckDE) extra unknowns found: YP[2].

This is what i have entered in:    

DEplot(diff(P(t),t) = P(t)*(7-P(t))-10,P(t),t=-10..10,P=-10..10,scene=[P,P(t)],conditions,number=1, stepsize=.01);
 

Any idea why symgen hangs when using formal algorithm on this first order ode? I was just comparing the Lie symmetries generated for this ode using different algorithms when I noticed this hang on formal.

The textbook gives this result btw

From help on symgen it says

The first algorithms, called formal, formulates a linear PDE system for the infinitesimals [xi, eta], then formally triangularize this system - using differential algebra techniques - finally tacking the resulting uncoupled system. When successful, this algorithm returns the complete set of point symmetries admitted by a given ODE of order 2 or higher. NOTE: this algorithm is advantageous mainly for 2nd and higher order ODEs. The algorithm works as well in the case of first order ODEs, but in this case the subproblems it will need to solve to find the symmetries are as difficult to solve as the first order ODE itself.
 

But on Maple 2020.1 server seems to hang, taking 100% CPU. I had to terminate mserver.exe manually since clicking on interreupt button from worksheet has no effect. This only happens with formal algoritm. All others work very fast. 

I know help says this is meant for second order ODE's, but it also says it works  well for first order.  It seems to be stuck in solve call somewhere. Is this to be expected sometimes when using formal algo in symgen for first order ode's?

Maple can solve the ODE very quickly otherwise.


The following ode also hangs in symgen

ode:=diff(y(x),x)=x*y(x)^2-2*y(x)/x-1/x^3;


 

restart;

interface(version)

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 794 and is the same as the version installed in this computer, created 2020, September 3, 23:37 hours Pacific Time.`

#hangs on formal, why?
restart;
ode:=diff(y(x),x)=(y(x)-4*x*y(x)^2-16*x^3)/(y(x)^3+4*x^2*y(x)+x);
DEtools:-symgen(ode,y(x),way=formal)

diff(y(x), x) = (y(x)-4*x*y(x)^2-16*x^3)/(y(x)^3+4*x^2*y(x)+x)

restart;
ode:=diff(y(x),x)=(y(x)-4*x*y(x)^2-16*x^3)/(y(x)^3+4*x^2*y(x)+x);
sol:=dsolve(ode,implicit)

diff(y(x), x) = (y(x)-4*x*y(x)^2-16*x^3)/(y(x)^3+4*x^2*y(x)+x)

(1/2)*y(x)^2+(1/2)*arctan((1/2)*y(x)/x)+2*x^2-_C1 = 0

 


 

Download symgen_issue_1.mw

I wish to write 2D output strings in various colors. Normally I use printf, though I'm willing to hear other suggestions.

An optimal procedure would one where I pass it the string, and a ColorName color such as "DodgerBlue" or "xkcd blue", but I'm happy if it means passing my own hex code.  Thanks.

As I was going over latest build using Physics:-Latex I noticed this.

The complex number I should be translated to lower case in latex.

This is what the original latex() does (and also what Mathematica TeXForm does).

It does not look good at all to have complex number I be translated to I and remain UPPER case I

Here is an example

expr:=[solve(x^2+2*x+2=0,x)];
Physics:-Latex(expr)

gives

[-1+I, -1-I]

While  latex(expr) gives the much better and more mathematical output:

[-1+i,-1-i]

 

interface(version);

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 790. The version installed in this computer is 789 created 2020, September 1.`

expr:=[solve(x^2+2*x+2=0,x)];
Physics:-Latex(expr)

[-1+I, -1-I]

[-1+I, -1-I]

latex(expr)

[-1+i,-1-i]

 


Is it possible to have Physics:-Latex translate complex numbers like latex() did?

Please see attached worksheet below.

Download latex_issue_9.mw

I'd like to suggest Physics:-Latex change its use of \textit{} and replace it with \mathit{} 

\mathit is the better Latex command to use, since the Latex generated goes into math mode and \mathit is designed to be used in math mode and hence has a better spacing for this. Making the final Latex look a little better.

Here is an example showing the difference.

restart;
ode:=diff(y(x),x) = y(x)/(x^2+1);
sol:=dsolve(ode);
Physics:-Latex(sol)

Gives

y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}

It will be better to generate

y \left(x \right) = \mathit{\_C1} {\rm e}^{\arctan \left(x \right)}

Here is the difference when both are compiled using latest texlive 

Since all the Latex generated is meant to be used in math mode, \mathit would be better choice. It is considered wrong to use \textit in math mode actually, even though it does compile.

Here is the latex file used to generate the above pdf

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}


\begin{document}

\[
y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}
\]

\[
y \left(x \right) = \mathit{\_C1} {\rm e}^{\arctan \left(x \right)}
\]

\end{document}


 

interface(version);

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 789 and is the same as the version installed in this computer, created 2020, September 1, 23:54 hours Pacific Time.`

ode:=diff(y(x),x) = y(x)/(x^2+1);
sol:=dsolve(ode);
Physics:-Latex(sol)

diff(y(x), x) = y(x)/(x^2+1)

y(x) = _C1*exp(arctan(x))

y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}

 


thank you

Download latex_issue_8.mw

I've been using Physics:-Latex in my large program, and checking the output visually. I noticed this small issue on one page.

When asking Physics:-Latex to generate Latex for this expression

It gives

While when using standard latex() command, the result is

Below is the worksheet attached. Using Latest Physics and Maple.
 

interface(version)

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 784 and is the same as the version installed in this computer, created 2020, August 31, 0:51 hours Pacific Time.`

restart;

 

expr:=1/2*int(exp(-t)*f(t),t)*exp(t)-1/2*exp(-t)*int(exp(t)*f(t),t)

(1/2)*(int(exp(-t)*f(t), t))*exp(t)-(1/2)*exp(-t)*(int(exp(t)*f(t), t))

Physics:-Latex(expr)

\frac{\left(\int {\rm e}^{-t} f \left(t \right)d t \right) {\rm e}^{t}}{2}+-\frac{1}{2} {\rm e}^{-t} \left(\int {\rm e}^{t} f \left(t \right)d t \right)

latex(expr)

{\frac {\int \!{{\rm e}^{-t}}f \left( t \right) \,{\rm d}t{{\rm e}^{t}
}}{2}}-{\frac {{{\rm e}^{-t}}\int \!{{\rm e}^{t}}f \left( t \right)
\,{\rm d}t}{2}}

 


THe latex file used to compile the Maple output Latex using TeXLive distribution on Linux is

\documentclass[12pt]{article}
\usepackage{amsmath}
%\usepackage{maplestd2e} %not needed for this example
\begin{document}

%output of Physics:-Latex()
\[
\frac{\left(\int {\rm e}^{-t} f \left(t \right)d t \right) {\rm e}^{t}}{2}+-\frac{1}{2} {\rm e}^{-t} \left(\int {\rm e}^{t} f \left(t \right)d t \right)
\]

%output of maple latex()
\[
{\frac {\int \!{{\rm e}^{-t}}f \left( t \right) \,{\rm d}t{{\rm e}^{t}}}{2}}-{\frac {{{\rm e}^{-t}}\int \!{{\rm e}^{t}}f \left( t \right) \,{\rm d}t}{2}}
\]

\end{document}

Download latex_issue_5.mw

 

Hello!

How to calculate the residual sum of squares of a Nonlinear Fitting?

I tried but was unsuccessful.

 

I spend all day on this, since some tests I have were failing when I changed to using Physics:-Latex() vs. latex(). I made no change at all in my own code other than to replace latex() by Physics:-Latex().

I am still not sure why that is, but it seems due to symbol clash somewhere.  First time I run my test, it passes, next time if fails. When I change back to latex(), the test passes each time.  

This seems to be due to when calling Physics:-Latex() the very first time, it automatically changing diff(y(x),x) to y'(x). May be it is storing its own x in there. (this happens on special input and not for each input, that is why only some tests fail and not all of them).

So next time I call the test it failes. May be due to different x being used. I do not know. 

All what I know now is that using latex() makes my dsolve test passes each time.  

But here I will show the issue which I think if fixed, should fix the main problem.

Calling Physics:-Latex() causes it to automatically change diff(y(x),x) to y'(x)  even though I am not using Typeseeting at all. 

restart;
s:= y = u*x:  #special case input which causes the typesetting to kick in
ode:=diff(y(x),x)=1:
print(ode);
Physics:-Latex(s,output = string):
print(ode);

Notice how the derivative changes on its own to using y'(x).  Now compare with latex()

restart;
s:= y = u*x:
ode:=diff(y(x),x)=1:
print(ode);
latex(s,output = string):
print(ode);

So something happens inside Physics:-:Latex which causes this.  

For now, I will change back to latex() until I figure more what is going on so that my test do not fail. I like to use Physics:-:Latex as it made the latex look much better.

Maple 2020.1, Physics 778
 

restart;

interface(version)

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 778 and is the same as the version installed in this computer, created 2020, August 29, 9:34 hours Pacific Time.`

s:= y = u*x:
ode:=diff(y(x),x)=1:
print(ode);
Physics:-Latex(s,output = string):
#latex(s,output = string):
print(ode);

diff(y(x), x) = 1

diff(y(x), x) = 1

 


 

Additional observation

This change of typesetting does not happen all the time. For example if s:= y = x: then it works OK. i.e. it does not change typesetting. But if s:= y = u*x: then it changes typesetting. which is very strange why that is.

I stepped into Physics:-Latex using the debugger., The typesetting changes after the call to Physics:-Latex:-Print.

Download latex_issue_2.mw

 

First 36 37 38 39 40 41 42 Last Page 38 of 55