WP 34S --> WP 31S
04-13-2014, 12:17 PM
Post: #301
 Paul Dale Senior Member Posts: 1,839 Joined: Dec 2013
RE: WP 34S --> WP 31S
You missed the reflection formula to produce an analytic continuation for entire real and complex domains (excepting negative integers and zero of course)

The 34S does all of these BTW using a rather more modern approximation from memory. Sadly, this is one function that took a couple of goes to get accurate but worth the effort nonetheless.

- Pauli
04-13-2014, 02:19 PM (This post was last modified: 04-13-2014 03:51 PM by Thomas Klemm.)
Post: #302
 Thomas Klemm Senior Member Posts: 2,115 Joined: Dec 2013
RE: WP 34S --> WP 31S
(04-13-2014 11:10 AM)Paul Dale Wrote:  Factorial isn't tail recursive

It's easy if you try:
Code:
factorial(n) = factorial_helper(n, 1) factorial_helper(n, prod) =      if n > 0 then         factorial_helper(n - 1, prod * n)     else         prod

PS: There's something missing in your code leading to a stack overflow.
04-13-2014, 09:25 PM
Post: #303
 Paul Dale Senior Member Posts: 1,839 Joined: Dec 2013
RE: WP 34S --> WP 31S
I'd still posit that coding the iterative version is now easier than the change to the tail recursive form

Yes, I missed the exit condition, that wasn't my intention in that code snippet.

- Pauli
04-14-2014, 01:17 AM
Post: #304
 Thomas Klemm Senior Member Posts: 2,115 Joined: Dec 2013
RE: WP 34S --> WP 31S
What if "coding the iterative version" isn't supported by the language?
04-14-2014, 01:33 AM
Post: #305
 Manolo Sobrino Member Posts: 179 Joined: Dec 2013
RE: WP 34S --> WP 31S
OK, I can't make more sense of this calculator à la HP than this layout:

Discussion in the next few days, I guess.
04-14-2014, 08:42 AM
Post: #306
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: WP 34S --> WP 31S
How about running a poll? Should be in a new thread, however.

vs.

d:-)
04-14-2014, 10:12 AM
Post: #307
 Manolo Sobrino Member Posts: 179 Joined: Dec 2013
RE: WP 34S --> WP 31S
(04-14-2014 08:42 AM)walter b Wrote:  How about running a poll? Should be in a new thread, however.
d:-)

Let's go for it!

 « Next Oldest | Next Newest »

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