axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Understanding Axiom.


From: Martin Rubey
Subject: Re: [Axiom-developer] Understanding Axiom.
Date: Fri, 09 Jul 2010 10:48:41 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Grigory Sarnitskiy <address@hidden> writes:

> I think I don't understand some aspects of Axiom.
>
> Imagine I want to have a function that returns the derivative of real-valued 
> function of one real variable, something like
>
> Deriv  : ((Float) -> Float) -> ((Float) -> Float)
>
> I want Deriv to handle symbolic computation, not (Deriv f) to be some numeric 
> algorithm to return value for every point.
> So may be for symbolic computation I need another type, not ((Float) -> 
> Float) -> ((Float) -> Float) ?

> What type should I use to deal symbolically with real valued functions
> of real valuables? I guess most natural type like (Float -> Float)
> won't help.

Precisely.  

There are several options, depending on your situation.  The most
general type is Expression Integer:

(1) -> ex := D(exp(x*(log x)), x)

                      x log(x)
   (1)  (log(x) + 1)%e
                                                    Type: Expression(Integer)
To evaluate at a point, use

(2) -> eval(ex, x=1)

   (2)  1
                                                    Type: Expression(Integer)
(3) -> eval(ex, x=%e)

           %e
   (3)  2%e
                                                    Type: Expression(Integer)
(4) -> eval(ex, x=y)

                      y log(y)
   (4)  (log(y) + 1)%e
                                                    Type: Expression(Integer)

Note that we are dealing here not really with functions, but rather with
"expressions" (roughly: with elements of a differential algebra).  The
main drawback of Expression Integer is that there is no reliable way to
test whether two expressions are equal (that's shown to be impossible).
Sometimes you can get by using "normalize":

(1) -> ex1 := exp(x+log x); ex2 := x*exp x;

                                                    Type: Expression(Integer)
(2) -> (ex1 = ex2)@Boolean

   (2)  false
                                                                Type: Boolean
(3) -> zero?(ex1 - ex2)

   (3)  false
                                                                Type: Boolean
(4) -> normalize(ex1) - normalize(ex2)

          log(x) + x       x
   (4)  %e           - x %e
                                                    Type: Expression(Integer)
(5) -> normalize(ex1 - ex2)

   (5)  0
                                                    Type: Expression(Integer)

If you have only rational functions, use Fraction Polynomial Integer
(short: FRAC POLY INT), where it is always possible to decide equality.

Finally, if you know that your functions are algebraic, or satisfy a
linear differential equation, or are differentially algebraic, I have
experimental code that deals with those...

I'd need more info to give a better answer.

Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]