Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno
Options

Go back

Topic review (newest first)

mikau
2008-01-04 22:58:49

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.

luca-deltodesco
2008-01-04 20:38:01

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

MathsIsFun
2008-01-04 08:35:22

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

luca-deltodesco
2008-01-04 02:23:48

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

Board footer

Powered by FluxBB