Post Reply 
Programming puzzle: Symplifying (simple) fractions containing square roots
04-14-2017, 07:36 PM (This post was last modified: 04-14-2017 07:44 PM by Han.)
Post: #2
RE: Programming puzzle: Symplifying (simple) fractions containing square roots
Are you aware that the HP50G can handle "exact" integers of "infinite" size (up to the limit of RAM)? The problem can be solved with just a few lines of code since the HP50G handles integers natively.

\[ \frac{a\sqrt{b}}{c\sqrt{d}} = \sqrt{\frac{a^2\cdot b}{c^2\cdot d}} \]

So compute \(\frac{a^2\cdot b }{c^2\cdot d} \) and take the square root. Just make sure you use exact integers as inputs.

EDIT: a b c d SWAP SQ * ROT SQ ROT * SWAP / \( \sqrt{\quad} \)

Extracting the integers is left as an exercise for the reader (but it too is a fairly short snippet of code)

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzle: Symplifying (simple) fractions containing square roots - Han - 04-14-2017 07:36 PM



User(s) browsing this thread: 1 Guest(s)