|
-
Dec 5th, 2004, 08:51 AM
#1
Finding roots of an equation {resolved}
I need to write an algorithm that can find the roots of any equation (of the form y=f(x).
It would have to do it by testing X values at certain points and homing in on the root by finding the sign change. What is the most efficient method of doing this?
Last edited by wossname; Dec 6th, 2004 at 10:26 AM.
Reason: I achieved enlightenment
I don't live here any more.
-
Dec 5th, 2004, 09:39 AM
#2
Fanatic Member
Re: Finding roots of an equation
Are you considering equations with complex roots too?
e.g.
(x^2) = -2
"Any" equation is quite broad.
-
Dec 6th, 2004, 03:15 AM
#3
Re: Finding roots of an equation
Not complex ones no. Only Y=0 (for now)
OK, not ANY curve then 
I'm not doing this by re-arranging equations or any cheating like that, just by calculating the Y at certain X values and interpolating to find roots.
Function Get_Y_Value(x) 'can be treated as a "black box", we don't need to know the equation itself.
I don't live here any more.
-
Dec 6th, 2004, 09:37 AM
#4
Fanatic Member
Re: Finding roots of an equation
So you'll need some sort of heuristic method to produce a reasonable guess at a root, then decrease or increase x depending on whether you're too high or low.
You can scale the increase or decrease amount according to how far from y=0 you are, i.e. decrease the change as you approach y=0.
As for the initial guess, hmm..I don't know really. It probably doesn't matter if your guess is a long way off anyway as long as you use the change-scaling approach..
Also are you going to allow equations with no roots and detect that?
-
Dec 6th, 2004, 10:25 AM
#5
Re: Finding roots of an equation
Its OK. I have sorted it out now. Cheers.
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|