Re: Steps towards writing a computer algebra system
From: Julian V. Noble (jvn_at_virginia.edu)
Date: 01/18/05
- Next message: Jesse Nochella: "Re: Steps towards writing a computer algebra system"
- Previous message: Richard J. Fateman: "Re: Steps towards writing a computer algebra system"
- Maybe in reply to: Richard J. Fateman: "Re: Steps towards writing a computer algebra system"
- Next in thread: A.L.: "Re: Steps towards writing a computer algebra system"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 18 Jan 2005 18:38:56 -0500
Mike wrote:
>
> Hi
>
> I am a self-taught programmer and have always been fascinated with
> computer algebra systems (CAS) such as Mathematica. For a hobby I
> thought that I would like to have a crack at writing my own (very
> simple) CAS but I am rather lost on where to start.
>
Start by writing code to translate algebraic formulas to some useful
internal representation. I have written a fairly elaborate one in Forth
(translates a formula to Forth in usual Forthish RPN form) but there is
no reason you have to make Forth the parse language, or Forth the outpur
language, for that matter. Lisp, C, C++ or AWK would do fine for the parse
language, and assembler or pseudocode, or even a tree structure would be
fine for the target "language". I believe Kruse ("Data Structures and
Program Design") has a program for evaluating numerically an input formula.
That should serve as a guide to how to do it. Several of my Forth FORmula
TRANslators can be found at
http://Galileo.phys.Virginia.EDU/classes/551.jvn.fall01/programs.htm
You will have to learn how to write finite state machines in whatever language
you choose, unless it has built-in pattern recognizing functions.
Once you can do this, think how to write out the rules for some algebraic
transformation, such as factoring out a common sub-expression, or solving
a linear or quadratic equation in closed form. Then write pseudocode to
translate the rules into an algorithm. At this point you will have
begun to understand what goes into a real CAS.
If you are interested in integer computations, learn how to do arithmetic
with integers of arbitrary length. See Knuth, e.g. for algorithms. You will
need to learn how to represent very large integers compactly. Knuth offers
some insight on this.
Good luck.
--
Julian V. Noble
Professor Emeritus of Physics
jvn@lessspamformother.virginia.edu
^^^^^^^^^^^^^^^^^^
http://galileo.phys.virginia.edu/~jvn/
"As democracy is perfected, the office of president represents, more and
more closely, the inner soul of the people. On some great and glorious
day the plain folks of the land will reach their heart's desire at last
and the White House will be adorned by a downright moron."
--- H. L. Mencken (1880 - 1956)
- Next message: Jesse Nochella: "Re: Steps towards writing a computer algebra system"
- Previous message: Richard J. Fateman: "Re: Steps towards writing a computer algebra system"
- Maybe in reply to: Richard J. Fateman: "Re: Steps towards writing a computer algebra system"
- Next in thread: A.L.: "Re: Steps towards writing a computer algebra system"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|