Bisection method example The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Chaotic iterative example neededUnderstanding what to do for relative error when p = 0 (bisection method)Matlab Coding finding zeros without using fzero or roots functionHow to guess initial intervals for bisection method in order to reduce the no. of iterations?how do I find out the speed at which an equation changes it's direction to come up with an appropriate interval for my Bisection methodBisection Method for root findingHow does Horner method evaluate the derivative of a functionAsymmetric bisectionNon-linear assumed form in Galerkin methodLooking for a modified Newton-Raphson method
Windows 10: How to Lock (not sleep) laptop on lid close?
Why doesn't a hydraulic lever violate conservation of energy?
Why can't devices on different VLANs, but on the same subnet, communicate?
different output for groups and groups USERNAME after adding a username to a group
Python - Fishing Simulator
Identify 80s or 90s comics with ripped creatures (not dwarves)
How to handle characters who are more educated than the author?
should truth entail possible truth
Was credit for the black hole image misappropriated?
Mortgage adviser recommends a longer term than necessary combined with overpayments
Could an empire control the whole planet with today's comunication methods?
What's the point in a preamp?
Simulating Exploding Dice
How do you keep chess fun when your opponent constantly beats you?
How to support a colleague who finds meetings extremely tiring?
Did the new image of black hole confirm the general theory of relativity?
Loose spokes after only a few rides
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Are there continuous functions who are the same in an interval but differ in at least one other point?
Is an up-to-date browser secure on an out-of-date OS?
60's-70's movie: home appliances revolting against the owners
Student Loan from years ago pops up and is taking my salary
One-dimensional Japanese puzzle
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
Bisection method example
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Chaotic iterative example neededUnderstanding what to do for relative error when p = 0 (bisection method)Matlab Coding finding zeros without using fzero or roots functionHow to guess initial intervals for bisection method in order to reduce the no. of iterations?how do I find out the speed at which an equation changes it's direction to come up with an appropriate interval for my Bisection methodBisection Method for root findingHow does Horner method evaluate the derivative of a functionAsymmetric bisectionNon-linear assumed form in Galerkin methodLooking for a modified Newton-Raphson method
$begingroup$
I'm writing a small program to resolve functions using bisection method. I want to test the case when the method finds 2 roots, but I can't find examples.
Can anyone give me an example of a function that when resoved using bisection method gives 2 roots?
My only request is that when evaluated, the function does not evaluate 0 (because f(a)*f(b) using 0 will give 0).
Thanks.
numerical-methods
$endgroup$
add a comment |
$begingroup$
I'm writing a small program to resolve functions using bisection method. I want to test the case when the method finds 2 roots, but I can't find examples.
Can anyone give me an example of a function that when resoved using bisection method gives 2 roots?
My only request is that when evaluated, the function does not evaluate 0 (because f(a)*f(b) using 0 will give 0).
Thanks.
numerical-methods
$endgroup$
3
$begingroup$
Usually the bisection method is written so that it only finds one root at a time between $a$ and $b$. Maybe you can modify your method so that after finding one root, it changes the endpoints $a$ and $b$ to look for another root?
$endgroup$
– badjr
Apr 1 '13 at 0:10
$begingroup$
I am confused about what you mean. Are you looking for a $f(x) = ax^2 + bx + c$ with two unique roots or two identical roots or something else?
$endgroup$
– Amzoti
Apr 1 '13 at 0:11
$begingroup$
@deezy: I need to find 2 roots. It's mandatory for my program.
$endgroup$
– Ashir
Apr 1 '13 at 0:15
1
$begingroup$
@Amzoti: Any function wich gives 2 roots it's ok. f(x)=(x-1)(x-2) gives me 2 roots (1 and 2), but as I say I don't want to evaluate 0 (f(x)=(x-1)(x-2) evaluates on 0 and 3).
$endgroup$
– Ashir
Apr 1 '13 at 0:18
add a comment |
$begingroup$
I'm writing a small program to resolve functions using bisection method. I want to test the case when the method finds 2 roots, but I can't find examples.
Can anyone give me an example of a function that when resoved using bisection method gives 2 roots?
My only request is that when evaluated, the function does not evaluate 0 (because f(a)*f(b) using 0 will give 0).
Thanks.
numerical-methods
$endgroup$
I'm writing a small program to resolve functions using bisection method. I want to test the case when the method finds 2 roots, but I can't find examples.
Can anyone give me an example of a function that when resoved using bisection method gives 2 roots?
My only request is that when evaluated, the function does not evaluate 0 (because f(a)*f(b) using 0 will give 0).
Thanks.
numerical-methods
numerical-methods
asked Mar 31 '13 at 23:59
AshirAshir
101
101
3
$begingroup$
Usually the bisection method is written so that it only finds one root at a time between $a$ and $b$. Maybe you can modify your method so that after finding one root, it changes the endpoints $a$ and $b$ to look for another root?
$endgroup$
– badjr
Apr 1 '13 at 0:10
$begingroup$
I am confused about what you mean. Are you looking for a $f(x) = ax^2 + bx + c$ with two unique roots or two identical roots or something else?
$endgroup$
– Amzoti
Apr 1 '13 at 0:11
$begingroup$
@deezy: I need to find 2 roots. It's mandatory for my program.
$endgroup$
– Ashir
Apr 1 '13 at 0:15
1
$begingroup$
@Amzoti: Any function wich gives 2 roots it's ok. f(x)=(x-1)(x-2) gives me 2 roots (1 and 2), but as I say I don't want to evaluate 0 (f(x)=(x-1)(x-2) evaluates on 0 and 3).
$endgroup$
– Ashir
Apr 1 '13 at 0:18
add a comment |
3
$begingroup$
Usually the bisection method is written so that it only finds one root at a time between $a$ and $b$. Maybe you can modify your method so that after finding one root, it changes the endpoints $a$ and $b$ to look for another root?
$endgroup$
– badjr
Apr 1 '13 at 0:10
$begingroup$
I am confused about what you mean. Are you looking for a $f(x) = ax^2 + bx + c$ with two unique roots or two identical roots or something else?
$endgroup$
– Amzoti
Apr 1 '13 at 0:11
$begingroup$
@deezy: I need to find 2 roots. It's mandatory for my program.
$endgroup$
– Ashir
Apr 1 '13 at 0:15
1
$begingroup$
@Amzoti: Any function wich gives 2 roots it's ok. f(x)=(x-1)(x-2) gives me 2 roots (1 and 2), but as I say I don't want to evaluate 0 (f(x)=(x-1)(x-2) evaluates on 0 and 3).
$endgroup$
– Ashir
Apr 1 '13 at 0:18
3
3
$begingroup$
Usually the bisection method is written so that it only finds one root at a time between $a$ and $b$. Maybe you can modify your method so that after finding one root, it changes the endpoints $a$ and $b$ to look for another root?
$endgroup$
– badjr
Apr 1 '13 at 0:10
$begingroup$
Usually the bisection method is written so that it only finds one root at a time between $a$ and $b$. Maybe you can modify your method so that after finding one root, it changes the endpoints $a$ and $b$ to look for another root?
$endgroup$
– badjr
Apr 1 '13 at 0:10
$begingroup$
I am confused about what you mean. Are you looking for a $f(x) = ax^2 + bx + c$ with two unique roots or two identical roots or something else?
$endgroup$
– Amzoti
Apr 1 '13 at 0:11
$begingroup$
I am confused about what you mean. Are you looking for a $f(x) = ax^2 + bx + c$ with two unique roots or two identical roots or something else?
$endgroup$
– Amzoti
Apr 1 '13 at 0:11
$begingroup$
@deezy: I need to find 2 roots. It's mandatory for my program.
$endgroup$
– Ashir
Apr 1 '13 at 0:15
$begingroup$
@deezy: I need to find 2 roots. It's mandatory for my program.
$endgroup$
– Ashir
Apr 1 '13 at 0:15
1
1
$begingroup$
@Amzoti: Any function wich gives 2 roots it's ok. f(x)=(x-1)(x-2) gives me 2 roots (1 and 2), but as I say I don't want to evaluate 0 (f(x)=(x-1)(x-2) evaluates on 0 and 3).
$endgroup$
– Ashir
Apr 1 '13 at 0:18
$begingroup$
@Amzoti: Any function wich gives 2 roots it's ok. f(x)=(x-1)(x-2) gives me 2 roots (1 and 2), but as I say I don't want to evaluate 0 (f(x)=(x-1)(x-2) evaluates on 0 and 3).
$endgroup$
– Ashir
Apr 1 '13 at 0:18
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
If you evaluate $f(x)$ and get zero, you have found a root. Bisection should report it and move on to the next stage. Consider a function like $f(x)=(x-1)(x-2)$. Somehow you have to find the interval $(a,2)$ where the function is negative. Now you take one point outside $(1,2)$ and one point inside it as your starting points. Bisection will converge on $1$ or $2$ (whichever is in the interval you start with). Say you find $1$. In theory, you can now consider $frac f(x)x-1$ and if you can find points with opposite signs you can use bisection again to find the root of that. The problem is that maybe you don't find $1$ exactly, so your new function will not be exactly $g(x)=x-2$, but it will be close.
$endgroup$
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
1
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f347730%2fbisection-method-example%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
If you evaluate $f(x)$ and get zero, you have found a root. Bisection should report it and move on to the next stage. Consider a function like $f(x)=(x-1)(x-2)$. Somehow you have to find the interval $(a,2)$ where the function is negative. Now you take one point outside $(1,2)$ and one point inside it as your starting points. Bisection will converge on $1$ or $2$ (whichever is in the interval you start with). Say you find $1$. In theory, you can now consider $frac f(x)x-1$ and if you can find points with opposite signs you can use bisection again to find the root of that. The problem is that maybe you don't find $1$ exactly, so your new function will not be exactly $g(x)=x-2$, but it will be close.
$endgroup$
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
1
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
add a comment |
$begingroup$
If you evaluate $f(x)$ and get zero, you have found a root. Bisection should report it and move on to the next stage. Consider a function like $f(x)=(x-1)(x-2)$. Somehow you have to find the interval $(a,2)$ where the function is negative. Now you take one point outside $(1,2)$ and one point inside it as your starting points. Bisection will converge on $1$ or $2$ (whichever is in the interval you start with). Say you find $1$. In theory, you can now consider $frac f(x)x-1$ and if you can find points with opposite signs you can use bisection again to find the root of that. The problem is that maybe you don't find $1$ exactly, so your new function will not be exactly $g(x)=x-2$, but it will be close.
$endgroup$
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
1
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
add a comment |
$begingroup$
If you evaluate $f(x)$ and get zero, you have found a root. Bisection should report it and move on to the next stage. Consider a function like $f(x)=(x-1)(x-2)$. Somehow you have to find the interval $(a,2)$ where the function is negative. Now you take one point outside $(1,2)$ and one point inside it as your starting points. Bisection will converge on $1$ or $2$ (whichever is in the interval you start with). Say you find $1$. In theory, you can now consider $frac f(x)x-1$ and if you can find points with opposite signs you can use bisection again to find the root of that. The problem is that maybe you don't find $1$ exactly, so your new function will not be exactly $g(x)=x-2$, but it will be close.
$endgroup$
If you evaluate $f(x)$ and get zero, you have found a root. Bisection should report it and move on to the next stage. Consider a function like $f(x)=(x-1)(x-2)$. Somehow you have to find the interval $(a,2)$ where the function is negative. Now you take one point outside $(1,2)$ and one point inside it as your starting points. Bisection will converge on $1$ or $2$ (whichever is in the interval you start with). Say you find $1$. In theory, you can now consider $frac f(x)x-1$ and if you can find points with opposite signs you can use bisection again to find the root of that. The problem is that maybe you don't find $1$ exactly, so your new function will not be exactly $g(x)=x-2$, but it will be close.
answered Apr 1 '13 at 0:47
Ross MillikanRoss Millikan
301k24200375
301k24200375
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
1
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
add a comment |
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
1
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
I don't have problems with functions getting 0, after all that's the point in bisection method. My problem is, if I follow step one (f(a)*f(b)<0) most of the time my program can't find a root in that interval. For example link f(x)=x^2-x-3=0 will give me 2 roots: x = ~~ -1.3027 and ~~ 2.3027, so, the roots are between -2 and 3, but f(-2)*f(3) will return 9, so it will fail step one of the method because it's not < than 0 (f(a) it's possitive and f(b) is also possitive, when they should have different signs)...
$endgroup$
– Ashir
Apr 1 '13 at 1:05
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
$begingroup$
You have to bracket the roots first for bisect ion. That is, you need to find $a,b$ with $f(a)f(b) lt 0$ otherwise you don't know there is a root to find at all. Think about$ x^2-x+3$. If you start with $-2,3$ there are no roots inside.
$endgroup$
– Ross Millikan
Apr 1 '13 at 1:33
1
1
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
$begingroup$
Before you can start the Bisection Method, you have to detect a sign change. After that, the Method will find one root. If Bisection is to be used for another root in the interval, a sign change will have to be detected in an interval thAt was discarded in the first run.
$endgroup$
– André Nicolas
Aug 22 '13 at 17:23
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f347730%2fbisection-method-example%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
$begingroup$
Usually the bisection method is written so that it only finds one root at a time between $a$ and $b$. Maybe you can modify your method so that after finding one root, it changes the endpoints $a$ and $b$ to look for another root?
$endgroup$
– badjr
Apr 1 '13 at 0:10
$begingroup$
I am confused about what you mean. Are you looking for a $f(x) = ax^2 + bx + c$ with two unique roots or two identical roots or something else?
$endgroup$
– Amzoti
Apr 1 '13 at 0:11
$begingroup$
@deezy: I need to find 2 roots. It's mandatory for my program.
$endgroup$
– Ashir
Apr 1 '13 at 0:15
1
$begingroup$
@Amzoti: Any function wich gives 2 roots it's ok. f(x)=(x-1)(x-2) gives me 2 roots (1 and 2), but as I say I don't want to evaluate 0 (f(x)=(x-1)(x-2) evaluates on 0 and 3).
$endgroup$
– Ashir
Apr 1 '13 at 0:18