Dark Cowherd <[EMAIL PROTECTED]> wrote:
> http://www.ucalc.com/mathparser/index.html
> 
> There is a great library called UCALC which allows you to set up an
> expression and evaluate it
> for e.g. you an define an expression by calling a function in UCALC
> then call it with various values of x
> 
> for e.g. see this page
> http://www.ucalc.com/mathparser/sample6.html
> 
> It is very fast. I have used it in VB when there is lot of number
> crunching to be done.
> Is there a Python equivalent.
> 
> I looked at numPy and SciPy sites (just skimmed through) did'nt seem
> to have what I wanted.
> 
> Any pointers?

Python has 'eval' and 'exec', so you can process at run-time anything
that you can type into script file.  However, it will be a bit more
verbose than UCALC, because Python is more general.

If you're looking for scientific calculator, which can be embedded or
scripted, then perhaps you should take a look at
    http://home.eol.ca/~parkw/index.html#rpn
It is RPN calculator with full support for <math.h> functions and some
features found in typical programmable scientific calculators.

Eg.
    3+4/5-8     --> rpn 4 5 / 3 + 8 - =         --> -4.2

    x^2+5x-10
        --> rpn 'f(x)= dup 5 + x 10 -' 
            rpn 1 'f(x)' =              --> -4
            rpn 5 'f(x)' =              --> 40
    or it can be scripted directly using shell function, like
        --> func () {
                rpn $1 dup 5 + x 10 - =
            }
            func 1
            func 5

    Sum(x^2+5, 1, 10).  I assume this is sum of x^2+5, for x=1,2,...,10
        --> rpn clear
            for i in {1..10}; do
                rpn $i x^2 5 + +
            done
            rpn =               --> 435

-- 
William Park <[EMAIL PROTECTED]>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
           http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
          http://freshmeat.net/projects/bashdiff/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to