Help to get started with the code of Maxima



Hello,

I don't need to use maxima at the moment, but I have been interested for a
long time in how symbolic maths software work (from afar). What I would
like to try is to implement a function/macro that solve numerically an
equation using Newton-Raphson.
If I could have the function derivative in Common Lisp, the implementation
of Newton Raphson would become straightforward:

(defun newton-raphson (f variable xo tolerance)
  (let ((slope ((derivative f variable) x0))
          (proxy (- x0 (/ (f x0) slope)))
          (y (f proxy)))
     (if (> (abs y) tolerance) (newton-raphson f variable proxy tolerance)
proxy)))

A macro version of this would be able to take a function that was written
previously, expand its definition, calculate its derivative and apply the
same algorithm.

I would just need to have the function derivative that would calculate the
formal derivative of f and Newton Raphson would be implemented, and it
would be possible to use it in a program that would do something not
directly related to maths. Of course, for this particular case they are
ways to implement algorithms to solve one variable equations that don't
require any symbolic maths, but I want to play with example like this.

And yeah, implementing a new feature into maxima would be a dream for me,
but I am still beginner in Common Lisp...

Sam


On Wed, Jun 26, 2013 at 6:59 PM, Raymond Toy <toy.raymond at gmail.com> wrote:

> >>>>> "Samuel" == Samuel  <L? <samuel.le at gmail.com>> writes:
>
>     Samuel> Hi!
>
> [snip]
>
>     Samuel> Please correct me if I am wrong. Now, what I'd like to do
>     Samuel> is to call the maths functions directly from Common Lisp
>     Samuel> (i.e access directly to "some-function-for-derivative" in
>     Samuel> my example). Is it possible to do so?
>
> I'm curious why you want to access the functions directly instead of
> using maxima itself?  Do you want to implement some new feature?  Just
> want to know how it's done?  Something else?
>
> Ray
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>