- #26

- 38

- 0

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Brendy
- Start date

- #26

- 38

- 0

- #27

- 15,415

- 687

- #28

- 38

- 0

- #29

- 15,415

- 687

Correct.Since tan(n*pi)=0 it says that x=tan (theta)?

Veering off course. Make the substitution on both sides of the equality, and remember that a fixed point iteration based on tangent is not stable. You need to use atan.Theta=arctan (x). So tan(theta)=n*pi +arctan(x). I'm I veering off course? It kind of feels like it :P

Don't worry about x until you have found theta.

- #30

- 38

- 0

That narrows it down a fair bit. I'm not sure what the exact forms of atan(n*pi) and atan((n+1/2)pi) are though.

- #31

- 15,415

- 687

[tex]x=\tan x[/tex]

using a fixed point iteration approach. That technique won't work with the above because tan'(x)>=1. Taking the inverse tangent

You have already written x as [itex]x=n\pi + \theta[/itex]. Substituting this on both sides of the above equation yields

[tex]n\pi + \theta=\tan(n\pi + \theta) = \tan\theta[/tex]

By design, [itex]\theta\,\in\,(0,\pi/2)\,\forall n>0[/itex] In other words, theta is in the principal domain of atan, so you now can take the inverse tangent of both sides of the above. Do that.

- #32

- 38

- 0

atan(n[tex]\pi[/tex] + [tex]\theta[/tex])= (n[tex]\pi[/tex] +[tex]\theta[/tex]) = [tex]\theta[/tex]

So theta is periodic like the sin or cos functions?

- #33

- 15,415

- 687

You do not know that [itex]\arctan(\tan(n\pi+\theta))=n\pi+\theta[/itex]. In fact, this is not true. The domain of arctan is -pi/2 to pi/2 (at least as implemented in most programming languages). However, you do know that [itex]\tan(n\pi+\theta)=\tan\theta[/itex] due to trig identities.

- #34

- 38

- 0

If it does, then arctan (n*pi + [tex]\theta[/tex])=([tex]\theta[/tex]). I think I'm going in circles.

- #35

- 15,415

- 687

It does if theta is in the principal domain of arctan. That was the point of creating that variable: to ensure that it does lie in the principal domain of arctan.Ok. Does arctan (tan ([tex]\theta))=\theta[/tex]?

Yes, you are. So, one step at a time.If it does, then arctan (n*pi + [tex]\theta[/tex])=([tex]\theta[/tex]). I think I'm going in circles.

- You want to find the positive solutions to [itex]x=\tan x[/itex].
- This is in the right form for fixed point iteration, but a fixed point iteration using the above will not converge.
- Taking the inverse tangent of both sides doesn't help immediately because all solutions but the trivial solution lie outside the principal domain of arctan.
- So, introduce a new variable that will be in the principal domain: [itex]x\equiv n\pi+\theta[/itex].
- Now the problem becomes one of solving [itex]n\pi+\theta = \tan(n\pi+\theta)[/itex].
- The right hand side of the above, [itex]\tan(n\pi+\theta)[/itex], reduces to [itex]\tan\theta[/itex] via the trig identity [itex]\tan(a+b) = (\tan a + \tan b)/(1-\tan a \tan b)[/itex].
- Now the problem becomes one of solving [itex]n\pi+\theta = \tan\theta[/itex].
- And now you
*can*safely apply the arc tangent function to both sides because, by design, theta is in the principal domain of arctan.

Try to take it from here.

Last edited:

- #36

- 38

- 0

Isn't that what I wrote above? arctan ([itex] n\pi+\theta) = \theta\

[/itex]

[/itex]

- #37

- 15,415

- 687

Fine. Can you take it forward from post#35?

- #38

- 38

- 0

My first instinct is to get everything in terms of x which would mean that arctan(x) = theta but I see that I did that a few posts ago but that was going off course and it doesn't really get me anywhere.

- #39

- 15,415

- 687

This isn't that hard. Look at step 7 in post number 35.

- #40

- 38

- 0

arctan [itex] (x) = x - n\pi\ [/itex]

so,

[itex] x = arctan (x) + n\pi\ [/itex]

This actually looks correct for once.

- #41

- 15,415

- 687

That's not right. Forget about x! You need to solve for theta.

- #42

- 38

- 0

(n\pi+\theta) = \theta\

[/itex]

That's as far as I can get in solving it. I'm not sure how to proceed from there.

- #43

- 15,415

- 687

- #44

- 38

- 0

\theta\ = arctan (n\pi+\theta)

[/itex]

So that's it? Do I try and get everything in terms of x now or is this what the algorithm will use?

- #45

- 15,415

- 687

That's it. You will solve for x at the very end.

- #46

- 38

- 0

- #47

- 15,415

- 687

That said, it's not too hard to form a very good guess. The solution for theta will be close to pi/2 (very close for large

[tex]\theta_n = \frac{\pi}2 - \epsilon_n[/tex]

Thus [itex]\tan\theta_n = 1/\tan\epsilon_n \approx 1/\epsilon_n[/itex] if [itex]\epsilon_n[/itex] is small (which it will be).

See if you can take it from here. Or just use some value between 0 and pi/2 as your initial guess.

- #48

- 38

- 0

Thanks alot, you've been a massive help.

One last thing, what are f_old and f_new doing in my code? After I edit the line x_new.... to the expression for theta, it will converge on a root but I'm not sure what those two lines after that mean. Are they needed?

Also, is it supposed to converge so quickly? At the moment, it converges on the first root within 5 iterations with 1 as an initial guess.

One last thing, what are f_old and f_new doing in my code? After I edit the line x_new.... to the expression for theta, it will converge on a root but I'm not sure what those two lines after that mean. Are they needed?

Also, is it supposed to converge so quickly? At the moment, it converges on the first root within 5 iterations with 1 as an initial guess.

Last edited:

- #49

- 15,415

- 687

Last thing: I wouldn't bother with the trivial solution. You know that solution, and a fixed point iteration scheme isn't really valid for finding the trivial solution because it sits right at a point where tan'(x)=atan'(x)=1. The derivative has to be strictly less than one for a fixed point iteration to converge.

- #50

- 38

- 0

Which solution are you referring to? Even changing the initial guess to something further away from the root such as 0.5 sees it converging within 6 iterations.

Share:

- Replies
- 3

- Views
- 695