[Gambas-user] function that finds ... BIS

Benoît Minisini gambas at ...1...
Tue Jun 11 19:57:18 CEST 2013


Le 11/06/2013 18:53, Ru Vuott a écrit :
> Hello Tobi,
>
> our friend thanks you, however he said that he was referring to "Ruffini's rule".
>
> http://en.wikipedia.org/wiki/Ruffini%27s_rule
>
> bye
> vuott
>

In Gambas 3, you can use the gb.gsl component and its 'Polynomial' class 
for that.

For example, to solve '7*(x^3)+6*(x^2)-6*(x^1)+4*(x^0)':

   Dim hPoly As Polynomial
   Dim aSolve As Float[]
   Dim I As Integer

   hPoly = [4, -6, 6, 7]
   Print hPoly.ToString
   aSolve = hPoly.Solve()
   Print aSolve.Count;; "solution(s)"
   For I = 0 To aSolve.Max
     Print aSolve[I]
   Next

Regards,

-- 
Benoît Minisini




More information about the User mailing list