Maple 2022 Questions and Posts

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

I would like to insert a hyperling to a geogebra document but the hyperlink box deosn't appear to allow general files. Can this be done?

This is a much simplified version of a problem I am seeing. I think I have to remove all the coerce code I added as it seems to have problems.

Made an object with constructor that take an optional argument. These optional arguments use coerce to convert different types on one type of list.

I have another proc foo() that is called with these arguments, also same optional ones, and it then creates the object passing these arguments to it. 

The problem is that if foo() is called with an optional argument itself, which will default to empty list [], I am not able to create the object now, when doing  ':-ic'=ic  since debugger gives 

Error, invalid input: too many and/or wrong type of arguments passed to ModuleCopy; first unused argument is [] = []

Even though I made sure to pass the optional argument using  ':-name'=value.

The strange thing is that this only shows in the debugger. i.e. when typing the command in the debugger window. But in my application, it does not work inside the debugger and outside since it is much more complicated setup.  This is the simplest example I could make to show the same error in the debugger.

A small example will show the problem.

restart;
A:=module()
   option object;
   export ode;
   export ic;

   export ModuleCopy::static:=proc(_self, proto::A, ode::`=`,
                    { ic::coerce( (ic::list(`=`))->ic, 
                                  (ic::set(`=`))->[ic[]],
                                  `:-NoUserValue`):=[]
                    },$)
        print("ode=",ode);
        print("ic=",ic);
    end proc;
end module;

foo:=proc(ode::`=`,{ ic::coerce( (ic::list(`=`))->ic, 
                     (ic::set(`=`))->convert(ic,list),
                     `:-NoUserValue`):=[]
                    },$)
    local o;
    DEBUG();
    o:=Object(A,ode,':-ic'=ic);
end proc:

# and now

foo(diff(y(x),x)=1)

Now the debugger window shows at the line above just before calling the object constructor. This is what happens next

 

But if I click continue it does not produce an error and actually works. (in my main application, with similar setup, it gives an exception).

If I can figure why debugger gives this error, may be that will help me figure my more complicated setup.  I know if I do not use coerce, the debugger error goes away. Here is a version without coerce, and it works

restart;
A:=module()
   option object;
   export ode,ic;
   export ModuleCopy::static:=proc(_self, proto::A, ode::`=`, { ic::list(`=`):=[] })
        print("ode=",ode);
        print("ic=",ic);
    end proc;
end module;
                  A := Object<<2457889631168>>

foo:=proc(ode::`=`, { ic::list(`=`):=[]})
    local o;
    DEBUG();
    o:=Object(A,ode,':-ic'=ic);
end proc:

#now do
foo(diff(y(x),x)=1)

Now the debugger window comes up, but now see the difference:

 

No error!  even though  `ic` was [] in this case also, like the first example.

So for now, I will remove all the coerce code just to get my application to work again even though I like it, but it seems to cause a problem.

question: What the first example above given an error in the debugger?  

Notice this error only shows up when using a module of type object

Update

This is just to confirm that removing the coerce API and replacing it back as it was with traditional optional arguments as in the second example above the exception went away.  My code is way too large to post here, but that is the only difference I have.  I think there is a problem using coerce with Object constructor calling somewhere.  But I am OK now, and able to continue work.

I have a long description that contains some Maple commands.
I dont want to use # as the lines dont show up when i use

Isee:=proc(a)
    interface(verboseproc = 3);
    printf("%P", eval(a));
end proc

The long description is. Any way around the problem?  

Test:=proc(A,B,C)  description  "Computes projective line through 2 projective points or intersert of 2 projective lines as a projective point or coincidence of piont  line   
 Does some checking on validity of inputs.   
Mobposn:- Global Variable, must = 1 or 3. 
Points are returned as <1,x,y> or <x,y,1>   
 Lines are returned as <z,x,y> or <x,y,z>,  
normalgpt :- Global Variable must be 0 or 1. 
Points with algecraic elements are not reduced to <1,x,y> or <x,y,1> if 0  
 Points are defined as row vectors and  lines as column `vectors"`; 

 print(A,B,A-C); 

 end proc;

I need to conver 2D points to projective points. Originally I used lists but now need to handle vectors too. To add to that that the projective coordinate for points is now being stated as [1,x,y] instead of [x,y,1]. That is was easy enough to handle for lists.

I have a lot of old worksheets that use the list form [x,y,1] that I want to maintain compatibility with. I only have one procedure I need to convert.
 

Mobposn := 1;
testP := [2, 7];
if Mobposn = 1 then
    [1, op(testP)];
else
    [op(testP), 1];
end if;

I need to do the same for vector definition of the points. The points are defined as row Vectors

A:=<2,7>^%T

to get

Ap:=<1,2,7>^%T

or

Ap:=<2,7,1>^%T

I know coud just do (as these are short vectors)
 

Ap:=<1,A_1,A_2>^%T

or
Ap:=<A_1,A_2,1>^%T

Is there a more general way?

Hello,

I'm trying to draw the basins of attraction for King's method with f(z) = z^3 - 1 

Thank you in Advance

I have the following expression:

q1:=2.800000000*10^(-30)*a+2.7800000000*10^(-29)*b+2.7800000000*10^(-31)+3.0*10^(-21)+2.*10^(-32)*c+3.*10^(-30)*d;

I saved it as a string, but the format seems to have changed.

q2:=convert(q1,string)

Can I output it as follows:

"2.800000000*10^(-30)*a+2.7800000000*10^(-29)*b+2.7800000000*10^(-31)+3.0*10^(-21)+2.*10^(-32)*c+3.*10^(-30)*d"

Hi

The procedure below work well without using the package LinearAlgebra.

The package conduct to an error.

Thanks for any advice.

restart

with(DocumentTools); with(DocumentTools[Layout]); with(StringTools)

NULL

NULL

NULL

iterration := proc (a, b) local MV, Tlayout; global P; MV := parse(Trim(StringSplit(Split(interface(version), ",")[2], "Maple")[2])); Threads:-Sleep(.2); P := P, plot([[a, b]], style = point); Tlayout := Table(Column(), widthmode = percentage, width = 40, alignment = left, interior = none, Row(Cell(Textfield(InlinePlot(plots:-display(P, title = typeset(Iteration = a))))))); if 2018 < MV then InsertContent(Worksheet(Tlayout)) else InsertContent(Worksheet(Group(Input(Tlayout)))) end if; return  end proc

NULL

NULL

P := NULL

for j to 10 do a := j; b := j^.5; iterration(a, b) end do

Download loop.mwloop.mw

How can I write a decimal number with period in maple? For example, in the following code;

restart;
number := 3.123123123123:
convert(number, rational);

I got 1040 / 333. However if number := 3.123123 then output is 76123 / 24374, so, in order to solve the exercise assign to the variable number a value of 3.123123123123123123123123123... How can I do it in abreviate form?

simplify is a procedure in Maple that have as parameter an assumption ¿Have the assumption a default value? For example, if we consider the following code:

restart;
f:= (x^3 - 27) / (x^2 - 3 * x):
print(f = simplify(f));

The output of that code assume that denominator is not zero, so I think the procedure have a default value for assume parameter.

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):