Maple 2023 Questions and Posts

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

The attached worksheet shows that Maple 2023 produces an incomplete plot of a function.  Maple 2021, however, produces the full graph.  I wonder if Maple 2023's behavior is due to a bad setting in my environment or a plotting bug in Maple.

restart;

kernelopts(version);

`Maple 2023.2, X86 64 LINUX, Oct 25 2023, Build ID 1753458`

y := -cos(sqrt(x))*x^3/(-x^2 + 24*cos(sqrt(x)) + 12*x - 24);

-cos(x^(1/2))*x^3/(-x^2+24*cos(x^(1/2))+12*x-24)

plot(y, x=0..1);

Here is the graph of the same function plotted correctly in Maple 2021:

Download cannot-plot.mw

As I am new to using the statistics package, I have some doubts about how to perform certain operations in Maple.

For example, let sigma be a variable containing any real number, finding the average is easy, just use the command A0:=Median(sigma) and if you want A (see image below) just take A1:=A0^2. However, the terms that make up <sigma^2> cause a certain difficulty, how to do this? In other words, calculate the B of the image?

sigma := [2, 4, 0, 6]

AMedia := (2 + 4 + 0 + 6)/4;
AMedia1 := AMedia^2;

 

A0 := Median(sigma)

A1 := A0^2

BMedia := (2^2 + 4^2 + 0^2 + 6^2)/4

sigma0 := sigma^2

sigma1 := Mean(sigma0)

.......................................................................................

hi every one.

in the attached maple file at line x=o in the plotted figure we have some inconsistency in starting the branches from x=0 and the branches do not start from the same value on this axis.

I can not find the problem because there are not any differences between phi 1 and phi 2! 

evalf(f1 - f2)= -5* 10 ^-49

h-x_nemodar-e.mw

I thought I was improving my code by adding ::type to all the _self in my OOP code. As this is one main advantage in programming in Maple, which is being able to attach types to all name and variables. Make code more robust.

But it turned out Maple is not very happy now and gives that drearded error

    Error, static procedure ... refers to non-static local or export ... in surrounding scope

Only place I found that adding ::type_name is to _self is allowed, is on the constructor signature.

But in no other method of the object module. local or export method, it does not matter. 

My question is, why is that?

So I went and removed all those _self::type_name and made it just _self to make Maple happy.

I also noticed this happes regardless of having kernelopts('assertlevel'=2): there or not.  Attached  is the worksheet.

Just tryting to understand the logic, that is all. 

This is using Maple 2023.2.1

interface(version)

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

restart;

24100

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

A:=module()

  export module person()
   option object;
   local m_name::string;
   local m_age::integer;
   export ModuleCopy::static:=proc(_self::A:-person,proto::A:-person,name::string,age::integer,$)
          _self:-m_age := age;
          _self:-m_name:=name;
          NULL;
   end proc;
   export name::static:=proc(_self,$) m_name; end proc;
   export age::static:=proc(_self,$) m_age; end proc;
 end module;

export  module young_person()
   option object;
   local m_person::A:-person;
   export ModuleCopy::static:=proc(_self::A:-young_person,proto::A:-young_person,p::A:-person,$)
          _self:-m_person := p;     
          _self:-process_it();    
   end proc;
   local process_it::static:=proc(_self,$)
         print(m_person:-name());
         print(m_person:-age());
   end proc;

   #to fix the problem, check _self::A... to just _self,  then no error!
   export process_it_from_outside::static:=proc(_self::A:-young_person,$)
         print(m_person:-name());
         print(m_person:-age());
   end proc;

end module;

end module;

_m2782933017664

o:=Object(A:-person,"me",99);

module person () local m_name::string, m_age::integer; option object; end module

p:=Object(A:-young_person,o);

 

Error, static procedure `young_person:-process_it_from_outside` refers to non-static local or export `young_person:-m_person::A:-person` in surrounding scope

 


Download why_adding_type_on_self_gives_error.mw

We have just released an update to Maple 2023 to address a couple of issues.

  • We’ve had a few reports of people encountering “Kernel connection has been lost” errors, and this update should fix that problem.
  • We fixed a problem involving entering math (specifically, the right curly bracket, } ) using an international keyboard.

If you are experiencing kernel connection problems or use Maple with an international keyboard, you should install this update.

This update is available through Tools>Check for Updates in Maple, and is also available from the Maple 2023.2.1 download page. MapleSim users can get this update from the MapleSim Check for Updates or from the MapleSim 2023.2.1 download page, where you will also find an update to the MapleSim Ropes and Pulleys Library.

This is probably a real dummy question. Why can I not plot the units in this worksheet? Thanks in advance for your help PlotUnit.mw

I have a pretty ugly nested integral (in my opinion) that I am trying to compute. I thought that I simplified the problem to an easier siutation however during my attempted calculations I am recieving: "Error, (in evalf/int) cannot handle unevaluated name `L` in evalhf

I am unsure where this is coming from, I would assume something in procedure or my attempted use of unapply is incorrect. Any comments are welcome, including those that state I am doing this entirely incorrectly. 

Thanks. 

NestedError.mw

I need to highlight all terms that contain eta, my variable, for example (A0)+(A1)*1/eta+(A2)*1/eta^2+...(An)**1/eta^n and so on in my expression call from P. However, when I select eta through the collect command, maple is unable to carry out the command.

P := expand((cosh(k*eta) + alpha*m*sinh(k*eta)/eta)^3);
P := convert(P, exp);
P := expand(P);
P := collect(P, eta);
P := combine(P);

Once these have are in evidence I need to select the coefficients A0, A1, A2, etc. How to proceed if eta are in the denominator and maple does not work with this possibility? This it'was my tentative

B0 := subs(eta = 0, P);

B1 := coeff(P, eta)

B2 := coeff(P, eta^2)

I actually tested the possibility of  1/eta instead of  eta and it didn't work

I am an ophthalmologist and a novice in programing. I am having a problem obtaining the x-y coordinate equations for each of the fitted Splines.  I can send the raw data and MapleSoft work sheet for which I need the individual spline equations, in x-y coodinates not parametric format and also need to be able to plot the splines on the raw data. I will pay for the service. Can you please obtain the x-y Cartesian equations for each of the fitted Splines and give me a step-wise method for obtaining them?  I am unable to attach the raw data and the worksheet to this email.  Please send me your personal email so that I can send them.

Your assistance is most appreciated. 

With my best,
Ron
Ronald A Schachar MD , PhD
7241 Encelia Drive
La Jolla, CA 92037
Cell: (858) 784-1705
Email: ron@2ras.com

WHen using _self in object, help says

"As of Maple 2021, if the method has a formal parameter named _self, references
to its object's local or exported variables may be written without prefixing them.
That is, _self:-variable may be written as just variable. Maple will
add the self:- prefix internally when the method is simplified."

And the above is true for all static methods inside an object module, except for ModuleCopy which is also static.

It seems ModuleCopy is special. But why?  I am thinking it is because at time this is called, the object itself does not yet exist, but for all other methods, the object by then is fully constructed. But wanted to be sure.

Here is an example

restart;

person := module()
option object;
local  m_name::string;
local  m_age::integer;
export ModuleCopy :: static := proc(_self :: person
                                   , proto :: person, name::string, age::integer,$
                                )
         m_age := age;
         m_name := name;
    end proc;

export name::static:= proc(_self, $);
    RETURN(m_name); #no need to write _self:-m_name;
    end proc;

export age::static:= proc(_self, $);
    RETURN(m_age); #no need to write _self:-m_age;
    end proc;

export set_name::static:= proc(_self, name, $);
    m_name := name;   #no need to write _self:-m_name := name
    NULL;
    end proc;

export process::static:=proc(_self,$)
   print("name is ",m_name," age is ",m_age);
end proc;

end module:

And now


o:=Object(person,"me",10);

Error, static procedure `ModuleCopy` refers to non-static local or export `m_age::integer` in surrounding scope

Changing ModuleCopy to

export ModuleCopy :: static := proc(_self :: person
                                   , proto :: person, name::string, age::integer,$
                                )
         _self:-m_age := age;
         _self:-m_name := name;
    end proc;

Now there is no error. But notice that in all other static methods, I can write  m_name directly without using _self:-m_name;

I looked at help page for ModuleCopy but see no mention of this.

Why ModuleCopy is different?

Maple 2023.2 on windows 10

Can you generate equation numbers for inline equations?

Folks,

What is the simplist Maple code needed to isolate a vector that has two components?  See below:

Vector[column](2, [25.00000000*pi*r/(r^2 + z^2), 25.00000000*pi*z/(r^2 + z^2)])

I want to get the magnitude of this vector which is simply the square root of the sum of the squares of the individual components as shown above.

How do I do that?

Chris

I wish to substitute only the base of the ifactor expression like the following

lst := [24300, 18907875, 151200, 147000]

[24300, 18907875, 151200, 147000]

(1)

map(ifactor, lst)

[``(2)^2*``(3)^5*``(5)^2, ``(3)^2*``(5)^3*``(7)^5, ``(2)^5*``(3)^3*``(5)^2*``(7), ``(2)^3*``(3)*``(5)^3*``(7)^2]

(2)

subs(2 = x, %)

[``(x)^x*``(3)^5*``(5)^x, ``(3)^x*``(5)^3*``(7)^5, ``(x)^5*``(3)^3*``(5)^x*``(7), ``(x)^3*``(3)*``(5)^3*``(7)^x]

(3)

I wish my results to be

[x^2*3^5*5^2, 3^2*5^3*7^5, 7*x^5*3^3*5^2, 3*x^3*5^3*7^2]

[6075*x^2, 18907875, 4725*x^5, 18375*x^3]

(4)

such that

subs(x = 2, %)

[24300, 18907875, 151200, 147000]

(5)

evalb(% = lst)

true

(6)

NULL

Download SubsExample.mw

If there a way to do that? I understand that there is a command ifactors which gives me more control, but the form of the result is rather inconvenient. I hope there is a more direct way to do the aforementioned operation.

In Maple 2023 I haven't been able to sign in to the Maple Cloud.
In Maple 2022 there was no problem. In fact in my Maple 2022.2 I'm actually signed in right now.

I need this to get updates to the Physics updates. 
The toolbar in 2023.2 has a grayed out icon saying "Sign in". Nothing happens if I click on it.

PS. I'm also signed in right now to Maple 2021.2. So the problem couldn't be that I cannot be logged in to more than one Maple release.

According to the documentation of MmaTranslator:-Mma:-PolynomialReduce, this command yields . However, 

restart;
MmaTranslator:-Mma:-PolynomialReduce(x**2+y**2,{x-y,y+a});
 = 
                       [         2    2]
                       [[0, 0], x  + y ]

In[1]:= PolynomialReduce[x^2+y^2,{x-y,y+a}](*Mathematica*)

Out[1]= {{x + y, -2 a + 2 y}, 2 a^2}

In SymPy and in MuPAD: 

The output of both is the same as that of Mma; only the result given by Maple is inconsistent with Mathematica's. 

The example above is so simple that the desired result can be found simply by hand. Here is a larger example: 
Given two polynomials .txt and .txt, as well as a list of polynomials .txt, I would like to evaluate 

# Suppose that one has downloaded these three files. 
poly1, poly2 := fscanf("poly1.txt", "%a")[], fscanf("poly2.txt", "%a")[]:
pList := MmaTranslator:-Mma:-ReadList("pList.txt"):
MmaTranslator:-Mma:-PolynomialReduce((a - poly1)*(a - poly2), pList);

 But its result is just “[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ]”, while when a=0 it should be “[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 1, 0, 0, 0, 1, 2, 1, 0, 2, 2, 3, 1, 1, 1, 2, 1, 0, 0, 0, 1, 1, 2, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], 0]”.
So why does  return a distinct value?

First 8 9 10 11 12 13 14 Last Page 10 of 29