login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for RosettaStone revision 2 of 2

1 2
Editor: page
Time: 2007/09/11 17:11:50 GMT-7
Note:

changed:
-(Note that the pamphlet form of this document can be found here: WebSite:wiki.axiom-developer.org/axiom--test--1/src/doc/Rosetta)
-
-
(Note that the pamphlet form of this document can be found here: [Rosetta]



 1  Rosetta Translations

1.1  Introduction

The following is a collection of synonyms for various operations in the computer algebra systems [Axiom]?, [Derive]?, [GAP]?, [Gmp]?, DoCon?, [Macsyma]?, [Magnus]?, [Maxima]?, [Maple]?, [Mathematica]?, [MuPAD]?, [Octave]?, [Pari]?, [Reduce]?, [Scilab]?, [Sumit]? and Yacas. This collection does not attempt to be comprehensive, but hopefully it will be useful in giving an indication of how to translate between the syntaxes used by the different systems in many common situations. Note that a blank entry means either (a) that there may be an exact translation of a particular operation for the indicated system, but we don't know what it is or (b) there is no exact translation but it may still be possible to work around this lack with a related functionality.

While commercial systems are not provided on this CD the intent of the Rosetta effort is to make it possible for experienced Computer Algebra users to experiment with other systems. Thus the commands for commercial systems are included to allow users of those systems to translate.

Some of these systems are special purpose and do not support a lot of the functionality of the more general purpose systems. Where they do support an interpreter the commands are provided.

Originally written by Michael Wester. Modified for Rosetta by Timothy Daly, Alexander Hulpke (GAP).

1.2  System availability


System License Status (May 2002) Web Location
Axiom BSD available http://www.aldor.org
Axiom open source alpha http://savannah.nongnu.org/projects/axiom
Derive commercial available http://www.mathware.com
DoCon? open source available http://www.haskell.org/docon
GAP GPL Rosetta http://www.gap-system.org/
Gmp GPL Rosetta http://www.swox.com/gmp
Macsyma commercial dead unavailable
Magnus GPL Rosetta http://zebra.sci.ccny.cuny.edu/web
Maxima GPL Rosetta http://maxima.sourceforge.net/
Maple commercial available http://www.maplesoft.com
Mathematica commercial available http://www.wolfram.com
MuPAD? commercial available http://www.mupad.de
Octave GPL Rosetta http://www.octave.org
Pari GPL Rosetta http://www.parigp-home.de
Reduce commercial available http://www.zib.de/Symbolik/reduce
Scilab Scilab available http://www-rocq.inria.fr/scilab
Sumit   available http://www-sop.inria.fr/cafe/soft-f.html
Yacas GPL available http://yacas.sourceforge.net


System Type Interpreted or Compiled
Axiom General Purpose both
Derive General Purpose  
DoCon? General Purpose Interpreted in Haskell
GAP Group Theory  
Gmp arb. prec. arithmetic  
Macsyma General Purpose  
Magnus Infinite Group Theory  
Maxima General Purpose  
Maple General Purpose  
Mathematica General Purpose  
MuPAD? General Purpose  
Octave Numerical Computing  
Pari Number Theory  
Reduce General Purpose  
Scilab General Purpose  
Sumit Functional Equations  
Yacas General Purpose  

1.3  Programming and Miscellaneous

=0pt =1pt

  Unix/Microsoft user initialization file
Axiom ~/axiom.input  
GAP ~/.gaprc GAP.RC
Gmp    
DoCon?    
Derive   derive.ini
Macsyma ~/macsyma-init.macsyma mac-init.mac
Magnus    
Maxima ~/macsyma-init.macsyma mac-init.mac
Maple ~/.mapleinit maplev5.ini
Mathematica ~/init.m init.m
MuPAD? ~/.mupad/userinit.mu \mupad\bin\userinit.mu
Octave    
Pari    
Reduce ~/.reducerc reduce.rc
Scilab    
Sumit    
Yacas    

  Describe keyword Find keywords containing pattern
Axiom   )what operations pattern
Derive    
DoCon?    
GAP ?keyword ??keyword
Gmp    
Macsyma describe("keyword")$ apropos("pattern");
Magnus    
Maxima describe("keyword")$ apropos("pattern");
Maple ?keyword ?pattern 1
Mathematica ?keyword ?pattern
MuPAD? ?keyword ?pattern
Octave help -i keyword  
Pari    
Reduce    
Scilab    
Sumit    
Yacas    


      Prev. Case Variables
  Comment Line continuation expr. sensitive assumed
Axiom -- comment input _<CR>input % Yes real
Derive "comment" input ~<CR>input   No real
DoCon?          
GAP # comment input\<CR>input last Yes no assumption
Gmp          
Macsyma / comment / input<CR>input; % No real
Magnus          
Maxima / comment / input<CR>input; % No real
Maple # comment input<CR>input; % Yes complex
Mathematica ( comment ) input<CR>input % Yes complex
MuPAD? / comment / or // comment input<CR>input; % Yes complex
Octave ##     Yes  
Pari          
Reduce % comment input<CR>input; ws No complex
Scilab          
Sumit          
Yacas          

  Load a file Time a command Quit
Axiom )read "file" )quiet )set messages time on )quit
Derive [Transfer Load Derive]   [Quit]
DoCon?      
GAP Read("file"); time; (also see Runtime();) quit;
Gmp      
Macsyma load("file")$ showtime: all$ quit();
Magnus      
Maxima load("file")$ showtime: all$ quit();
Maple read("file"): readlib(showtime): on; quit
Mathematica << file Timing[command]? Quit[]
MuPAD? read("file"): time(command); quit
Octave load file tic(); cmd ; toc() quit or exit
Pari      
Reduce in "file"$ on time; quit;
Scilab     quit
Sumit      
Yacas      

  Display Suppress  
  output output Substitution: f(x, y) ® f(z, w)
Axiom input input; subst(f(x, y), [x = z, y = w])
Derive input var:= input [Manage Substitute]
DoCon?      
GAP input; input;; Value(f,[x,y],[z,w]);2
Gmp      
Macsyma input; input$ subst([x = z, y = w], f(x, y));
Magnus      
Maxima input; input$ subst([x = z, y = w], f(x, y));
Maple input; input: subs({x = z, y = w}, f(x, y));
Mathematica input input; f[x, y] /. {x -> z, y -> w}
MuPAD? input; input: subs(f(x, y), [x = z, y = w]);
Octave input input;  
Pari      
Reduce input; input$ sub({x = z, y = w}, f(x, y));
Scilab      
Sumit      
Yacas      

  Set List Matrix
Axiom set [1, 2] [1, 2] matrix([[1, 2],[3, 4]]?)
Derive {1, 2} [1, 2]? [[1,2], [3,4]]?
DoCon?      
GAP Set([1,2]?) [1, 2] [[1,2], [3,4]]?3
Gmp      
Macsyma [1, 2] [1, 2] matrix([1, 2], [3, 4]?)
Magnus      
Maxima [1, 2] [1, 2] matrix([1, 2], [3, 4]?)
Maple {1, 2} [1, 2] matrix([[1, 2], [3, 4]]?)
Mathematica {1, 2} {1, 2} {{1, 2}, {3, 4}}
MuPAD? {1, 2} [1, 2] matrix([![1, 2], [3, 4]])
Octave      
Pari      
Reduce {1, 2} {1, 2} mat((1, 2), (3, 4))
Scilab   list(1,2) A=[1,2;3,4]
Sumit      
Yacas      

  Equation List element Matrix element Length of a list
Axiom x = 0 l . 2 m(2, 3) #l
Derive x = 0 l SUB 2 m SUB 2 SUB 3 DIMENSION(l)
DoCon?        
GAP x=0 l[2] m[2][3] Length(l)
Gmp        
Macsyma x = 0 l[2] m[2, 3] length(l)
Magnus        
Maxima x = 0 l[2]? m[2, 3]? length(l)
Maple x = 0 l[2] m[2, 3] nops(l)
Mathematica x == 0 l[[2]] m[[2, 3]] Length[l]
MuPAD? x = 0 l[2] m[2, 3] nops(l)
Octave        
Pari        
Reduce x = 0 part(l, 2) m(2, 3) length(l)
Scilab   l(2)    
Sumit        
Yacas        

  Prepend/append an element to a list Append two lists
Axiom cons(e, l) concat(l, e) append(l1, l2)
Derive APPEND([e]?, l) APPEND(l, [e]?) APPEND(l1, l2)
DoCon?      
GAP Concatenation([e]?,l) Add(l,e) Append(l1, l2)
Gmp      
Macsyma cons(e, l) endcons(e, l) append(l1, l2)
Magnus      
Maxima cons(e, l) endcons(e, l) append(l1, l2)
Maple [e, op(l)]? [op(l), e]? [op(l1), op(l2)]?
Mathematica Prepend[l, e] Append[l, e] Join[l1, l2]
MuPAD? [e] . l append(l, e) l1 . l2
Octave      
Pari      
Reduce e . l append(l, e) append(l1, l2)
Scilab      
Sumit      
Yacas      

  Matrix column dimension Convert a list into a column vector
Axiom ncols(m) transpose(matrix([l]))
Derive DIMENSION(m SUB 1) [l]?`
DoCon?    
GAP Length(mat[1]?) objects are identical
Gmp    
Macsyma mat_ ncols(m) transpose(matrix(l))
Magnus    
Maxima mat_ ncols(m) transpose(matrix(l))
Maple linalg[coldim]?(m) linalg[transpose]?(matrix([l]?))
Mathematica Dimensions[m][[2]] Transpose[{l}]
MuPAD? linalg::ncols(m) linalg::transpose(matrix([l])) 
Octave    
Pari    
Reduce load_ package(linalg)$ matrix v(length(l), 1)$
  column_dim(m) for i:=1:length(l) do
        v(i, 1):= part(l, i)
Scilab    
Sumit    
Yacas    


  Convert a column vector into a list
Axiom parts(v)
Derive v` SUB 1
DoCon?  
GAP objects are identical
Gmp  
Macsyma part(transpose(v), 1)
Magnus  
Maxima part(transpose(v), 1)
Maple op(convert(linalg[transpose]?(v), listlist))
Mathematica Flatten[v]
MuPAD? [op(v)]
Octave  
Pari  
Reduce load_ package(linalg)$
  for i:=1:row_ dim(v) collect(v(i, 1))
Scilab  
Sumit  
Yacas  

  True False And Or Not Equal Not equal
Axiom true false and or not = ~=
Derive TRUE FALSE AND OR NOT = /=
DoCon?              
GAP true false4 and or not = <>
Gmp              
Macsyma true false and or not = #
Magnus              
Maxima true false and or not = #
Maple true false and or not = <>
Mathematica True False && || ! == !=
MuPAD? TRUE FALSE and or not = <>
Octave              
Pari              
Reduce t nil and or not = neq
Scilab %t %f          
Sumit              
Yacas              

  If+then+else statements Strings (concatenated)
Axiom if then else if then else _ concat(["x", "y"])
Derive IF(, , IF(, , _)) "xy"
DoCon?    
GAP if then elif then else _ fi Concatenation("x","y")
Gmp    
Macsyma if then else if then else _ concat("x", "y")
Magnus    
Maxima if then else if then else _ concat("x", "y")
Maple if then elif then else _ fi "x" . "y"
Mathematica [, , If![, , _][, , If![, , _]] "x" <> "y"
MuPAD? if then elif then else _ "x" . "y"
      end_if  
Octave    
Pari    
Reduce if then else if then else _ "xy" or mkid(x, y)
Scilab    
Sumit    
Yacas    

  Simple loop and Block Generate the list [1, 2, ..., n]
Axiom for i in 1..n repeat ( x; y ) [f(i) for i in 1..n]?
Derive VECTOR([x, y]?, i, 1, n) VECTOR(f(i), i, 1, n)
DoCon?    
GAP for i in [1..n] do _ od; [1..n]? or [1,2..n]?
Gmp    
Macsyma for i:1 thru n do (x, y); makelist(f(i), i, 1, n);
Magnus    
Maxima for i:1 thru n do (x, y); makelist(f(i), i, 1, n);
Maple for i from 1 to n do x; y od; [f(i) $ i = 1..n];
Mathematica Do[x; y, {i, 1, n}] Table[f[i], {i, 1, n}]
MuPAD? for i from 1 to n do x; y [f(i) $ i = 1..n];
      end_for;  
Octave    
Pari    
Reduce for i:=1:n do <<x; y>>; for i:=1:n collect f(i);
Scilab    
Sumit    
Yacas    

  Complex loop iterating on a list
Axiom for x in [2, 3, 5] while x**2 < 10 repeat output(x)
Derive  
DoCon?  
GAP for x in [2, 3, 5] do while x^2<10 do Print(x);od;od;
Gmp  
Macsyma for x in [2, 3, 5] while x^2 < 10 do print(x)$
Magnus  
Maxima for x in [2, 3, 5] while x^2 < 10 do print(x)$
Maple for x in [2, 3, 5] while x^2 < 10 do print(x) od:
Mathematica For[l = {2, 3, 5}, l != {} && l[[1]]?^2 < 10,
    l = Rest[l], Print[l[[1]]] ]
MuPAD? for x in [2, 3, 5] do if x^2 < 10 then print(x) end_if
    end_for:
Octave  
Pari  
Reduce for each x in {2, 3, 5} do if x^2 < 10 then write(x)$
Scilab  
Sumit  
Yacas  

  Assignment Function definition Clear vars and funs
Axiom y:= f(x) f(x, y) == x*y )clear properties y f
Derive y:= f(x) f(x, y):= x*y y:= f:=
DoCon?      
GAP y:= f(x); f:=function(x, y) return x*y; end; There are no symbolic variables
Gmp      
Macsyma y: f(x); f(x, y):= x*y; remvalue(y)$
      remfunction(f)$
Magnus      
Maxima y: f(x); f(x, y):= x*y; remvalue(y)$
      remfunction(f)$
Maple y:= f(x); f:= proc(x, y) x*y end; y:= 'y': f:= 'f':
Mathematica y = f[x]? f[x, y ]:= x*y Clear[y, f]
MuPAD? y:= f(x) (x, y) -> x*y delete y, f
    f:= proc(x, y)  
        begin x*y end_proc  
Octave      
Pari      
Reduce y:= f(x); procedure f(x, y); x*y; clear y, f;
Scilab      
Sumit      
Yacas      

  Function definition with a local variable
Axiom f(x) == (local n; n:= 2; n*x)
Derive  
DoCon?  
GAP f:=function(x) local n; n:=2;return n*x; end;
Gmp  
Macsyma f(x):= block([n]?, n: 2, n*x);
Magnus  
Maxima f(x):= block([n], n: 2, n*x);
Maple f:= proc(x) local n; n:= 2; n*x end;
Mathematica f[x_ ]:= Module[{n}, n = 2; n*x]?
MuPAD? f:= proc(x) local n; begin n:= 2; n*x end_proc;
Octave  
Pari  
Reduce procedure f(x); begin scalar n; n:= 2; return(n*x) end;
Scilab  
Sumit  
Yacas  

  Return unevaluated symbol Define a function from an expression
Axiom e:= x*y;  'e function(e, f, x, y)
Derive e:= x*y  'e f(x, y):== e
DoCon?    
GAP No unevaluated symbols6  
Gmp    
Macsyma e: x*y$  'e; define(f(x, y), e);
Magnus    
Maxima e: x*y$  'e; define(f(x, y), e);
Maple e:= x*y:  'e'; f:= unapply(e, x, y);
Mathematica e = x*y;  HoldForm?[e]? f[x, y ]? = e
MuPAD? e:= x*y:  hold(e); f:= hold(func)(e, x, y);
Octave    
Pari    
Reduce e:= x*y$ for all x, y let f(x, y):= e;
Scilab    
Sumit    
Yacas    


  Fun. of an indefinite number of args Apply ``+'' to sum a list
Axiom   reduce(+, [1, 2]?)
Derive LST l:= l  
DoCon?    
GAP lst:=function(args) _ end; Sum([1,2]?)
Gmp    
Macsyma lst([l]?):= l; apply("+", [1, 2])
Magnus    
Maxima lst([l]):= l; apply("+", [1, 2]?)
Maple lst:=proc() [args[1..nargs]]? end; convert([1, 2], `+`)
Mathematica lst[l  _ ]:= {l} Apply[Plus, {1, 2}]
MuPAD? lst:= proc() begin [args()]? _plus(op([1, 2]?))
        end_ proc;  
Octave    
Pari    
Reduce   xapply(+, {1, 2}) 5
Scilab    
Sumit    
Yacas    


  Apply a fun. to a  
  list of its args Map an anonymous function onto a list
Axiom reduce(f, l) map(x +-> x + y, [1, 2]?)
Derive   x:= [1, 2]
    VECTOR(x SUB i + y, i, 1, DIMENSION(x))
DoCon?    
GAP List(l,f) List([1,2],x->x+y)
Gmp    
Macsyma apply(f, l) map(lambda([x], x + y), [1, 2])
Magnus    
Maxima apply(f, l) map(lambda([x], x + y), [1, 2])
Maple f(op(l)) map(x -> x + y, [1, 2])
Mathematica Apply[f, l] Map[# + y &, {1, 2}]?
MuPAD? f(op(l)) map([1, 2], x -> x + y)
Octave    
Pari    
Reduce xapply(f, l) 6 for each x in {1, 2} collect x + y
Scilab    
Sumit    
Yacas    

  Pattern matching: f(3 y) + f(z y) ® 3 f(y) + f(z y)
Axiom f:= operator('f);
  ( rule f((n | integer?(n)) x) == nf(x) )( _
      f(3y) + f(zy))
Derive  
DoCon?  
GAP  
Gmp  
Macsyma matchdeclare(n, integerp, x, true)$
  defrule(fnx, f(nx), nf(x))$
  apply1(f(3y) + f(zy), fnx);
Magnus  
Maxima matchdeclare(n, integerp, x, true)$
  defrule(fnx, f(nx), nf(x))$
  apply1(f(3y) + f(zy), fnx);
Maple map(proc(q) local m;
        if match(q = f(n*y), y, m) and
            type(rhs(op(m)), integer) then
          subs(m, n * f(y)) else q fi
      end,
      f(3y) + f(zy));
Mathematica f[3*y] + f[z*y] /. f[n_Integer x_ ]? -> nf[x]?
MuPAD?  
Octave  
Pari  
Reduce operator f;
  f(3y) + f(zy)
      where {f(~n ~x) => nf(x) when fixp(n)};
Scilab  
Sumit  
Yacas  

  Define a new infix operator and then use it
Axiom  
Derive  
DoCon?  
GAP One can overload existing infix operators for ones own purposes
Gmp  
Macsyma infix("~")$   "~"(x, y):= sqrt(x^2 + y^2)$    3 ~ 4;
Magnus  
Maxima infix("~")$   "~"(x, y):= sqrt(x^2 + y^2)$    3 ~ 4;
Maple `&~`:= (x, y) -> sqrt(x^2 + y^2):   3 &~ 4;
Mathematica x_ \[Tilde]? y_:= Sqrt[x^2 + y^2]?;    3 \[Tilde]? 4
MuPAD? tilde:= proc(x, y) begin sqrt(x^2 + y^2) end_ proc:
    operator("~", tilde, Binary, 100):
    3 ~ 4;
Octave  
Pari  
Reduce infix |$   procedure |(x, y); sqrt(x^2 + y^2)$    3 | 4;
Scilab  
Sumit  
Yacas  

  Main expression    
  operator 11 th st nd rd operand List of expression operands
Axiom7   kernels(e) . 1 kernels(e)
Derive     various8
DoCon?      
GAP There are no formal unevaluated expressions
Gmp      
Macsyma part(e, 0) part(e, 1) args(e)
Magnus      
Maxima part(e, 0) part(e, 1) args(e)
Maple op(0, e) op(1, e) [op(e)]?
Mathematica Head[e]? e[[1]]? ReplacePart?[e, List, 0]?
MuPAD? op(e, 0) op(e, 1) [op(e)]?
Octave      
Pari      
Reduce part(e, 0) part(e, 1) for i:=1:arglength(e)
          collect part(e, i)
Scilab      
Sumit      
Yacas      


  Print text and results
Axiom output(concat(["sin(", string(0), ") = ",
    string(sin(0))]));
Derive "sin(0)" = sin(0)
DoCon?  
GAP Print("There is no sin, but factors(10)= ",Factors(10), "\n")
Gmp  
Macsyma print("sin(", 0, ") =", sin(0))$
Magnus  
Maxima print("sin(", 0, ") =", sin(0))$
Maple printf("sin(%a) = %a\n", 0, sin(0)):
Mathematica Print[StringForm["sin(``) = ``", 0, Sin[0]]?];
MuPAD? print(Unquoted, "sin(".0.")" = sin(0)):
Octave  
Pari  
Reduce write("sin(", 0, ") = ", sin(0))$
Scilab  
Sumit  
Yacas  

  Generate FORTRAN Generate TeX/LATEX
Axiom outputAsFortran(e) outputAsTex(e)
Derive [Transfer Save Fortran]?  
DoCon?    
GAP   Print(LaTeX(e));
Gmp &nb