Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2008-01-03 03:23:48

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

interesting little problem

a friend posted me the following problem:

inverse tangent is multi-valued and restricts its result to the range -½π to ½π. how can i get back to the original number if it wasn't in this range? obvously thats impossible since from the result you can have no idea, but he added the restriction of it being a positive integer, and thus becomes feasable

my answer was: (inp is the result of the inverse tangent)

while ((inp += pi)-int(inp)>1e-8);

which works up to the limit of numerical accuracy (only works up to about 200 before failing due to numerical innacuracies)

so as an example.

set inp to atan(tan(125)); run the loop, and you get inp=125.000000016

not very difficult at all, but i still found it interesting

Last edited by luca-deltodesco (2008-01-03 03:24:29)


The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

#2 2008-01-03 09:35:22

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,713

Re: interesting little problem

Is it necessary to work out every "inp + n(pi)" until you find it?


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#3 2008-01-03 21:38:01

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

Re: interesting little problem

well the problem is, how would you find out how many pi's you have to add to get to an integer?


The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

#4 2008-01-03 23:58:49

mikau
Member
Registered: 2005-08-22
Posts: 1,504

Re: interesting little problem

aye, but that seems like... i'm not sure.

could we possibly prove that it is the exact answer?

I guess we can't be sure unless we can find an expression for the tangent of some integer that fits on one piece of paper.


A logarithm is just a misspelled algorithm.

Offline

Board footer

Powered by FluxBB