From: Simon Strandgaard Date: 2004-11-11T03:51:56+09:00 Subject: Re: [ann] symbol solver.. early experiments On Tuesday 09 November 2004 23:13, Josef 'Jupp' Schugt wrote: [snip] > Adding is then done by list member: > [4 + 46, 3 + 1, 2 + 0, 1 + 7] = [46, 4, 2, 8] > which represents > 8x**3 + 2x**2 + 4x + 46 [snip diff, mul] An array per variable, maybe something ala { :x = [4, 3, 2], :y = [9, 6] } That should deal with most polynomias. At the moment I have represented polynomias.. as an ast. x^4+x^3+x^2+y^9+y^6 would in ast form.. be: add(add(add(add( exp(mul(4, log(x))), exp(mul(3, log(x)))), exp(mul(2, log(x)))), exp(mul(9, log(y)))), exp(mul(6, log(y)))) maybe I should make a Polynomium class? so it would become add(poly(4,3,2), poly(9,6)) (I had not thought about a polynomium class) > If you take a close look at the indices you see that all ci are the sum > of all products of aj and bk where j+k=i. The implementation in Ruby is > straightforward. Thanks. -- Simon Strandgaard