Items tagged with package package Tagged Items Feed

I'm using MAPLE files, and a little to bored to run all commands in it.

Instead of it would be a bit easier to make a package.

Is there any post here how can I do it?

Hello everybody,

I will start a course in mastering QM in a MOOC format (Massive Open Online Course).  Up to now, I always do the calculation by hand and sometimes with the LinearAlgebra package.  But now I need to do the calculation more rapidly.  So I decided to learn how to use this package for this course.

 

The help system give a too generalized way to do it.  Even by looking the example, I didn't find praticle example to it.  So is there a generous person who could take a little bit of hi time to show me how to do it by using an exemple that yo will find attach to this post.

 

Thank you in advance for your trouble.

Besgt regards.

quantum_mechanics_DIRAC.mw

 

--------------------------------------
Mario Lemelin
Maple 18.2 Win 7 and Ubuntu 14.04 - 64 bits
MapleSim 7 Win 7 and Ubuntu 14.04 - 64 bits messagerie : mario.lemelin@cgocable.ca téléphone :  (819) 376-0987

Joe Riel,

I am interested in making some adjustments to the Syrup package to help tailor it to my needs (expanded error descriptions, variable partial differentiations, and others).   A little over a year ago I had some dialog about how to make Syrup changes, but the program I was working on at the time, cancelled the Maple effort...

I need guidance on (1) how the Maple code is structured so I may explore modest changes, (2) what suggestion do you have on the easiest/smartest code development environment, (3) how to compile the changed code, then (4) how to rerun the revised Syrup.

Thank you and happy holidays.
Jeff Belue

Update:

thanks for the answers below, I can now get listing of content of an .mla like this:

restart;
with(LibraryTools):
LibLocation:=cat(kernelopts(mapledir),"/lib/maple.mla");
ShowContents(LibLocation);

But could not yet find a command that actually lists the standard *.mla libraries that come with Maple. I have to go to C:\Program Files\Maple 18\lib and copy the name of each file with .mla extention in there to get its content. Is there a way to obtain a list of all the .mla files or the standard libraries so that to automate all of this? Otherwise, I'll just copy the names of all the mla files in the above folder and make a list of them manually.

original question:

in Maple, I can do ?packages to get a help page showing list of packages available. But I need a way to do this in code, and obtain result as list or set. Next I'd like to go over each package and also obtain list of all symbols and functions/proc in this package.

For example, once I get list of packages, I'd like to get list of functions in say algcurves package, so I should get ["AbelMap", "algfun_series_sol",.....].  The list can be just strings. That is ok, I am just trying to enumerate all packages and build-in commands and symbols in Maple. May be make a small report of it for documentation purposes and to get better idea what is in Maple.

What are the commands I need to get such lists?

I am using Maple 18.02 on windows.

 

Mytest:=module()
    option package;
    
    export
        mymain
        ;
        
        
    # local a,b,c;

    uses LinearAlgebra;
    
    interface(rtablesize=infinity);
    
    
    mymain:=proc(n::integer)

        local ans;
        
        ans:=Vector(n);

        return ans;

    end proc;

end module;

Here is a short piece of code to create a Maple package. It runs fine. Is that possible to hide the code from print() ?

 

with(Mytest);

print(mymain); # which displays the source code

 

Could I hide some of the code? Say I want to use the function mymain() for debugging purpose, but I dont want to make it local to the package. Instead I keep it in "export", but I dont want users to see its code.

 

Thanks!

@ecterrab 

I figured I'd start a new thread for odd things I come across whilst using the new physics package. 

I have found this, and am not sure if it is expected. 

 


restart

with(Physics):

Setup(mathematicalnotation = true):

``

Setup(Commutator(Psigma[i], Psigma[j]) = Physics:-`*`(Physics:-`*`(I, ep_[i, j, k]), Psigma[k]), AntiCommutator(Psigma[i], Psigma[j]) = Physics:-`*`(2, kd_[i, j]));

[algebrarules = {%AntiCommutator(Physics:-Psigma[i], Physics:-Psigma[j]) = 2*Physics:-KroneckerDelta[i, j], %Commutator(Physics:-Psigma[i], Physics:-Psigma[j]) = I*Physics:-LeviCivita[i, j, k]*Physics:-Psigma[k]}]

(1)

NULL

Psigma[1].Psigma[1]

Physics:-Psigma[1]^2

(2)

Simplify(%)

Physics:-Psigma[1]^2

(3)

Simplify(Physics:-Psigma[1]^2)

1

(4)

``


Download Simplify2.mw

I have to calculate the data in JSON format and export the result back to JSON.

It would be greate if there is any JSON package for Maple.
---

Also, I use`ExportMatrix` to export the result to CSV format.

But there are some comma (`,`) in the result content and `ExportMatrix` does not handle it well.
Is there any solution for export data to CSV file in my situation?

Thanks.

 

I am Maple 15 student edition user and the packages is not loaded when I use the execute all command from the GUI. I have to manually press the enter key to have by package loaded before I use a function defined in the package. How can I work around this issue?

Thanks

P.S: You can see the Maple document attached to this post.

NumericalSimulation.mw

Hello all of you,

I'm new here and I have a problem.

For homework I have to write a Maple package for the usage of dual quaternions. This is not a problem.

For example two functions of the package:

MyQuaternions := module()

  export Pretty, Ugly:
  local l1:
  option package:
 
  protect('i,j,k,epsilon'):
 
Pretty := proc(q::Vector)
  description "":
  return LinearAlgebra[Transpose](q)[1..4].Vector([1,i,j,k])+epsilon*(LinearAlgebra[Transpose](q)[5..8].Vector([1,i,j,k])):
end proc:

Ugly := proc(q)
  description "":
  local a;
  a := Vector(8);
  a[1]:=remove(has,remove(has,q,epsilon),{i,j,k});
  a[2]:=coeff(remove(has,q,epsilon),i,1);
  a[3]:=coeff(remove(has,q,epsilon),j,1);
  a[4]:=coeff(remove(has,q,epsilon),k,1);
  a[5]:=remove(has,coeff(q,epsilon),{i,j,k});
  a[6]:=coeff(coeff(q,epsilon),i,1);
  a[7]:=coeff(coeff(q,epsilon),j,1);
  a[8]:=coeff(coeff(q,epsilon),k,1);
  return a:
end proc:

end module:

savelib('MyQuaternions'):

 

Now I can load the module in a differnet maple worksheet "main.mw" by typing "with(MyQuaternions):"

The crucial thing now is the following: i,j,k,epsilon should be protected in "main.mw". I can do this by typing "protect('i,j,k,epsilon'):" Is there a way to tell maple to protect these variables automatically when the module is loaded? Or do I always have to type in the protect command by hand?

Thank you,

Josef

Hi all,

I created a package and saved it already. I checked and found it at D:/CaoHoc/LuanVan/Code/workspace/HINHHOC9.m but when I load it using with command, it has error.

[.............Code to create package..............]

>url := currentdir();
                   url := "D:\CaoHoc\LuanVan\Code\workspace"

>
>save HINHHOC9, cat(url, "/HINHHOC9.m");
>
>libname := libname, url;
libname := "C:\Program Files\Maple 18\lib",

    "D:\CaoHoc\LuanVan\Code\workspace\LuanVan\binaries",

    "C:\Program Files\Maple 18\lib", "D:\CaoHoc\LuanVan\Code\workspace"

>
>         with(HINHHOC9);
Error, (in with) user level initialization for package `HINHHOC9' failed: file
or directory does not exist

Please help me to identify the problem. Thanks

Hi all,

I have a problem when creating package by using 'read' function to concatenate package's elements

Case1: Create package normally, Proc1 and Proc2 are exported

restart;
###################################
# Define package Test contains 2 proc: Proc1 and Proc2
##################################
Test := module()
    option package;
    export Proc1, Proc2;

    Proc1 := proc()
        description "Proc1() is an element of package Test";
        printf("In Proc1\n");
    end proc;
    Proc2 := proc()
        description "Proc2 is an element of package Test";
        printf("In Proc2\n");
        Proc1();
    end proc;
end module;

#################################
# Try to call Proc1 from Proc2
#################################
Test:-Proc2();

Console output:

> Test:-Proc2();
In Proc2
In Proc1

==> The result looks OK

 

Case2: Split Proc1 into another file and include it into master file by using 'read' function, Proc1 and Proc2 are exported

restart;
###################################
# Define package Test contains 2 proc: Proc1 and Proc2
##################################
Test:= module()
    option package;
    export Proc1, Proc2;

    ###########################
    # Code to concatenate "Proc1.maple" here
    ###########################

    read "Test/Proc1.maple";

    Proc2 := proc()
        description "Proc2 is an element of package Test1";
        printf("In Proc2\n");
        Proc1();
    end proc;


end module;


#################################
# Try to call Proc1 from Proc2
#################################
Test:-Proc2();

Console output:

> Test:-Proc2();
In Proc2
                                    Proc1()

==> The Proc1 seem does not execute or evaluate

 

Case3: Split Proc1 into another file and include it into master file by using 'read' function, just export Proc2, not export Proc1

restart;

###################################
# Define package Test contains 2 proc: Proc1 and Proc2
##################################
Test:= module()
    option package;
    export Proc2;

    ###########################
    # Code to concatenate "Proc1.maple" here
    ###########################

    read "Test/Proc1.maple";

    Proc2 := proc()
        description "Proc2 is an element of package Test1";
        printf("In Proc2\n");
        Proc1();
    end proc;


end module;


#################################
# Try to call Proc1 from Proc2
#################################
Test:-Proc1();

Console output:

> Test:-Proc2();
In Proc2

In Proc1

==> The result looks good

 

Please help to explain the problem from case 2 and case 3. If I want to split package proc into many files, how can I do?

 

In Maple, I seem to keep finding commands in different Maple build-in packages that does the same thing. Which is very confusing for someone trying to learn Maple.

Maple seems to have good things in it, but at the same time, it strikes me as a large bag with lots of tools and commands thrown in with little sense of coherence. One needs one command from one package to finish the job started using a command from a different package, and an option from one place to patch something done with a command from another package.

Here is one example. I wanted to obtain the diagonal of a matrix. So far, I found 3 commands that do the same exact thing:

A:=Matrix([ [1,2,3],[4,5,6],[7,8,9]]);
MTM:-diag(A);  #1
LinearAlgebra:-Diagonal(A);  #2
Student:-LinearAlgebra:-Diagonal(A);  #3

I am sure if continue to look, I might find another command to do the same thing hiding in some other package.

The problem for new user like me, is how does one decide which comand to use. This is the same as with constructing a Matrix. There is the Matrix([[]]) notation and metod, and there is the <<>> notation that does the same thing but with different and conflicting syntax.

Having many commands that do duplicate things is not a good thing at all. Commands should be axiomatic and orthogonal to each others. I think there should be a document that describes from a high level all these packages, may be as a block diagram with arrows that show the relation, if any, between them, and how they interact and when to use one vs. the other.

Is there a reason for this duplication of functionality? Does any one at Maplesoft look at such issues?

 

I do not like to load a package using with() and then use its commands and functions, since I then lose track knowing from which package a function or command being used in the code came from when I look at the code later on. So I like to write

pkg:-f() or pkg[f]() instead of with(pkg); f()

This seems to work most of the time, except I just found a case where I am forced to do with(pkg) at the top. Here is the example. I'd like to know if there is a workaround where I can avoid with(pkg) in this case as well:

restart;
f:=t->piecewise(t<0,0,t>=0 and t<z,t,t>z,z):
r:=convert(f(t),Heaviside):
r:=inttrans[laplace](r,t,s);


Now since Maple does not know what z is, it could not fully evaluate the result above (I can handle this with assumptions, but this is just an example). So now I replaced z by 0.5, but since laplace is not loaded, it still could not do it:

r:=subs(z=0.5,r);

So now I had to load the package, just to simply the above expression:

with(inttrans);
r;

This all becuase the expression earlier was left with only "laplace" in it, and not "inttrans[laplace]" as I typed. (why this happend, I do not know).

My question is: How would you do the above, without loading the package? I really do not like loading packages as I said, and like to keep the name of the package attached to each function to help me know where each function is coming from.

 

I've been using a maple package (written by another author) on earlier versions of Maple.  Recently I have been trying to rewrite it so it's a bit more Maple 16+ friendly (since I've read that Maple is not forward-compatible). However, I have been experiencing similar strange behavior in both the original and my current version: 

After saving the module to my personal library, I load with(MyPackage). Most functions work fine (all but a handful out of dozens).  However, some functions won't be recognized (e.g., Coproduct(...) will return itself Coproduct(...)).  

HOWEVER, when I execute the code in the module in its own Maple worksheet, all functions are recognized and work perfectly.  I look at the difference in the code between the functions that work upon loading the package (using with(MyPackage) command in a separate sheet) and those that don't, and there is no difference.

I'm assuming I'll just have to cut and paste the hundreds of lines of code for my package into each sheet I'd like to use it in, since I haven't been able to find others experience this problem in the knowledge base.  I'm hoping someone will be able to help out, however.

Hi Maple users :)

do you know if exists a Maple package in order to perform a Panel method, for instance in the Hess-Smith version, for solving incompressible potential flow over thick 2d and 3d airfoil geometries?

Thank in advance for the help.

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