MaplePrimes Questions

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

Hi,

I am looking for an optimal layout of a function's variation table. I know that LaTeX generates this type of table with good formatting quality. Is there a way to integrate it into Maple?

Thanks

I just got an email saying a maple primes moderator deleted my question as 'SPAM'. It was not remotely SPAM but a strraight forward question about how to determine lengths of lines drawn in Maple Sketcher. 

The email tells me and gives me a link to 'contact' but it's not clear which of the many possible contacts listed to use!

Here's the email:

Your MaplePrimes post Length of a line drawn in Sketcher? was deleted by a moderator for the following reason: Spam. If you believe this was done in error, please contact Maplesoft customer service: https://www.maplesoft.com/contact.

I'd like to use Maple to make measurements on a map (Dealey Plaza). I can load an image in Sketcher and draw lines on it, but can't figure out how to access the lengths of those lines.

restart``

estart; with(Physics); with(LinearAlgebra); with(VectorCalculus); with(Optimization); with(Statistics); with(ArrayTools); with(plottools); with(plots); with(Threads); with(MmaTranslator[Mma]), with(StringTools); with(CodeGeneration); VectorCalculus:-`*`(Setup(mathematicalnotation = true), Setup(coordinatesystems = cartesian))

estart

 

[annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, prism, project, rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform, translate]

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x, y, z, t)}

 

`Systems of spacetime Coordinates are:`*{X = (x, y, z, t)}

(1)

``

``

NULL

 

``

``

Download DealeyPlazaToo.mw

Dear all

I have a system of differential equation with initial condition. 
I try to get the exact solution bur unfortunattely dsolve does not return the exact solution of my system 

SSDE.mw

Thank you 

Hi,
I have a function (see attached file).  How can I find by Maple 
those values of beta and f for which W will have 
three consecutive local extrema between the
phi=0 and phi_0 where W=dW/dphi=0 at phi=0 and W=0 at phi_0 and W<0 for 0<abs(phi)<phi_0?
Thanks,
plot.mw

Any smarter assumptions or substitutions I could try out on the left handside of the below

 

If this does not work I would be greatefull for fast numerical evaluation methods. Plotting for example takes to long.


Attached you will find some background on what I want to achieve.

Gaussian_integration.mw

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

Is it possible to solve the following equation with Maple:

Find the smallest positive integers such that

a/(b+c)+b/(a+c)+c/(a+b)=4

The solutions are enormous.

See

https://www.agftutoring.com/x-yz-y-xz-z-xy-4/

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?

Hi every one

I need a command or simple procedure to convert an ODE into a linear polynomial.

For example, let us consider the ode in the attached file. I want to return the poly in this file. draft1.mw

Could you please help me?

1 2 3 4 5 6 7 Last Page 1 of 2281