Unanswered Questions

This page lists MaplePrimes questions that have not yet received an answer

Although I still prefer applyrule (as evalindets/subsindets is not as intuitive as applyrule),  I have heard that it is regarded as being more or less antiquated in modern Maple. I notice that a lot of (yet not all) examples given in the help pages of evalindets/subsindets can be reformulated by applyrule, but does any use of applyrule also correspond to using evalindets/subsindets? And if so, how to equivalently rewrite those transformation rules (especially complicated ones like nested function applications) in the syntax of evalindets/subsindets?

There are things that seem simple but rapidly turn into a nightmare.

Here is an example: what I want is to the expression given at equation (4) in the attached file.

Using Int gives a wrong result.
Using int gives a right one but not of the desired form (some double integrals are nested while others are not).

I've been stuck on this problem for hours, can you please help me to fix it?

TIA

restart

use Statistics in
  # For more generality defina an abstract probability distribution.
  AbstractDistribution := proc(N)
    Distribution(
      PDF = (x -> varphi(seq(x[n], n=1..N)))
    )
  end proc:

  # Define two random variables pf AbstractDistribution type.
  X__1 := RandomVariable(AbstractDistribution(2)):
  X__2 := RandomVariable(AbstractDistribution(2)):

end use;

proc (N) Statistics:-Distribution(Statistics:-PDF = (proc (x) options operator, arrow; varphi(seq(x[n], n = 1 .. N)) end proc)) end proc

 

_R

 

_R0

(1)

F := (U1, U2) -> U1/(U1+U2);
T := mtaylor(F(X__1, X__2), [X__1=1, X__2=1], 2):

proc (U1, U2) options operator, arrow; U1/(U1+U2) end proc

(2)


Error: x[2] is droped out of the double integral in the rightmost term

use IntegrationTools in

J := eval([op(expand(T))], [seq(X__||i=x[i], i=1..2)]);
L := add(
       map(
         j ->  
         if j::numeric then
           j
         else
           (Expand@CollapseNested)(
             Int(
               j * Statistics:-PDF(X__1, x)
               , seq(x[i]=-infinity..+infinity, i=1..2)
             )
           )
         end if
         , J
       )  
     ):
ET := %
end use;

[1/2, (1/4)*x[1], -(1/4)*x[2]]

 

1/2+(1/4)*(Int(x[1]*varphi(x[1], x[2]), [x[1] = -infinity .. infinity, x[2] = -infinity .. infinity]))-(1/4)*x[2]*(Int(varphi(x[1], x[2]), [x[1] = -infinity .. infinity, x[2] = -infinity .. infinity]))

 

1/2+(1/4)*(Int(x[1]*varphi(x[1], x[2]), [x[1] = -infinity .. infinity, x[2] = -infinity .. infinity]))-(1/4)*x[2]*(Int(varphi(x[1], x[2]), [x[1] = -infinity .. infinity, x[2] = -infinity .. infinity]))

(3)


I want this

'ET' = 1/2
       +
       (1/4)*(Int(Int(x[1]*varphi(x[1], x[2]), x[1] = -infinity .. infinity), x[2] = -infinity .. infinity))
       -(1/4)*(Int(Int(x[2]*varphi(x[1], x[2]), x[1] = -infinity .. infinity), x[2] = -infinity .. infinity))

ET = 1/2+(1/4)*(Int(Int(x[1]*varphi(x[1], x[2]), x[1] = -infinity .. infinity), x[2] = -infinity .. infinity))-(1/4)*(Int(Int(x[2]*varphi(x[1], x[2]), x[1] = -infinity .. infinity), x[2] = -infinity .. infinity))

(4)


With int instead of Int one integral is double the other is double-nested

L := add(
       map(
         j ->  
         if j::numeric then
           j
         else
             int(
               j * Statistics:-PDF(X__1, x)
               , seq(x[i]=-infinity..+infinity, i=1..2)
             )
         end if
         , J
       )  
     ):
ET := %

1/2+int(int((1/4)*x[1]*varphi(x[1], x[2]), x[1] = -infinity .. infinity), x[2] = -infinity .. infinity)+int(-(1/4)*x[2]*(int(varphi(x[1], x[2]), x[1] = -infinity .. infinity)), x[2] = -infinity .. infinity)

(5)


As the expression of ET is now correct, I tried to use IntegrationTools to get the
form I want (equation (4)).

But as soon as I replace int by Int x[2] is again droped out.

So it's not even worth thinking about using CollapseNested!

 

use IntegrationTools in
  eval(ET, int=Int);  
end use;

1/2+Int(Int((1/4)*x[1]*varphi(x[1], x[2]), x[1] = -infinity .. infinity), x[2] = -infinity .. infinity)+Int(-(1/4)*x[2]*(Int(varphi(x[1], x[2]), x[1] = -infinity .. infinity)), x[2] = -infinity .. infinity)

(6)

 

Download Int_int.mw

Hi,

is there fix for the following quirk in the Maple 2023 editor:

randomly (hours, days) some characters change their appearance like p.e. the = sign becomes d-bold or sigma becomes s-bold. I have never experienced this in previous versions.

Thanks in advance.

I would like to take advantage from the powerful command "SSTransformation" of the DynamicSystems package to reuse the corresponding output.

For example, if we use the following shape:

         > SSTransformation( Amat, Bmat, Cmat, Dmat, form = ModalCanon, output=['A','B','C','D','T'] );

How to do to assign names to the outputs A,B,C,D and T to subsequently reuse them?

is it possible to find why Maple fails to solve these two equations in two unknowns? Has this always been the case? I do not have older versions of Maple to check. The trace shows that it found solution but then itg says no solution was found. This is very strange.

17020

interface(version)

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

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1622. The version installed in this computer is 1618 created 2023, November 29, 17:28 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2023\Physics Updates\lib\`

restart;

17020

sol:=1/4*exp(-t) * (c2*(-1+exp(4*t)) + c1*(3+exp(4*t))):
expand(simplify(sol));

-(1/4)*c2/exp(t)+(1/4)*(exp(t))^3*c2+(3/4)*c1/exp(t)+(1/4)*(exp(t))^3*c1

eq1:=-3=eval(sol,t=4):
expand(simplify(eq1));

-3 = (1/4)*c1*exp(12)+(1/4)*c2*exp(12)+(3/4)*exp(-4)*c1-(1/4)*exp(-4)*c2

eq1:=-17=eval(diff(sol,t),t=4);
expand(simplify(eq1));

-17 = -(1/4)*exp(-4)*(c2*(-1+exp(16))+c1*(3+exp(16)))+(1/4)*exp(-4)*(4*c2*exp(16)+4*c1*exp(16))

-17 = (1/4)*exp(-4)*c2+(3/4)*c2*exp(12)-(3/4)*exp(-4)*c1+(3/4)*c1*exp(12)

infolevel[solve]:=5;
solve([eq1,eq2],[c1,c2])

5

Main: Entering solver with 2 equations in 2 variables

Main: attempting to solve as a linear system

Linear: solving 2 linear equations

Algebraic: # equations is: 2

Main: Linear solver successful. Exiting solver returning 1 solution

solve: Warning: no solutions found

[]

Download unable_to_solve_2_equations_dec_26_2023.mw

For reference this is the solution given by Mathematica

 

Please help to plot this equation 

fwf-v.mw

Greetings! I need a maple code of logarithm of residuals for graphical comparison of iterative methods. Can anyone help me out by sharing a code comparing log of residuals of 2 or 3 iterative methods? 

I have this image on a vase and I want to flatten it using Maple to see how it would look on a flat piece of paper.  How can we go about it. 

The image is attached.

Image1-Greek.zip

I am trying to decompose an isprime into sum of 2 squares.
Can you tell me why yhse procedure are not goog.
                       

Sumof2Squares:= proc(p::And(prime, satisfies(p-> irem(p,4)=1)))
local x, y:= 1;
   x:= mods(Roots(x^2+y^2), p)[2,1];
   while x^2+y^2 > p do
      (x,y):= FermatDescent(x,y,p)
   end do;
   (x,y)
end proc:

FermatDescent:= proc(x::posint, y::posint, p::posint)
local 
   m:= (x^2+y^2)/p,
   a:= mods(x,m),  
   b:= mods(y,m);

   (abs((a*x+b*y)/m), abs((a*y-b*x)/m))
end proc:
   
trace(FermatDescent);

Sumof2Squares(1973);
Thank you.

How to solve this type of ode in maple

need the value of S, Q, E

When there are print commands in a loop their content is printed as soon as this command is executed.
This is not the case with printf whose displays are delayed (buffered?).
Is there a way to force the display of printf when the command is executed?

TIA

Motivation: I want to display intermediate execution times in a prettier way than print offers.

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

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

5 6 7 8 9 10 11 Last Page 7 of 334