How to Ensure Bracketing in Numerical Methods

In summary: Actually I am confused how to calculate w3 at each iteration , and what to take w1 and w2 each timeYou start with ωlow=1 and ωhi=1000. At any stage, you compute the midpoint by averaging ωlow and ωhi. For example, for...You start with ωlow=1 and ωhi=1000. At any stage, you compute the midpoint by averaging ωlow and ωhi. For example, for ωlow=500 and ωhi=1000, the midpoint would be ωmid=500.
  • #1
shyjuu
13
0


I had tried to solve but the problem is here initial guess is given as 1 and 1000 but both has positive value of function , so wat to do now how to determine x3 which is x1+x2, wat to take x1 and x2 in second iteration, just guide me how to solve

Thanks a lot for ur replies
 

Attachments

  • Bisection k.JPG
    Bisection k.JPG
    15.3 KB · Views: 371
Physics news on Phys.org
  • #2
Please don't use text speech.

You can use a root finding algorithm to solve for f(x)=a, but simply using the root finding algorithm to find where f(x)=0 obviously is not going to yield a solution to f(x)=a. You need to define a new function, g(x)=f(x)-a. Using a root finding algorithm on g(x)=0 will find the solutions of f(x)=a.
 
  • #3
D H said:
Please don't use text speech.

You can use a root finding algorithm to solve for f(x)=a, but simply using the root finding algorithm to find where f(x)=0 obviously is not going to yield a solution to f(x)=a. You need to define a new function, g(x)=f(x)-a. Using a root finding algorithm on g(x)=0 will find the solutions of f(x)=a.

Yes i had used gerneral Bisection fornula to find the solution, and can u please elaborate more

Thanks in advance
 
  • #4
shyjuu said:

The Attempt at a Solution



I had tried to solve but the problem is here initial guess is given as 1 and 1000 but both has positive value of function , so wat to do now how to determine x3 which is x1+x2, wat to take x1 and x2 in second iteration, just guide me how to solve

Thanks a lot for ur replies

The 'bisection method' means just that. You are originally given the interval ω = [1,1000]. Your next interval can be ω = [1,500] or ω = [500,1000]. x3 isn't x1+x2, but 0.5*(x1+x2). You get to pick which of the original endpoints to use in the next interval after calculating the midpoint of the original interval.

If your problem was to find the roots of [itex]y = x^{2}-4[/itex] using an initial interval of x = [-3,3], y(x1) and y(x2) for this interval would both be positive. Therefore, one or both roots may lie within the original interval, but you can't know for certain unless you check additional values of x within that initial interval.
 
  • #5
SteamKing said:
The 'bisection method' means just that. You are originally given the interval ω = [1,1000]. Your next interval can be ω = [1,500] or ω = [500,1000]. x3 isn't x1+x2, but 0.5*(x1+x2). You get to pick which of the original endpoints to use in the next interval after calculating the midpoint of the original interval.

If your problem was to find the roots of [itex]y = x^{2}-4[/itex] using an initial interval of x = [-3,3], y(x1) and y(x2) for this interval would both be positive. Therefore, one or both roots may lie within the original interval, but you can't know for certain unless you check additional values of x within that initial interval.

Thanks, Yes i know its formula is (x1+x2)/2 , but the problem is (1+1000)/2 is 500.5 now the problem is f(1) = +ve and f(1000) is also+ve , also f(500.5) is +ve , my Question is how can we determine next point whether to take 500.5 and 1 or 500.5 and 1000 for calculating next x3
 
  • #6
Apparently you are using ##f(\omega) = 1/\sqrt{1/R^2 + (\omega C - 1/(\omega L))^2}##. That's obviously positive for all real ω. You aren't trying to find where this function f(ω) is zero, which is what a root finding algorithm searches for. You are trying to find where it takes on a value of 75 ohms.
 
  • #7
D H said:
Apparently you are using ##f(\omega) = 1/\sqrt{1/R^2 + (\omega C - 1/(\omega L))^2}##. That's obviously positive for all real ω. You aren't trying to find where this function f(ω) is zero, which is what a root finding algorithm searches for. You are trying to find where it takes on a value of 75 ohms.

but I am not getting 75 ohm as answer after several iterations , so what to do now
 
  • #8
Show your work! I can't read your mind to see where you've made a mistake (and you most certainly have made a mistake of some kind).

In particular, please show ωlow, f(ωlow), ωhigh, f(ωhigh), ωmid, and f(ωmid). The first three or four steps should be enough to see what you've done wrong.
 
  • #9
D H said:
Show your work! I can't read your mind to see where you've made a mistake (and you most certainly have made a mistake of some kind).

In particular, please show ωlow, f(ωlow), ωhigh, f(ωhigh), ωmid, and f(ωmid). The first three or four steps should be enough to see what you've done wrong.

Actually I am confused how to calculate w3 at each iteration , and what to take w1 and w2 each time
 
  • #10
You start with ωlow=1 and ωhi=1000. At any stage, you compute the midpoint by averaging ωlow and ωhi. For example, for the first step you would use ωmid=500.5.

What impedances do you get for 1 Hz, 1000 Hz, and 500.5 Hz?
 
  • #11
D H said:
You start with ωlow=1 and ωhi=1000. At any stage, you compute the midpoint by averaging ωlow and ωhi. For example, for the first step you would use ωmid=500.5.

What impedances do you get for 1 Hz, 1000 Hz, and 500.5 Hz?

z=173 , now for 2 iteration I take w1=1 and w2=500.5 w3=250.75 here I get z=111

similarly calculating liek this I am not getting z=75
 
  • #12
You're getting closer, though. Bisection isn't noted for being speedy.

What are your next two steps? That's what's going to tell me if you made a mistake.
 
  • #13
D H said:
You're getting closer, though. Bisection isn't noted for being speedy.

What are your next two steps? That's what's going to tell me if you made a mistake.

60.87 but it should be near to 70 I think, now should I do more iterations
 
  • #14
Why do you think that? Bisection is slow, but it's slow and steady. Bisection is always the last fallback to solving an ill-behaved function because it always works. Other techniques can be much faster, but sometimes they blow up, sometimes they get stuck. Bisection always halves the interval on each step, so it is guaranteed to eventually find the solution. (Once you have it bracketed of course. You were given two values that bracketed the solution.)
 
  • #15
D H said:
Why do you think that? Bisection is slow, but it's slow and steady. Bisection is always the last fallback to solving an ill-behaved function because it always works. Other techniques can be much faster, but sometimes they blow up, sometimes they get stuck. Bisection always halves the interval on each step, so it is guaranteed to eventually find the solution. (Once you have it bracketed of course. You were given two values that bracketed the solution.)

but solving for more 3 to 4 iteration I am not getting near to answer my next answer is coming 30 then 11 and like that so would it come to 70 after this numbers also
 
  • #16
You are doing something wrong then. Show me what you have done. Can you make a table like this to show your progress?

Code:
step   wlo    f(wlo)     whi     f(whi)   wmid    f(wmid)
  1    1.0000  0.500  1000.0000 214.605  500.5000 173.003
  2    1.0000  0.500   500.5000 173.003  250.7500 111.116
  3    1.0000  0.500   250.7500 111.116  125.8750  60.879

Please show your equivalent, and show the next three or four lines after the steps I've shown.

I cannot help you find your problem if you do not show your work!
 
  • #17
D H said:
You are doing something wrong then. Show me what you have done. Can you make a table like this to show your progress?

Code:
step   wlo    f(wlo)     whi     f(whi)   wmid    f(wmid)
  1    1.0000  0.500  1000.0000 214.605  500.5000 173.003
  2    1.0000  0.500   500.5000 173.003  250.7500 111.116
  3    1.0000  0.500   250.7500 111.116  125.8750  60.879

Please show your equivalent, and show the next three or four lines after the steps I've shown.

I cannot help you find your problem if you do not show your work!

I am getting exactly same till here , is there any need to calculate f(wlo) and f(whi) because every time you will get positive value so we need to just replace x1(wlow) by x3(wmid) , yes I am posting it wait
 
  • #18
shyjuu said:
I am getting exactly same till here , is there any need to calculate f(wlo) and f(whi) because every time you will get positive value so we need to just replace x1(wlow) by x3(wmid) , yes I am posting it wait

I think we are following wrong procedure because since f(w3) is always positive we need to replace w1 and w2 so in second iteration we should take w1=500.5 and w2= 1000 , in every iteration w2 will be 1000 and w1 will be replace with new value, but by solving like this also I am not getting , at 6 and 7 iteration I am getting 214 but this is not the answer , we need to get 70, so are we doing anything wrong?
 
  • #19
Why can't you just do what I asked? Helping you is getting rather frustrating.

shyjuu said:
I think we are following wrong procedure because since f(w3) is always positive we need to replace w1 and w2 so in second iteration we should take w1=500.5 and w2= 1000 , in every iteration w2 will be 1000 and w1 will be replace with new value, but by solving like this also I am not getting , at 6 and 7 iteration I am getting 214 but this is not the answer , we need to get 70, so are we doing anything wrong?
Yes, you are doing something wrong. You absolutely should not take w1=500.5 and w2= 1000 on the second iteration. You no longer have the solution bracketed when you do this.

What does "bracketed" mean? If you are trying to solve f(x)=0 you need to ensure that f(x1) and f(x2) have opposite signs. If the function is continuous, there must exist at least one point x that lies somewhere between x1 and x2 such that f(x)=0.

If you are trying to solve f(x)=a where a is some non-zero constant you need to ensure that f(x1) and f(x2) lie on opposite sides of the desired value a. So for step 1, we have ω1=1, ω2=1000. Note that these bracket the solution f(ω)=75 because f(ω1)=0.5<75 and f(ω2)=214.6>75. The midpoint is ω3=500.5, where f(ω3)=173. Choosing to replace ω1 with ω3 is absolutely the wrong choice. With this choice you have ω1=500.5 and ω2=1000, with f(ω1)=173 and f(ω2)=214.6. Both are above 75. You have violated the bracketing condition. Game over.

In that first step you must replace ω2 with ω3 to keep the solution bracketed. The same goes for the next step where ω3=250.75 and f(ω3)=111.116. Once again, both f(ω2) and f(ω3) are greater than 75.

What happens on the next step, which would be the next line in my table? Here ω3=125.875 and f(ω3)=60.879. Hint: Is this value greater than or less than 75? Which value does that say you should replace?
 
  • #20
D H said:
Why can't you just do what I asked? Helping you is getting rather frustrating.


Yes, you are doing something wrong. You absolutely should not take w1=500.5 and w2= 1000 on the second iteration. You no longer have the solution bracketed when you do this.

What does "bracketed" mean? If you are trying to solve f(x)=0 you need to ensure that f(x1) and f(x2) have opposite signs. If the function is continuous, there must exist at least one point x that lies somewhere between x1 and x2 such that f(x)=0.

If you are trying to solve f(x)=a where a is some non-zero constant you need to ensure that f(x1) and f(x2) lie on opposite sides of the desired value a. So for step 1, we have ω1=1, ω2=1000. Note that these bracket the solution f(ω)=75 because f(ω1)=0.5<75 and f(ω2)=214.6>75. The midpoint is ω3=500.5, where f(ω3)=173. Choosing to replace ω1 with ω3 is absolutely the wrong choice. With this choice you have ω1=500.5 and ω2=1000, with f(ω1)=173 and f(ω2)=214.6. Both are above 75. You have violated the bracketing condition. Game over.

In that first step you must replace ω2 with ω3 to keep the solution bracketed. The same goes for the next step where ω3=250.75 and f(ω3)=111.116. Once again, both f(ω2) and f(ω3) are greater than 75.

What happens on the next step, which would be the next line in my table? Here ω3=125.875 and f(ω3)=60.879. Hint: Is this value greater than or less than 75? Which value does that say you should replace?

This is really helpful , great insight, let me try by following this rule
 

1. What are numerical methods?

Numerical methods are mathematical techniques and algorithms used to obtain approximate solutions to mathematical problems that cannot be solved exactly. These methods involve converting a continuous problem to a discrete one and using a computer to perform calculations.

2. How are numerical methods different from analytical methods?

Numerical methods involve approximating the solution to a problem, while analytical methods produce an exact solution using algebraic and calculus techniques. Numerical methods are often used when analytical solutions are not possible or too complex.

3. What are some common numerical methods used in scientific research?

Some common numerical methods used in scientific research include numerical integration, root-finding methods, linear and nonlinear regression, and optimization techniques. These methods are used to solve problems in many different fields, such as physics, engineering, and economics.

4. What are the benefits of using numerical methods?

Numerical methods allow us to solve complex problems that would be impossible or extremely time-consuming to solve using analytical methods. They also provide a way to validate and test analytical solutions, and can handle a wide range of mathematical functions and equations.

5. What are some potential limitations of numerical methods?

Numerical methods are subject to round-off errors and truncation errors, which can affect the accuracy of the solution. They also require a significant amount of computational power and may not always produce a precise solution. Additionally, the choice of numerical method and its parameters can greatly impact the accuracy and efficiency of the solution.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
888
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
704
  • Advanced Physics Homework Help
Replies
11
Views
1K
Replies
16
Views
1K
Replies
20
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
3K
  • Differential Equations
Replies
5
Views
2K
Replies
14
Views
2K
Back
Top