Maple 2021 Questions and Posts

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

Hello Dear Community

I was by pure coinsidence integrating a simple expression, f(x) = x (x^2 - 1)^5
The correct answer is F(x) = 1/12 (-1 + x^2)^6+ an arbitary Constant and if you expand F(x), you will get

F(x) = x^12/12 - x^10/2 + (5 x^8)/4 - (5 x^6)/3 + (5 x^4)/4 - x^2/2 + 1/12+ an arbitary Constant 

When I do the integration command in Maple2021 for f(x) = x (x^2 - 1)^5 , Maple2021 gives me the output in expanded form
F(x) = x^12/12 - x^10/2 + (5 x^8)/4 - (5 x^6)/3 + (5 x^4)/4 + x^2/2

Maple2021's output is missing the 1/12

I have uploaded my Maple-document regarding this issue to this link something_wrong.mw

Please do check this out and come back with a feedback since I find it disturbing that Maple2021 is giving an incomplete output for an integrating expression that is easy to solve in hand.

~~ Best regards

On my maple page i got also all the time typesetting info ?
Looked at the help page :NumberTheory,PrimeCounting

How to produce the graph of the prime counting function with the two approximations?

How do I write this out in maple?

Sketch the graph of y =x^2+7x+3/x^2 , locate all maximum and minimum values, intervals of increase and decrease, and inflection points.

Thank you!

How do I write this in maple?

Find the point on the parabola x + y 2 = 0 that is closest to the point (0, -3).

Thank you!

Graph the curve with equation y(y2 −1)(y − 2)= x(x −1)(x − 2)
At how many points does the curve have horizontal tangents?

Estimate the x-coordinates of these points.

Find the equations of the tangent lines at the points (0,1) and (0,2)

Find the exact x-coordinates of the points of these points.
Create even more fanciful curves by modifying the equation.

PLEASE WRITE STEP BY STEP IN MAPLE

How to get rid of the boundary

display(ellipse([0, 0], 2, 1, filled=true, color = red),size=[1000,500],axes=none);

or how to make the boundary the same color as the filled region?

 

Good day.

When I export an animated 3D (surface contour) plot to a gif format, the image is incomplete (please see attached file).

Can anyone suggest a way to reformulate the expressions so the animated plot can be exported to Powerpoint intact?

Thanks for reading!

MaplePrimes_Dec_5.mw 

How I can change this to smooth curve

I have not used Array much before. I made an array that has 3 elements, starting index is 0 and last index is 2.

I want each element in the array to be an empty list, so I can later add to it.  (since I do not know in advanced what size of list I need in each slot of the Array).

Array(0..2,[seq([],i=0..2)])

And this works in the code I am using. But the strange thing, each time I try to save the worksheet, I get Warning about saving Large calculation.

What large caclulation? The array is empty?

Even though the code is working, and I can add to each entry in the array lists OK and been using it OK, I think may be I am not doing something right.

How to correctly creat an Array from 0..N  and initialized each entry to empty list?

Maple 2021.2

When doing

item:=x;
res:=remove(has,item,x);

Maple returns, as expected

But when item is not a single symbol, say sin(x) or diff(y(x),x), then it no longer returns ()

item:=diff(y(x),x);
res:=remove(has,item,diff(y(x),x));

It does not return () but it now returns the input itself, as if it was not removed.

Why is that, and how to make it return () also on composite expression?  I tried flatten and inplace option. Otherwise, I will have to do a special test before. 

The strange thing is that it works on 

item:=2*diff(y(x),x);
res:=remove(has,item,diff(y(x),x));

Now it returns as expected. So now it did remove diff(y(x),x). But it does not remove it when it is on its own. I assume this is by design. But it is not intuitive to the user. One would expect it to work same way on removing `x` or `sin(x)` or `diff(y(x),x)`

   Is there a way to export routines from a package. The reason I ask, I was answering a question here and I needed two routines I have, that I put together a couple of years ago in a package. I used showstat copied, pasted and edited. Worked, but not great and would utterly fail with anything complicated. e.g. In the two routines pasted  below SignedArea on line 3 c[1]  is c   [1] that caused a minor problem.  

restart

NULL

"RonanRoutines:-SignedArea := proc(a::{Vector, list}, b::{Vector, list}, c::{Vector, list, null} := null)  local M, A;     1   if c = null then     2       A := 1/2*a[1]*b[2]-1/2*a[2]*b[1]         else     3       A := 1/2*(b[2]-c[2])*a[1]+1/2*(-b[1]+c[1])*a[2]+1/2*c[2]*b[1]-1/2*c               [1]*b[2]         end if;     4   return A  end proc:"

NULLNULL

"RonanRoutines:-CrossingNumber := proc(A::list, B::list, C::list, E::list)  local s1, s2, s3, s4;     1   s1 := RonanRoutines:-SignedArea(A,B,C);     2   s2 := RonanRoutines:-SignedArea(A,B,E);     3   s3 := RonanRoutines:-SignedArea(C,E,B);     4   s4 := RonanRoutines:-SignedArea(C,E,A);     5   if s1 = 0 and s2 = 0 and s3 = 0 and s4 = 0 then     6       'undefined'         elif 0 <= signum(s1) and signum(s2) <= 0 then     7       if 0 <= signum(s3) and signum(s4) <= 0 then     8           -1             end if         elif signum(s1) <= 0 and 0 <= signum(s2) then     9       if signum(s3) <= 0 and 0 <= signum(s4) then    10           1             end if         else    11       0         end if  end proc:  "

NULL

Download Export_from_Package.mw

Can Maple solve an ode by asymptotic expansions methods? series methods (power series or Frobenius series) work only on ordinary expansion point or removable singularity point. For non removable singularity (essential), Maple's dsolve with series method can't solve these. Also, if the RHS of the ode is not analytic at the expansion point, series method do not work. 

The asympt command only applies to algebraic expressions.

Does Maple have something similar to Mathematica's AsymptoticDSolveValue  ?

Here is an example. This is an ode with RHS not analytic (has no Taylor series) at x=0

ode:=diff(y(x),x)+y(x)=1/x;
dsolve(ode,y(x),'series',x=0)

No solution.  While in Mathematica

ode = y'[x] + y[x] == 1/x
AsymptoticDSolveValue[ode, y[x], {x, 0, 6}]

 

Here is another example of ode where the coefficient of y(x) is not analytic at x=0

ode:=diff(y(x),x)+sqrt(x)*y(x)=0;
dsolve(ode,y(x),'series',x=0)

No solution. In Mathematica

ode = y'[x] + Sqrt[x] y[x] == 0
AsymptoticDSolveValue[ode, y[x], {x, 0, 6}]

Does there exist a package in Maple that can do this? Will this functionality be added in Maple in the future if currently there is no support? ( I searched and could not find anything so far).

One possible workaround I found is to solve the ODE using normal methods (non-series), then apply the asympt command on the solution. But one needs to remove the constant of integration first, Here is the above example done this way

ode:=diff(y(x),x)+sqrt(x)*y(x)=0;
sol:=dsolve(ode);
Order:=8;
sol:=eval(sol,_C1=1);
asympt(eval(rhs(sol),x=1/y),y);
eval(%,y=1/x)

Mutliplying the above back by the constant _C1 gives same answer as Mathematica's.

Is the above how one is supposed to do it in Maple? It worked on the above simple example, but need to see if it will work for other examples. it will be better if this was more directly supported. i.e. if asympt will work directly on ode's (or a new command or a new option to dsolve similar to 'series' but call 'asympt').

Maple Object model is somewhat limited.  One of the main reasons to use OOP is to be able to extend base class, and override methods in base class by new methods if needed.

This is described in  https://en.wikipedia.org/wiki/Method_overriding

Method overriding, in object-oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. It allows for a specific type of polymorphism (subtyping). The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.[1] The version of a method that is executed will be determined by the object that is used to invoke it. If an object of a parent class is used to invoke the method, then the version in the parent class will be executed, but if an object of the subclass is used to invoke the method, then the version in the child class will be executed.[2] Some languages allow a programmer to prevent a method from being overridden.

Maple does not allow the extending class to override variables or methods in the base class. Even if the type of the variable or the sigature of the proc is different as long as the name is the same.

This makes it hard to override base class implementation and to do type extension.

Here is a toy example

restart;

 animal:=module()
   option object;
   export data1;

   export move::static:=proc(_self,$)
      print("In Animal class. moving ....");
   end proc;  
end module;
 
#create class/module which extends the above
dog:=module()
   option object(animal);
   export move::static:=proc(_self,$)
      print("In dog class. moving ....");
   end proc;  
end module;

Error, (in dog) export `move` is declared more than onc

All computer languages that supports OOP that I know about supports overriding, The above web page lists some. 

Ada,  C#C++, DelphiEiffel, Java, Kotlin, Python, Ruby

A workaround, is if such name conflict occurs, is to come up with new name. So the above example becomes


dog:=module()
   option object(animal);
   export move_the_dog::static:=proc(_self,$)
      print("In dog class. moving ....");
   end proc;  
end module;

And now Maple does not complain. But the whole point of type extension is to override the base class implementation, and not add a new implementation while keeping the base class one there.

Is there a way to do this in Maple? if not in current version, are there plans to add this to future Maple versions?

This is another one of those problems that shows up only when I put all my modules in a lib and run the program, and unable to make a MWE in the worksheet.

Here is description of the problem. There is a module which is an object, which has no method. Just variables. 

export SUM_type:=module()
   option object;
      
   export starting_index::integer;
   export body;
   export power_on_x;
   export actual_sum;   
end module;

some where inside the program, a list is created of such objects. This problem only shows up when there is ONE object in the list. Where there is 2 or more objects in the list, no problem. The problem shows up here

for tmp in op(THE_SUMS) do    #BUG IN MAPLE  
        new_ode := new_ode + tmp:-actual_sum;
 od; 

The above code is from inside a proc in a module. The variable THE_SUMS is the list and tmp is just a local variable.

In the debugger, once I step in the loop, it generates an exception

The strange thing, this only happens when there is ONE object in the list and not more. Here are screen shot from the debugger window

To avoid this, I changed the loop to the following, and not it works with one or more entries in the list

   for N from 1 to nops(THE_SUMS) do
       tmp := THE_SUMS[N];
       new_ode := new_ode + tmp:-actual_sum;
   od;

And this work. I spend a lot of time trying to make a MWE, but it works ok in worksheet. It looks like a scoping issue. I do not use ModuleIterator, and do not need it. When I added one to the object above just to see what happens, I saw the ModuleItrator being called. I have no idea why Maple wants to call it when there is one object in the list.

Here is one attempt on a MWE. but this gives no error. 

SUM_type:=module()
   option object;
   
   export starting_index::integer;
end module;
o:=Object(SUM_type):
o:-starting_index:=1;
L:=[o]:
for item in L do  #OK here since in global name space?
    print(item);
od;

I am just repoting this in case someone have seen it before. I have a workaround it as I showed, which is to avoid using `for temp in list` when the list has objects in it.

Maple 2021.1 on windows 10

Hi Everyone,

I would like to convert a netlist to a ladder schematic by using Draw (Syrup). So far I have tried combinations of &+ and &// and have not achieved the correct result. Please help.

capnet:= "
V  1 0 1
L  1 2 1
C1 2 3 2uF 
C2 2 4 3uF
C3 4 3 1uF
C4 4 5 1.5uF
C5 3 5 2.5uF
C6 3 0 3.5uF
C7 5 0 0.5uF
.end":

ckt:= [ V(1), L(1), C1(2.8E-6),
         C2(3.E-6),  C3(1.E-6),
         C4(1.5E-6), C5(2.5E-6) &+ C6(3.5E-6)
        ]:
Draw(ckt);

Thanks.

SyrupQuestion.mw

First 19 20 21 22 23 24 25 Last Page 21 of 35