[Gambas-user] function that finds that value for which an expression = 0

Tobias Boege taboege at ...626...
Tue Jun 11 18:06:07 CEST 2013


On Tue, 11 Jun 2013, Ru Vuott wrote:
> Hello,
> 
> an our friend of italian Gmabs forum asks me to send to this Mailing list a question:
> 
> **********************
> 
> I have an expression (example:+7*(x^3)+6*(x^2)-6*(x^1)+4*(x^0)) as expression (gb.eval) or string and I ask if you can find the value of x for which the expression = 0
> 
> **********************
> 

First of all: what is that for a kind of question? Of course can we find
that x! It's near x = -1.60999. Next time he should google the result or
let wolframalpha calculate it...

I really detest doing this but: maybe I should guess a little more about
what your question was meant to sound like... Do you want an algorithm to
compute/approximate the root of a polynomial in Gambas? How about the
bisection method? Sample project attached - which is far from ready to be
used. It hangs with something like x^2-10. Guess why! :-)

Regards,
Tobi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: root-0.0.1.tar.gz
Type: application/octet-stream
Size: 5007 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130611/6d4cb775/attachment.obj>


More information about the User mailing list