Items tagged with module module Tagged Items Feed

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

how to convert between (system of polynomials or module) and rational function which is a four dimensional space

1. is module in algebraic geometry or group cohomology to classify homology group?

2. is final result like this? for example,

a dictionary  or table store

homology group 1, key=invariant = 1 hole in topological space , value = module 1, module 2 module 3 etc

homology group 2, key=invariant = 2 holes in topological space , value =module 4, module 5, module 6 etc

homology group 3, key=invariant = 3 holes in topological space , value = module 7, module 8.. etc

 ... etc

 

3. i find betti number can count holes, however how to know the form for

all combination?

i mean if it is module, how to change the module to get the full combination

http://www.singular.uni-kl.de/Manual/html/sing_159.htm

i find betti number's input is just ideal, but it is not module

if ideal is enough, why need module?

how to permuate module? and what do it classify and result in module?

1. is module in algebraic geometry for classification of topological space which a poset is a frame

2. which invariant is for doing this classification of topological space in algebraic geometry or group cohomology?

3. if want to do full combination before classification, which kind of polynomials be a full combination

4. is poset just like function fst and snd function for meet and join in functional programming instead of using "and" and "or" logic? how a matrix group related with topological space which a poset is a frame?

5. is there any invariant function for classification of topological space in maple?

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?

 

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.

1 2 3 Page 1 of 3