Items tagged with module module Tagged Items Feed

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.

Sorry if this has been already posted.

 

When print() is invoked from a proc into a module, non-English characters are not properly displayed with Maple 18.

It works ok if it is invoked from within the workbook.

 

Example:
print("Están en perspectiva")

Put this sentence in a proc into a module and the character "á" wont be displayed

Output: "Est�n en perspectiva"

Any hint about how to treat this issue?

Thank you very much.

César Lozada 

 

 

I have a procedure that takes an object, i.e. a module, as an argument. On grounds of the properties of that object, the procedure should return a certain map. But I hit a snag, the gist of which is along the following lines (just an example):

M := module()
   export dim;
   dim := 2;
end module:

F := proc(m::`module`)
   (x::Vector(m:-dim)) -> something
end proc:

My problem is that F(M) produces

rather than

How can I force m:-dim within F to be evaluated?

I wrote the following code inside a code region in order to implement a scalar product for lists:

m:= module() option package; export `*`;
    `*`:= proc( a::list, b::list) option overload;
        return add(i, i  in zip((x, y)-> x*y, a, b));
    end proc;    
end module;
l1:=[1,2,3,4];
l2:=[4,1,0,5];
with(m);
l1*l2;

when i run the code I sometimes get the desired result ->26

but sometimes I get

I don't have any clue, where this weird behaviour comes from.

Any help would be greatly appreciated.

 

Hi everyone

I am currently trying to make my own simple package including a few procedures. So far I have been able to write some "code" that actually works when I open the document and hit "enter". I would, however, like to save the package so it can be accessed during any Maple session using the command "with". I have unsuccesfully tried to comprehend the Maple help pages regarding this question but I definitely don't want to mess things up.

This is what I have written:

mat := module ()
description "useful procedures for mathematics, physics and chemistry";
export AtomicWeight;
option package;

   AtomicWeight := proc (x) description "returns the average atomic mass of the naturally ocurring element";
   Units:-AddSystem(NewSystem, Units:-GetSystem(SI), u);
   return evalf(ScientificConstants:-Element(x, atomicweight, system = NewSystem, units))
   end proc

end module;

What should I do to save it correctly?

Thank in advance,
Mads


 

 

 

 

 

error module is maple.dll_unloaded

 

i have already called stopmaple(kv);

in

testfunction(string hello){....stopmaple(kv));

 

testfunction(1);

testfunction(2);

when call testfunction again , it got error

Looking at the code of PDEtools:-declare, one sees that it does some brief initializing and then passes the job off to `PDEtools/declare`. I'd like to view this latter procedure, but I can't find it. It is not at the top level, nor is it an export or local of module PDEtools. So where is it?

Hi all,

I seem to have triggered a nasty bug in Maple 17.  Consider the following code:

  BlahObject := module()
    option object;
    export BlahMethod := proc()
    local C, d, i;
      add(C[i]*d[i] + C[i], i=1..4);
    return NULL;
    end proc;
  end module;

It triggers a Maple kernel crash for me when doing object construction:

 B := Object(BlahObject);

The offending line is the one with add( ). It is ok if I add C[i]*d[i], but when the line contains both * and + it causes kernel death every time.  This is strange as the proc is not even being executed... only constructing the object. 

I am running Maple 17.02, it's also present in 17.01.  But interestingly, it runs fine in Maple 16.  Bug in Maple 17? 

Thanks,
Ian.

I installed the shared library from http://www.maplesoft.com/applications/view.aspx?SID=1691

and it seems to have loaded ok. Now I can do

with(share);
See ?share and ?share,contents for information about the share library
                               []

When browsing help, I noticed it has a function called IntSolve() for solving linear integral equations. Maple itself has function called intsolve() which is build-in.

Since Maple is case sensitive, I assumed when I type IntSolve() then it will find the shared version of IntSolve() automatically and not call Maple's own intsolve. And that is indeed what happed. I typed an example from the help on share as you can see


 

eq1 := p(x)-1/2*Int(x*y*p(y),y=0....1)=5/6*x;
IntSolve(eq1,p(x));
                             7775  
                             ---- x
                             7776  
intsolve(eq1,p(x));
                            p(x) = x

Ok, So one of them is a little wrong :).

But suppose I want to explicitly add the share library there, in the call, as prefix, so that when I look at the code later, I can see which function I am calling. How should one do this? I tried

share:-IntSolve(eq1,p(x));
    Error, `share` does not evaluate to a module
share[IntSolve](eq1,p(x));

 

The strange thing, is that this worked

IntSolve[IntSolve](eq1,p(x));

Basically, all what I want is to way to add the share name to all the calls somewhere, so I know, when looking at the code, which call is from which library or package.

Any idea how to do this? So to avoid any possible name clash since the share library seems large.

I am using Maple 17.02

Recently I was presented with some code that had a seq command that used i as the index variable. While this code had been used in a number of applicaitons, it was now giving trouble.

seq( i^2, i=1..10 );
Error, illegal use of an object as a name

After a stroke of fortune it was discovered that the problem was that Maple's imaginary unit had been changed from I to i. Given that this change was made, the error message now made sense.

Hi,

Could someone check, what it is wrong?.

I have tried to use fsolve inside module in startup code.

 

I will be appreciated.

 

wzel

test.mw

Hi, I have created over time a module with a number of procedures that are useful for me for certain calculations.

From time to time I am adding new stuff to it. Now I find that the thing has gotten long enough that (a) I need to do a lot of scrolling and (b) I forget where exactly certain procedures are in the file.

So I was trying to put in bookmarks that e.g. could carry the names of procedures, or sections of the whole thing. But Maple refuses to put more...

Maple 16 introduces the ?ModuleIterator method, which can be assigned in a module so that it can be used  in a for-loop, or in the seq, add, and mul procedures.

ModuleIterator should return two procedures.  The first (referred to as hasNext) is a predicate that returns true if the iterator is not finished.  The second (referred to as ...

My mathematics computation relies on a loop.

That loop is heavy and takes very long time to finish.

I try to split some undetermined functions outside the loop so that the work inside the loop will be easier.

I don't know how to use proc or module. Is there any tutorial that can help me as a beginner on this part?

Basically i need maple algorithm that enables user to call a user-defined function from another function.

And also how can...

How do I export a procedure written inside the GUI (i.e. Document mode) into an external file format that is directly supported by a read of a package module?

Every export format I tried requires post editting by a text editor to "fix-it".  And it seems most export options drop the comment text (i.e. text after a #).

Thanks.

1 2 3 Page 1 of 3