On Monday 01 November 2004 23:36, Brian Mitchell wrote:
> > I have been writing some code that can differentiate expressions.
> > for instance:  x^3 ->  3*x^2.
> >
> > Here is the code:
> > http://rubyforge.org/cgi-bin/viewcvs.cgi/projects/symbol_solver/test_node
> >s.rb?rev=1.22&cvsroot=prime&content-type=text/vnd.viewcvs-markup
>
> I like how short it is. Quite amazing what ruby can accomplish.

Thanks.. Yes.. Ruby is energy. 

Im interested in further improvements.. write more code with less.


> > Still some unsolved issues:
> > 1. reduce  2x+2x  into 4x..  is not implemented.
> > 2. sin/cos/tan  is not implemented.
> > 3. complex numbers is not used in this implementation.
>
> You would need to be able to compair degree if you want to reduce 2x +
> 2x --> 4x. 2 + 2 --> 4 could be looked at like 2x^0 + 2x^0 --> 4x^0.
> Like wise this would be usefull ffor this: 2xy^2 * 3y. 3y = 3 * x^0 *
> y^1 in this case.

Any ideas how this would look like in code?

--
Simon Strandgaard