Looking for the latest version? Download maxima-expt.zip (157.6 kB)
Home
Name Modified Size Downloads / Week Status
Totals: 13 Items   7.4 MB 22
OldVersions 2010-05-25 0
prime_pi_tables.lisp 2012-02-05 3.3 MB 11 weekly downloads
maxima-expt.zip 2012-02-05 157.6 kB 88 weekly downloads
maxima-expt.tar.gz 2012-02-05 103.4 kB 11 weekly downloads
README 2011-12-28 13.4 kB 22 weekly downloads
mixima-0.25.zip 2011-12-28 878.5 kB 22 weekly downloads
mixima-0.25.tar.gz 2011-12-28 738.3 kB 11 weekly downloads
mixima-0.24.tar.gz 2011-12-17 516.5 kB 11 weekly downloads
mixima-0.24.zip 2011-12-17 623.5 kB 22 weekly downloads
mixima-0.23.zip 2011-12-09 311.7 kB 11 weekly downloads
mixima-0.23.tar.gz 2011-12-09 250.9 kB 11 weekly downloads
mixima-0.22.tar.gz 2011-12-06 226.8 kB 11 weekly downloads
mixima-0.22.zip 2011-12-06 275.5 kB 11 weekly downloads
Mathematica compatibility functions and translator for the Maxima computer algebra system. ------------------------------------------------------------ VERSION 0.25 Copyright (C) 2008, John Lapeyre All rights reserved. This program is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. Mathematica is a registered trademark of Wolfram Research, Inc. (2008) ------------------------------------------------------------ INTRODUCTION: This software has three parts: 1) Compatibility functions for Maxima that try to duplicate Mathematica(tm) (Mma) functions, eg 'Table'. Used alone, they provide a quasi-Mma environment. Mixima is designed to extend the maxima environment more or less like any other package-- not to replace it, as does Mockmma. The compatibility functions are maxima functions called with maxima syntax from within maxima. 2) A translator that translates a subset of Mma code to Maxima code. The compatitiblity functions can be used by themselves or with this translator. But the translator produces code that depends on the compatibility functions. 3) A mock Mma mode that allows using Mathematica syntax at the command line. This is a sort of Mma clone. This is a modified version of the Fateman Mockmma project. The allowed syntax and semantics is limited. There are more READMEs at the top level and some information can be found in doc/mixima_user_doc Also see the section on online help at the bottom of this document. ------------------------------------------------------------ INSTALL: MS Windows and other OSs: If you have maxima installed, this software should work in principle. It is tested a bit on Win32; the testsuite passes. For Windows, copy the entire folder .\build\mixima to your maxima share folder. For instance, copy the folder to c:\Program Files\Maxima-5.25.1-gcl\share\maxima\5.25.1\share Then you should have a folder c:\Program Files\Maxima-5.25.1-gcl\share\maxima\5.25.1\share\mixima with all the mixima files in it. Linux/unix system with perl installed: Edit the file config_install.pl to suit your preference (the default should be ok) and type mkdistcompat.pl Then, as root (or sudo) type ./install.pl With default settings, this installs files to the maxima share directories and some executables to /usr/local/bin. If this does not work, try copying ./build/mixima to a location where your maxima installation can see it. Known problems: * The mockmma shell does not currently work well with xmaxima nor wxmaxima. The compatibility functions seem to work ok. * wxmaxima has a bug that will print an error message involving STRIPDOLLAR. Mixima can still be used, but the state of maxima is changed and and some things are broken. To avoid this, remove the line that loads "loadlast.mac" in the file "mixima.mac". The offending function is Clear(). ------------------------------------------------------------ TESTING: If mixima is installed, give the maxima commands load("mixima/mixima"); mixtest(); Or in this toplevel directory, start maxima and give the following commands: load("./tests/mixima_testsuite.mac"); or load("./tests/mixima_testsuite_slow.mac"); ------------------------------------------------------------ QUICK START: The compatibility functions are functions written in the Maxima language that emulate the behavior of Mathematica (Mma) functions. For example: * Compatibility Functions > maxima (%i1) load("mixima/mixima"); (%o1) /usr/share/maxima/5.21.1/share/mixima/mixima.mac (%i2) Table( i*j, [i,3],[j,3]); (%o2) [[1, 2, 3], [2, 4, 6], [3, 6, 9]] (%i3) mixFuncs(); /* lists compatibililty functions */ (%i4) mixDoc(Table); /* prints examples */ * entering the mockmma shell to enter Mma code at the command line (%i5) tomma(); In[6]:= Array[#1^#2 &,{3,4}] (%i6) Array(lambda( [[lambda_args]], (lambda_args[1]^lambda_args[2]) ),[3,4]) (%o6) [[1, 1, 1, 1], [2, 4, 8, 16], [3, 9, 27, 81]] Out[6]:= {{1, 1, 1, 1}, {2, 4, 8, 16}, {3, 9, 27, 81}} In[7]:= Exit (%o7) true (%i8) %o6; (%o8) [[1, 1, 1, 1], [2, 4, 8, 16], [3, 9, 27, 81]] tomma() does not work with xmaxima and wxmaxima. * Evaluating strings of Mma code. (%i1) smmatomax(" a = 1 "); (%o1) 1 (%i2) a; (%o2) 1 smmatomax() should work with xmaxima and wxmaxima. * translating code at the unix shell mmatomax mma_code.m ------------------------------------------------------------ MORE DETAILS: Mixima can be used several ways: ** Functions that extend Maxima with functions similar to those in Mma > maxima (%i1) load("mixima/mixima"); (%o1) /usr/share/maxima/5.21.1/share/mixima/mixima.mac (%i2) Table( i*j, [i,3],[j,3]); (%o2) [[1, 2, 3], [2, 4, 6], [3, 6, 9]] Note that the syntax used here is Maxima syntax, not Mma. For instance lists: {} --> [] function call: [] --> () assignment: = --> : ,etc. A list of the compatibility functions is included in the file 'function_list'. Example code can be found in the ./tests folder and in the ./applications folder. The code in the tests folder contains comments for some Mma functions concerning how much of those functions are implemented. As a convenience, the executable 'mixima' loads the mixima code automatically (but does not currently allow other initialization scripts): > mixima ... (%i1) Tuples([0,1],2); (%o1) [[0, 0], [0, 1], [1, 0], [1, 1]] ** Mixima can use the Mockmma shell. For example, (%i1) tomma(); ... In[1]:= Table[ i j,{i,3},{j,3}] Out[1]:= {{1, 2, 3}, {2, 4, 6}, {3, 6, 9}} In[2]:= NIntegrate[1/Sqrt[x],{x,0,1},PrecisionGoal->12] Out[2]:= 1.999999999999998 In[3]:= Exit As a convenience, the executable 'miximamma' starts maxima and the Mockmma shell with the mixima translator. Here are commands that can be used to control whether the results are shown in Maxima or Mma or both. MmaShowOut[True] (or False) to control Mma output MmaShowTrans[True] (or False) to control maxima display of translation. MmaVerbose[True] (or False) to print more stuff during evaluation. MmaPrintEx[arg] print strings suitable for inserting in rtest files as tests and examples. If no arg is given , print no function name in the example. If a string is given, it is used as the function name for subsequent input. If arg is False, then disable. ** The original Mockmma is included (modified slightly from the Mockmma distribution) Usually, when we refer to mockmma, we don't mean this original, but rather the mockmma shell modified to use the compatibility functions. (%i1) :lisp (mockmma) ... In[1]:= As a convenience, the executable 'mockmma' starts maxima and Mockmma (the version by H.Monroe based on code by Fateman et. al.) Note that for many inputs, Mockmma and Mixima with the Mockmma shell give identical output. But in fact there are important difference that are not explained here. ** Using translator from maxima ** Using stand alone translation scripts For these, see README.translator ------------------------------------------------------------ COMPATIBILITY FUNCTIONS: A) Use Due in part to fundamental differences int the two CAS's, these compatibility functions reproduce the behavior of the original functions imperfectly and to varying degrees. Examples of ways in which they may be useful are 1. They can be used in Maxima projects by people who are already familiar with the Mma functions. 2. They can be used to more easily translate user Mma code to Maxima. 3. They may provide functionality not currently available in Maxima. Use of Compatibility functions Load the functions from the Maxima prompt with (%i1) load("mixima/mixima"); The other source files will then be loaded automatically. The files must have been placed in your Maxima search path for this to work. Examples of how to use the functions and some notes on limits in functionality are in the test file rtest_mixima.mac ---------------------- B) Matrices and Sets * Maxima has a special data type for matrices, while Mma implements matrices as ordinary lists. This is handled in the compatibility functions by allowing either a Maxima list or a Maxima matrix as an argument that is to be interpreted as a matrix. If the function returns a matrix, then, if possible, the output type is the same as the input type. For instace: (%i29) Inverse( matrix( [1,2],[3,4])); (%o29) matrix([-2,1],[3/2,-1/2]) (%i30) Inverse( [ [1,2],[3,4] ]); (%o30) [[-2,1],[3/2,-1/2]] * Likewise Mma implements sets as ordinary lists. These are handled by the compatibility functions in the same way that matrices are. For instance: (%i34) Union( {1,2}, {3,4}); (%o34) {1,2,3,4} (%i35) Union( [1,2], [3,4]); (%o35) [1,2,3,4] * If the arguments are a both sets and lists, then the return type is the same as the first argument. * Use the compatibility function 'Dot' and not the Maxima '.' if you want the the Mma function 'Dot', which can also be written in Mma in the '.' form. In other words do not use the Maxima '.' function for the Mma '.', but rather use the compatibility Dot. The function Dot does not accept Maxima matrices (but they can be converted) because the two systems are not compatible. Read the documentation on matrix multiplication for both systems to see why. * Useful functions are ensuremat(m) . Converts m to a maxima matrix if it is a list. Returns m unchanged if it is already a matrix ensurelist(m) makes matrix m to a list if not already a list. ---------------------- C) Online Help mixFuncs(); lists compatibility functions and operators. mixFuncs(string); lists compatibility functions and operators whose names contain string. mixDoc(function); lists examples of a function, where function is a symbol or a string. ie. mixDoc("Integrate"); or mixima_doc(Integrate); mixDoc(Integrate,bad); list unimplemented or failed examples. Not all functions have examples. D) Syntax @@ can be used for Apply -> can be used for Rule. I'm not sure how useful this syntax is. It should probably be made optional. ------------------------------------------------------------ MMA SHELL: * Here is an example of entering and using the shell. Note below that the mma shell and maxima shell use the same line numbers. Use In[3], Out[3] to acess %i3, etc. The Mma parser can't read %i3 properly. Note that in the mixima-mockmma shell, the maxima input and output is printed. (%i1) a : 1; (%o1) 1 (%i2) tomma(); In[3]:= a (%i3) a (%o3) 1 Out[3]:= 1 In[4]:= b = 2 (%i4) (b:2) (%o4) 2 Out[4]:= 2 In[5]:= In[1] (%i5) In(1) (%o5) a : 1 Out[5]:= MSETQ[a, 1] In[6]:= Out[1] (%i6) Out(1) (%o6) 1 Out[6]:= 1 In[7]:= Exit (%i7) Exit (%o7) Exit (%o7) true (%i8) %o4; (%o8) 2 (%i9) * What happens when you use the shell ? You enter a line of Mma code. It is parsed as Mma code. This is translated to maxima code and evaluated by maxima. The resulting maxima expression is then translated back to Mma and printed. You can turn off the printing of the intermediate results. In[10]:= MmaShowTrans[False] (%i10) MmaShowTrans(False) Unsetting maxima translation Out[10]:= False In[11]:= N[Pi,12] Out[11]:= 3.1415926535897931 In[12]:= InString[11] Out[12]:= N(Pi,12) In this case, using InString[11] gives the desired result. In[11] ( or %i11 in maxima) give errors because they stored results passed throught the simplifier, which are returned in a new context. You can read Mma expressions from a file with miximaEvalFile("filename"); or from withing the mockmma shell miximaEvalFile["./translator/t1.m"] * Commands related to the mockmma shell These 'commands' are functions that can be usefully called from withing the maxima shell as well; eg In(3) rather than In[3]. InString[n] The nth (eg 3rd) mma input string from user's input, returned by the parser, with whitespace and commas stripped. This is stored as %is3. Recall that the line numbers and input and output are the same in the two shells. Thus, if the nth line was entered in the maxima shell, there will be no corresponding mma string and InString[n] returns an atom, eg %is3. mInString[n] The nth (eg 3rd) maxima input string built by translating the mma input string. Also available as %ims3, but this is not valid syntax in the mockmma shell. In[n] The nth maxima input expression. Currently only printed in '2d' form. This expression is created by the parser from the user's mma input string. This is the correct expression to use in the mockmma shell. This is the same as %i3, etc. in the maxima shell. The expressions entered in the mockmma shell are copied to %i{n} so that they are available within the maxima shell; also via In(n). Out[n] The nth maxima output expression. This is the correct way to access the output for further calculation from within the mockmma shell. ---------------------------------------------------
Source: README, updated 2011-12-28