Maple 2020 Questions and Posts

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

Hi!

I try to figure out how to add »kr« as a currency symbol, and as currency in the Numeric Formatting list.

Can it be done?

Kind regards

This works

restart;
patmatch(3*g(x),A::nonunit(algebraic)*B::function,'la');
la

[A = 3, B = g(x)]

But this fails

restart;
patmatch(3*g(x),conditional(A::nonunit(algebraic)*B::function, true ),'la');

Error, (in PatternMatching:-AlgStruct:-Match) improper op or subscript selector
 

I am not able to see why. In the above I used true for the condition, just to keep things simple. Any boolean valued expression will work.  

changing the above to

restart;
patmatch(3*g(x),conditional(A::anything*B::function, true ),'la');

it works. No error. [A = 3, B = g(x)]

What did I do wrong in the above syntax which generated the error?

Maple 2020.1

 

Could anyone show me the exact command lines or exact steps to install the FGb package, specifically FGb-1.68.x86_64_linux.tar.gz here, to Maple 2020 in Linux Ubuntu? Many thanks.

FYI, here is one of the error messages I got: 

"mv <14539>/*.so <~/maple2020>
bash: syntax error near unexpected token `14539'"


 

``assume(0 < k, k < 1)

int(x^2/sqrt((-x^2+1)(-k^2*x^2+1)), x = 0 .. k)

int(x^2/(-x(-k^2*x^2+1)^2+1)^(1/2), x = 0 .. k)

(1)

sqrt(k^2)

k

(2)

``


 

Download ellipticIntegralTest.mw

Hi everyone, 

I am trying to use elliptic integral from Maple, however, it did not generate any result. Can you help me with that?

let me just explains the big picture first, then give small example.

When using standard modules, I had one module, and number of smaller modules, all private to the main module. This worked well.

Each sub module, can only be accessed from the top module, which is seen by user. The sub modules can't be called by user directly.

Now I changed the main module to become an object (since I want to make more instances of it).

I want to still use the code in those submodules I had, but want to keep them private to the object class, so they can be seen only from inside the object class methods. So they are part of the object class now. But remain as modules. I do not want to copy all those methods in these submodules and put them in the object class directly.

But I can't get the syntax right to do this. I do not want to modify the code inside the sub-modules, but only how to integrate them into the object.

Notice that I can call those external modules fine from the object, but I simply want to make them private to the object class, so they can't be called from outside. 

The question is how to do this? 

Here is a very small example. (in practice, I have these submodules in .mpl files, but here I put them all in the example).

restart;	
module car_class()
      option object;
      local name::string :="UNKNOWN";

      export set_name::static:=proc(o::car_class,_name::string)
        o:-name := _name;
        o:-big_car:-set_name(o,_name);#this call does not work
      end proc;

      #this is module, that I want to be private to this class only
      #eventually, I'd like this module be in separate mpl file also.
      local big_car::static :=module()  #module does not take arguments!

            #this below should be private only to the this module
            #and not seen by the enclosing object.
            local big_car_name::string:="UNKNOWN";  

            #this export to allow parent object to call it
            export set_name::static:=proc(o::car_class,_name::string)
                   o:-big_car:-big_car_name:=_name;
            end proc;

      end module;

end module:

o:=Object(car_class);
o:-set_name(o,"GM");

Error, (in set_name) module `car_class` does not export `big_car`

I found after playing more with it, that this works

I just replaced o:-big_car:-big_car_name:=_name;  with big_car:-big_car_name:=_name; had to remove ::static from definition of proc inside the private module.

restart;	
module car_class()
      option object;
      local name::string :="UNKNOWN";

      export set_name::static:=proc(o::car_class,_name::string)
        o:-name := _name;
        o:-big_car:-set_name(o,_name);
      end proc;

      local big_car::static  :=module() 
          local big_car_name::string:="UNKNOWN";  

          export set_name:=proc(o::car_class,_name::string)
              big_car_name:=_name;
          end proc;

     end module;
end module:

Now it works. However, maple help says "In Maple, method names should be declared as static. "

I would like to factor

factor(98-28*sqrt(7));

which I would like to output 14*(7 - 2*sqrt(7)),

but Maple keeps returning 98 - 28*sqrt(7).

 

If one refers to a name in Maple, I thought it will look at the global context to find it. So when one does latex(....) then this is assumed to be the system latex command. No need to do :-latex()

But if there is local variable in Object class called latex, why then is object:-latex gets confused with global Maple command latex()?  Here is an example

module ode_class()
      option object;
      local latex::strring :="";

      export init::static:=proc(o::ode_class)
        o:-latex:= latex(1/2,output=string);
      end proc;
end module:

my_ode:=Object(ode_class): 

Error, static procedure `ode_class:-init` refers to non-static local or export `ode_class:-latex::strring` in surrounding scope
 

ofcourse easy to fix, I just replace the RHS latex(1/2,output=string);  with :-latex(1/2,output=string); 

But my question why is object:-latex := latex(...)  makes Maple think the latex in the RHS is the variable name in the class, when it does not have the  object:- prefix?  Is this expected  behaviour in Maple? 

But now I am starting to worry that each maple command/function/name used inside the Object needs  :- added to it, just in case of a current or future name conflict with local object variables names.

 

 

in my object, I have few private variables. To make sure the object is correctly initialized between each use, I'd like to initialize these private variables each time at the start of the call each time the object is called to process something.

Some of these variables represent equations, or symbols or functions. Some of these are set by the user of the object, but some are not. And I do not want to leave those that are not set, using old values from last call.

The problem  I can't use {} nor NULL to initialized these private variables, since I am telling Maple they are of type `=` or `symbol` or `function`.

To give a small example, I use a proc here to illustrate, since it the same idea, but less code.

restart;
kernelopts('assertlevel'=2):
foo:=proc(input_ode::`=`)
   local ode::`=`:={};  #i'd like to give this some initial value. But what?
   ode:=input_ode;
end proc;

now foo(diff(y(x),x)=5) gives

Error, (in foo) assertion failed in assignment, expected `=`, got {}
Same type of error happens if I use NULL.

Is there a special value or tag one can use to initialize/reset any variable, regardless of its type? I thought at first that NULL will work, but it is not.

The idea is that I'd like all my object private variable to always have known state when the same object is called each time. ie. to clean it up before the next time is made.

The above is just an example. Ofcourse I could just do this

restart;
kernelopts('assertlevel'=2):
foo:=proc(input_ode::`=`)
   local ode::`=`; #leave it un-initialized since it will be overwritten next
   ode:=input_ode;
end proc;

And now no error. 

I read  help document of :

with(Physics[Vectors]):
(%Nabla)(f(x,y,z))
value(%)

 

But if I want to use Composition function , is it not useful? why? how to do?

(%Nabla@@4)(f(x,y,z));
value(%)

we know that:

(Nabla@@4)(f(x,y,z))

 


 

Error, (in Compiler:-Setup) unable to write to initialization file, C:\Program Files\Maple 2020\bin.X86_64_WINDOWS/launch.ini, possibly due to insufficient permissions
NULL;

when choose bat file

but i see sufficient permission

any w should i s

choose a particular compiler or even visual studio i have in my system

 

where can i find if anything else

My OS is Windows 7 64-bit

I can't install the Physics Updates package in Maple 2020.1 and I'm looking for suggestions from anyone who has managed to do this, particularly on the above OS

Detailed timeline Nad what I have tried so far

  1. A couple of days ago I upgraded to Maple 2020.1
  2. I immediately started getting random warnings in Maple worksheets, which essentially stated that the installed Physics package (version 707) was designed for MAple 2020.0 and needed to be updated. However when I checked for \Physics updates none were available.
  3. So far, not a big problem, I figured the a Physics Update appropriate for Maple 2020.1would become available over the next few days
  4. Today I noticed that Physics Updates version 708 was available, and I made the rash(?) assumption that this would be the version I need for use with Maple 2020.1, so I tried to install it
  5. Using the icon in the top right of the the Maple worksheet in the usual way, I tried to install this update. The relevant pop-up finishes the download process, statrts the installlation process, gets about halfway through then stops along with another pop-up saying that mserver.exe has stopped working. Since the installation process was getting nowhere, I shut down Maple.
  6. Restarting Maple, and executing Physics:-Version(), I get the output `The "Physics Updates" version "708" is installed but is not active. The active version of Physics is within the library C:\\Program Files\\Maple 2020\\lib\\maple.mla, created 2020, March 5, 1:36 hours`. So maybe it did install? No, the "default location" for this package (which on my system is C:\Users\TomLeslie\maple\toolbox) contains a 'Physics Updates' folder, but the only thing in it is a 'version.txt file, which (amongst other things) contains the line cloud-version: 708.
  7. Normallly this 'Physics Updates' folder should contain a 'lib' subfolder, which in turn contains the file 'Physics Updates.maple' - but none of these exist, so I'm not convinced by the statement in (6) above that `The "Physics Updates" version "708" is installed
  8. At this stage I go into debug mode, and amognst other things, I have tried
    1. Repeat the process in (5)-(7) above - same result (including the mserver.exe crash)
    2. Delete the default installation folder C:\Users\TomLeslie\maple\toolbox\Physics Updates, and repeat the process in (5)-(7) above - same result (including the mserver.exe crash)
    3. Try 8.1 and 8.2 above running as administrator - same result
    4. Figure that maybe I have totally screwed my Maple 2020 installation, so reinstalled it, reactivated it, and updated it to 2020.1
    5. Repeated steps 8.1 to 8.3 above with exactly the same result
  9. Decide I am getting nowhere, so delete the folder C:\Users\TomLeslie\maple\toolbox\Physics Updates. The command Physics:-Version(); now returns `The "Physics Updates" package is not installed` so I assume I'm running on the Physics version which actually ships with the Maple 2020 release
  10. All suggestion for getting Physics updates running with Maple 2020.1 on 64-bit Windows 7 will be gratefully received

As I am playing with Maple object to understand it better, I found strange thing.

I have simple object with 2 methods. Both are exported so they could be called from outside.

One method is called set_name and this one is called OK (I have print inside to print it is called). The next exported method is called process and when calling this method, the print never shows up. Which means it is not called. Using the same exact call.

When changing the name from process to something else, say processX now the print show, meaning the method is now called.

Is there restriction on what one can call their object method? And why would there be ?

Here is an example

restart;
module car_class()
      option object;
      local name::string:=""; 

      export process::static := proc(o::car_class)
             print("process method");             
      end proc:   

      export set_name::static := proc(o::car_class,_name::string)
             print("inside set name"); 
             o:-name := _name:
      end proc:     
end module:

my_car:=Object(car_class):  #make object

set_name(my_car,"toyota"):
process(my_car):
set_name(my_car,"toyota"):

On the screen, it only shows 

Now I changed it to 

restart;
module car_class()
      option object;
      local name::string:=""; 

      export processX::static := proc(o::car_class)
             print("process method");             
      end proc:   

      export set_name::static := proc(o::car_class,_name::string)
             print("inside set name"); 
             o:-name := _name:
      end proc:     
end module:

my_car:=Object(car_class):
set_name(my_car,"toyota"):
processX(my_car):
set_name(my_car,"toyota"):

And now on the screen it shows OK

Is there a way a way to be able to freely choose what method names to give to the object method? clearly the name "process"  is something special for Maple here for some reason.

When I do ?process, I see that Maple has some commands that have this name. But this is a name of a method inside Object class, so it should not have anything to do with any Maple own command. 

This was never an issue with module() for an example.  If one has to worry about what name to give to their methods for an object, then this will be very awkward. For example, what if one calls their method FOO and future version of Maple introduce a new command called FOO now the code will no longer work.

 

 

I wanted to create an Array() to store only objects of specific type in it.  

Array() supports the datatype=value  telling it the type of elements to store. But when I try to create an Array() using datatype of the class, it fails. I must be doing something wrong. Here is an example

restart;
module solution_class()
      option object;
      local sol::anything;
end module;
sol:=Object(solution_class); #create an object

Now the following works:

A:=Array();
A(1):=sol;

But I wanted to do

A:=Array(datatype=solution_class);
A(1) := sol;

 Error, unable to store '0' when datatype=module solution_class () local sol::anything; option object; end module
 

Help says 

And this is the case here, because type(sol,solution_class)  gives true

So 'solution_class' is valid type name.

Where is my error?

 

 

Hello,

I try import a big Excel file with the first row as column labels for performing statistical etc.

I use this command :

data := Import(FileTools:-JoinPath(["d:", "directory", "subset2.xlsx"], platform = "windows"))

i need a dataframe for performing statistical with column label as first row, but i have this error :

Error, (in Import) invalid input: MatrixToDataFrame uses a 3rd argument, columns, which is missing

I can not understand what is this error...so, what i can do ?

Thanks, regards

First 46 47 48 49 50 51 52 Page 48 of 55