Maple 2022 Questions and Posts

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

I am working with expressions resulting from maple calculations that are 3-4 lines long, but I have to make a term-by-term comparison between one calculation and another. I would like to interweave the results of the two calculation so that one is above the other allowing direct comparison. It would also be nice to break up the expressions into pieces.  Unfortunately, I have gone as far as I can using maple directly.  The only solution I have come up with is to convert the expressions into Tex, copy them to a Tex editor and manipulate the expressions.  Unfortunately, Tex markup makes it difficult interpret the terms. 

Has anyone come up with another method to manually manipulate the output from maple calculations.

I'm seeking a way to test conditional statements for truth in Maple (2022).

The statements are like (\phi^2 > 2) implies (\phi > 1.4)

1) how can I input such kind of statements?

2) how can I get a result in form true/false

  a) for entire expression

  b) (depending on phi range)

I can not find my Kamke book right now. But according to Maple help, Homogeneous ODE of Class C is the following

If I understand the above, it is saying that the RHS of the ode should be ratio of two polynomials, and both should be linear in y and x. Correct?

Given the above, then why Maple says the following ode is _homogeneous, `class C` ? Since the RHS is not linear in y and not linear in x:

restart;
ode:=diff(y(x),x)=(2*y(x)-1)*(4*y(x)+6*x-3)/(y(x)+3*x-1)^2;
ode:=lhs(ode)=expand(numer(rhs(ode)))/expand(denom(rhs(ode)))

DEtools:-odeadvisor(ode)

           [[_homogeneous, `class C`], _rational]

What Am I overlooking/misunderstanding  from reading this definition? 

in Maple 2022.1 on windows 10

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1288 and is the same as the version installed in this computer, created 2022, August 6, 16:9 hours Pacific Time.`

restart;

int(x^5*(a+b*arctan(c*x^2))^2,x)

Error, (in gcdex) invalid arguments

 


Why it happens and is there a workaround?

Does it happen on earlier versions? I do not have an earlier Maple installed on my current PC as it is new to check. 

Download int_problem_8_10_2022.mw

I have string of length

StringTools:-Length(str);
                            1073105

When doing

p:=StringTools:-LengthSplit(str,100):

Maple gives

 

From help:

LengthSplit
split a string into equal length pieces

 

This is all done in .mpl  file actually, not interactive, but I made the above worksheet to show  the problem. The string is read from a file by a program and it wants to split it to 100 length smaller strings.

I have lots of RAM. 128 GB.  So why does Maple crash and is there a workaround this?

This string was generated by another software.

I have attached the above example below as worksheet.  Maple 2022.1 on windows 10.

Here is a simpler way to generate this problem

restart;
str:=StringTools:-Random(1073104,'upper'):
str[1..10];

StringTools:-Length(str);
p:=StringTools:-LengthSplit(str,100):

 

Using trial and error, the crash happens when the length reaches 1073101. At 1073100 there was no crash.

 

 

Found case where PDEtools:-Solve gives exception but not solve.

Is this known issue?

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

restart;

result:=1/2*(Dirac(1,-t+4+k)+Dirac(1,t-4+k)-Dirac(1,-t+4+k)*cos(-t+4+k)+2*Dirac(-t+4+k)*sin(-t+4+k)+2*sin(t-4+k)*Dirac(t-4+k)-Dirac(1,t-4+k)*cos(t-4+k))/k;
result:=simplify(result) ;
PDEtools:-Solve(result = 0,t) assuming t::real

(1/2)*(Dirac(1, -t+4+k)+Dirac(1, t-4+k)-Dirac(1, -t+4+k)*cos(-t+4+k)+2*Dirac(-t+4+k)*sin(-t+4+k)+2*sin(t-4+k)*Dirac(t-4+k)-Dirac(1, t-4+k)*cos(t-4+k))/k

(1/2)*(Dirac(1, -t+4+k)+Dirac(1, t-4+k)-Dirac(1, -t+4+k)*cos(-t+4+k)+2*Dirac(-t+4+k)*sin(-t+4+k)+2*sin(t-4+k)*Dirac(t-4+k)-Dirac(1, t-4+k)*cos(t-4+k))/k

Error, (in assuming) when calling 'RootOf'. Received: 'expression independent of, _Z, RootOf'

solve(result = 0,t) assuming t::real

 

Download exception_from_Solve_august_8_2022.mw

UNIVERSIDAD AUTÓNOMA METROPOLITANA
UNIDAD XOCHIMILCO

15º Foro de Investigación de las Matemáticas Aplicadas a las Ciencias Sociales "Reflexiones sobre Educación y Matemáticas”,

"Learning of mathematical functions using applications with Maple, for students of Social Sciences"

The students of the first cycles have a low level of learning in the subject of functions, and the arrival of the pandemic worsened the understanding of this content. Increasing the use of ICT in great magnitude improving learning.
To determine the relationship between learning and mathematical functions using applications with Maple, for students of Social Sciences. The experimental method was used using the scientific software Maple applied to students of Social Sciences.

In Spanish.

 

Lenin Araujo Casillo

Ambassador of Maple

 

 

I create a plot, then later on, I want to use the same view for a second plot or using the same starting x, ending x and starting y and ending y. For reasons no need to get into into, I need to do this and I have no access to this information at this time. I only have access to the p variable used to store the plot into as in this example below.

I am not sure what is the correct way to do read this information from the PLOTS structure as I never used it before. 

Help describes the PLOTS structure under "PLOT and PLOT3D Data Structures" , but do not see how is one supposed to read different parts of it. I could have missed it. Maple help pages are very hard for me to read in order to obtain the information needed. From help it says:

The Maple plotting functions, plot, plot3d, and others, produce PLOT and PLOT3D data structures describing the images to be displayed.

By trial and error, for standard plot this worked

p:=plot(sin(x),x=-1..10):
op([4,1,2,2],p)

returns

           "originalview" = [-0.9862500000 .. 9.9862500000, -1.0000000000 .. 1.0000000000]

I see also that command plottools:-getdata(p):  returns the data. So I could also do (it is stored in matrix, in third entry):

p0:=plottools:-getdata(p);
startingx:=p0[3][1,1];
startingy:=p0[3][1,2];
endingx:=p0[3][-1,1];
endingy:=p0[3][-1,2];

Will the above work all the time? should this command be used to obtain this information or is there a better way?

When I lprint(p) I see these fields have actual names. For example  , here is screen shot of lprint(p)  

 

it looks like  a RECORD data structure. But when I tried p:-originalview  Error, `p` does not evaluate to a module 

The question is: What is the correct way to find what x range and y range was used for an earlier plot, given one has access only to p variable used to store the output of the plot command?  This is for 2D plot only.

I have differential equation with x as independent variable that I want to convert to state space representation.

But DynamicSystems will not accept y(x) as the output variable, since it defaults to y(t).

Help under "Description of the Model of a Linear System Object" says it is possible to change the independent variable by changing continuoustimevar setting. But help does not give an example how to do this and all my tries failed.

How to do this? Attached is worksheet showing the problem

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

restart;
ode:=diff(y(x),x$2)+y(x) = 0;
DynamicSystems:-DiffEquation(ode,'outputvariable'=[y(x)]);

diff(diff(y(x), x), x)+y(x) = 0

Error, (in DynamicSystems:-DiffEquation) missing output(s): {y(t)}

restart;
ode := diff(y(t),t$2) + y(t) =0;
sys:=DynamicSystems:-DiffEquation(ode,'outputvariable'=[y(t)]);

ode := diff(y(t), t, t)+y(t) = 0

_m2541722345344

Download DS_problem.mw

 

Using t=0 .. 3*Pi the plot is truncated. Changing the 3*Pi to a number, then the full plot shows.

Also keeping 3*Pi but changing y=-1..1 to y=-1.01 .. 1.01 now the full plot shows again.

Is the above normal behaviour or it it a bug?


 

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

restart;
ode := diff(y(t), t$2) + y(t)=0;
DEtools:-DEplot(ode, y(t), t=0 .. 3*Pi, y=-1 .. 1,[[y(0)=1,D(y)(0)=0]],linecolor=blue);

diff(diff(y(t), t), t)+y(t) = 0

#replacing 3*Pi by a number, then it shows the full plot
restart;
ode := diff(y(t), t$2) + y(t)=0;
DEtools:-DEplot(ode, y(t), t=0 .. 10, y=-1 .. 1,[[y(0)=1,D(y)(0)=0]],linecolor=blue);

diff(diff(y(t), t), t)+y(t) = 0

#keeping 3*Pi but changing the y range, it now also show the full plot
restart;
ode := diff(y(t), t$2) + y(t)=0;
DEtools:-DEplot(ode, y(t), t=0 .. 3*Pi, y=-1.01 .. 1.01,[[y(0)=1,D(y)(0)=0]],linecolor=blue);

diff(diff(y(t), t), t)+y(t) = 0

 


 

Download strange_result_of_DEplot.mw

 

I want to collect up the equation terms by the numerical value of the terms coefficient? Have tried sort collect combine...
So far the best I have come up with is nops(indets(on each term). And put them in seperate lists. This still doesn't quiet do the trick.
I am looking to achieve. Would to happy to have then as seperate lists or equations.

(a_1^5+a_2^5...)+5(a_1^4a_2+a_1^4a_3....)+10(a_1^3a_2^2 ....)+20(  ....   )+......+60(a_1^2a_2a_3a_4+ a_1a_2^2a_3a_4....)


 

restart

pn := (a[1]+a[2]+a[3]+a[4])^5

(a[1]+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2]+5*a[1]^4*a[3]+5*a[1]^4*a[4]+10*a[1]^3*a[2]^2+20*a[1]^3*a[2]*a[3]+20*a[1]^3*a[2]*a[4]+10*a[1]^3*a[3]^2+20*a[1]^3*a[3]*a[4]+10*a[1]^3*a[4]^2+10*a[1]^2*a[2]^3+30*a[1]^2*a[2]^2*a[3]+30*a[1]^2*a[2]^2*a[4]+30*a[1]^2*a[2]*a[3]^2+60*a[1]^2*a[2]*a[3]*a[4]+30*a[1]^2*a[2]*a[4]^2+10*a[1]^2*a[3]^3+30*a[1]^2*a[3]^2*a[4]+30*a[1]^2*a[3]*a[4]^2+10*a[1]^2*a[4]^3+5*a[1]*a[2]^4+20*a[1]*a[2]^3*a[3]+20*a[1]*a[2]^3*a[4]+30*a[1]*a[2]^2*a[3]^2+60*a[1]*a[2]^2*a[3]*a[4]+30*a[1]*a[2]^2*a[4]^2+20*a[1]*a[2]*a[3]^3+60*a[1]*a[2]*a[3]^2*a[4]+60*a[1]*a[2]*a[3]*a[4]^2+20*a[1]*a[2]*a[4]^3+5*a[1]*a[3]^4+20*a[1]*a[3]^3*a[4]+30*a[1]*a[3]^2*a[4]^2+20*a[1]*a[3]*a[4]^3+5*a[1]*a[4]^4+a[2]^5+5*a[2]^4*a[3]+5*a[2]^4*a[4]+10*a[2]^3*a[3]^2+20*a[2]^3*a[3]*a[4]+10*a[2]^3*a[4]^2+10*a[2]^2*a[3]^3+30*a[2]^2*a[3]^2*a[4]+30*a[2]^2*a[3]*a[4]^2+10*a[2]^2*a[4]^3+5*a[2]*a[3]^4+20*a[2]*a[3]^3*a[4]+30*a[2]*a[3]^2*a[4]^2+20*a[2]*a[3]*a[4]^3+5*a[2]*a[4]^4+a[3]^5+5*a[3]^4*a[4]+10*a[3]^3*a[4]^2+10*a[3]^2*a[4]^3+5*a[3]*a[4]^4+a[4]^5

L1 := []; L2 := []; L3 := []; L4 := []; for i to nops(els) do if nops(indets(els[i])) = 1 then L1 := [op(L1), els[i]] elif nops(indets(els[i])) = 2 then L2 := [op(L2), els[i]] elif nops(indets(els[i])) = 3 then L3 := [op(L3), els[i]] else L4 := [op(L4), els[i]] end if end do; L1; L2; L3; L4

[60*a[1]*a[2]*a[3]*a[4]^2, 60*a[1]*a[2]*a[3]^2*a[4], 60*a[1]*a[2]^2*a[3]*a[4], 60*a[1]^2*a[2]*a[3]*a[4]]

indets(els[7])

{a[1], a[4]}

NULL

indets(els(5))

{}

`~`[op](1 .. -1, L2)

[5, a[1], a[2]^4, 5, a[1], a[3]^4, 5, a[1], a[4]^4, 10, a[1]^2, a[2]^3, 10, a[1]^2, a[3]^3, 10, a[1]^2, a[4]^3, 10, a[1]^3, a[2]^2, 10, a[1]^3, a[3]^2, 10, a[1]^3, a[4]^2, 5, a[1]^4, a[2], 5, a[1]^4, a[3], 5, a[1]^4, a[4], 5, a[2], a[3]^4, 5, a[2], a[4]^4, 10, a[2]^2, a[3]^3, 10, a[2]^2, a[4]^3, 10, a[2]^3, a[3]^2, 10, a[2]^3, a[4]^2, 5, a[2]^4, a[3], 5, a[2]^4, a[4], 5, a[3], a[4]^4, 10, a[3]^2, a[4]^3, 10, a[3]^3, a[4]^2, 5, a[3]^4, a[4]]

NULL

op(2, L2[1])

a[1]

op(3, L2[1])

a[2]^4``

Download 30-7-22_Q_sort_equation_by_numerical_coeffs.mw

 

Dear All,

I have a question about "fraddiff" command to compute the fractional derivative of a function.
I need to produce  a procedure to manually compute Caputo fractional derivative of a function, instead of using "fracdiff", as the following:

Frac_C:=proc()
description "Frac_C(function,lower bound, variable (upper bound), order of differentiation)";
a:=args[2];
x:=args[3];
alpha:=args[4];
f:=unapply(args[1],args[3]);
m:=ceil(alpha);
return 1/GAMMA(m-alpha)*int((x-tau)^(m-alpha-1)*diff(f(tau),tau$m),tau=a..x);
end proc;

when I call the above procedure, as Frac_C(x^(3.4),0,x,3/4), Maple is not able to calculate the integral defined in the Caputo fractional derivative. However, I saw the pre-defined Maple command, namely fracdiff, is able to do.
Where is the trouble?
can anyone help me?

It is worth mentioning that I can calculate the fractional derivative of a functional by procedure "Frac_C()" when I try to use it at the given x as the following which is not desirable for me.
evalf(subs(x=2,Frac_C(x^(3.4),0,x,3/4)));
evalf(subs(x=2,fracdiff(x^(3.4),x,3/4)));

Best wishes

Download a.mw

The question is in the picture.

y(x) is the result of the last calculation. How do I apply diff to the last result?

Thanks!

Given two terms in expression of type  `+` where the first is rational and the second is not, I wanted to combine both under on common denominator to obtain one term (not `+` any more).

I expected that combine will do that.

restart;
expr:=A/B+C;
combine(expr);

But the above leaves the original expression as is. Ofcourse I can just do

numer(expr)/denom(expr);

Here is screen shot

My question is why combine does not do that automatically? For reference, Mathematica command Together is the equivalent to Maple combine and this is what it does

Which is what one would expect to happen. 

I am just trying to understand the logic why Maple's combine did not work as one would expect. That is all. I looked at help and tried different option to combine, but non worked.

Is there  a specific type name for vectors in Physics[Vectors]?  Specifically, Let's say we want to write a proc whose argument is expected to be a (Physics) Vector, as in  these (trivial) demos:

with(Physics[Vectors]);

f := proc(a_::???)
    return a_ . a_;
end proc:

g := proc(a_::???, b_::???)
    return a_ &x b_;
end proc:

What do we put in place of "???".

First 30 31 32 33 34 35 36 Page 32 of 39