HP-300s cannot do nCr for many allowable values « Next Oldest | Next Newest »

 ▼ DeboT Member Posts: 59 Threads: 3 Joined: Oct 2010 10-14-2010, 07:36 AM The HP-300s cannot do nCr for many allowable valuesE.g. 200C55 = 7.718340811E49 gives an error on the 300s. Similarly on the Casio fx-85GT plus, and Sharp EL-W506.It seems to me that these new line of calculators all share the same code.Fortunately for the EL-W506, I have a workaround as it has the SUM capability:nCr = 10^(SUM(x=A downto A-B+1, logX) - SUM(X=1 to B, logX)),or as per 506 display: ``` / A-B+1 B \ ( SUM (logX, -1) - SUM (logX) ) \ X=A X=1 / 10 ``` where A = n and B = the lesser of r or n-r.This can then be stored in a formula memory for future use.This formula was adapted from Eamonn's "Updated HP-25 C(n,r) program", message 17 in this thread.Unfortunately HP seems to have only purchased a sub-set of these functions for the 300s and does not contain the SUM function.. Edited to fix a small typo Edited: 14 Oct 2010, 10:07 a.m. after one or more responses were posted ▼ Crawl Senior Member Posts: 306 Threads: 3 Joined: Sep 2009 10-14-2010, 09:08 AM Quote: Fortunately for the EL-W506, I have a workaround as it has the SUM capability: Huh? If you're talking about this calculator, I'm pretty sure it does not have the sum capability. Maybe this one does, though. But the 506w does use Simpson's rule for evaluating integrals, so it can be manipulated into performing sums: The funny (b-a)/2 argument in the integrals is the third argument you give the integrator, the one that indicates how many applications of Simpson's rule are to be used. Obviously that's a pretty complicated formula, but if b-a is large enough it can save some time as compared to entering the sums manually. ▼ DeboT Member Posts: 59 Threads: 3 Joined: Oct 2010 10-14-2010, 09:38 AM Hi Crawl, I'm talking about this calculator, note that the W is before the 506. A small difference in model no., but quite a different calculator :)May be there's a difference in model no.'s for US and EU release, the EL-W516B being the US equivalent of EL-W506? ▼ Gene Wright Posting Freak Posts: 1,545 Threads: 168 Joined: Jul 2005 10-14-2010, 10:27 AM Define "allowable" values. If the nCr or nPr functions are done using the x! function, allowable values will not include the 200. ▼ DeboT Member Posts: 59 Threads: 3 Joined: Oct 2010 10-14-2010, 10:40 AM Hi Gene, For "allowable" values I mean what the manual states: 0 n-r) r = n-r; // get the smaller of r and n-r result = n-c+1; f = result+1; // the next factor for (d = 2 to r) { result = result * f; result = result / d; // do the * and / in the right order! ++f; } return result; } ``` The first 2 lines in the "for" loop could be combined into result = result * f / d, but I split them apart to stress that the multiply must come first. Dave ▼ DeboT Member Posts: 59 Threads: 3 Joined: Oct 2010 10-15-2010, 05:50 AM Hi Dave,Yes, I have often implenemted similar product iterative routines in BASIC on old Sharp programmables (PC-1251 etc.). However the EL-W506 does not have programming nor does it have a PRODUCT function, the only iterative function is the SUM function (and integrate function as pointed out by Crawl), thus I had to devise a way to use that. The accuracy of the results have been satisfactory so far. e.g. ```Inputs EL-W506 using Formula Wolfram Alpha 90C7 7471735560 7471375560 101C6 1267339920 1267339920 70C8 9440350920 9440350920 425C23 5.987299533E37 5.9872995328217166490998168... × 10^37 200C55 7.718340811E49 7.7183408114309579595976889... × 10^49 335C167 3.044358792E99 3.04435879314697921045998279... × 10^99 ``` Unfortunately I wanted to use combinatorials in another SUM function, but as I cannot use a SUM within a SUM, and I can't find a way of using a stored formula within another formula (on the EL-W506), so I'm back to programmable calculators :(. Edit: Dave Hayden said Quote: So after each division, you've computed a different nCr which is guaranteed to be an integer. The Sum function of course will always use the integer of any of its arguments (e.g. Sum X, X=1 to 5.8 will still produce 15), this may one the reasons for the reasonably good accuracy demonstrated above. Edited: 2 Nov 2010, 1:07 p.m. Karl Schneider Posting Freak Posts: 1,792 Threads: 62 Joined: Jan 2005 10-16-2010, 12:22 AM Quote: The HP-300s cannot do nCr for many allowable values E.g. 200C55 = 7.718340811E49 gives an error on the 300s. Similarly on the Casio fx-85GT plus, and Sharp EL-W506. ... For "allowable" values I mean what the manual states: 0y 61. y^x 62. GTO 00 ▼ Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 10-30-2010, 02:32 PM A better readable version of the above: Here is the 12c Version for nCr. ```Store n in R1 and r in R2 Registers used: R3 = sum of the left term R4 = sum of the right term R5= b. (r or n-r whichever is smaller) R6= a-b+1 R7 = counter Program: 1. 1 2. STO 7 3. 0 4. STO 3 5. STO 5 6. RCL 1 7. RCL 2 8. - 9. RCL 2 10. x<=y 11. GTO 13 12. GTO 15 13. RCL 2 14. GTO 18 15. RCL 1 16. RCL 2 17. - 18. STO 5 19. CHS 20. RCL 1 21. + 22. 1 23. + 24. STO 6 25. RCL 6 26. LN 27. 1 28. 0 29. LN 30. / 31. STO+ 3 32. 1 33. RCL 6 34. + 35. STO 6 36. RCL 1 37. RCL 6 38. x<=y 39. GTO 25 40. RCL 7 41. LN 42. 1 43. 0 44. LN 45. / 46. STO+ 4 47. 1 48. RCL 7 49. + 50. STO 7 51. RCL 5 52. RCL 7 53. x<=y 54. GTO 40 55. RCL 3 56. RCL 4 57. - 58. 1 59. 0 60. x<>y 61. y^x 62. GTO 00 ``` ▼ Eddie W. Shore Posting Freak Posts: 764 Threads: 118 Joined: Aug 2007 10-31-2010, 11:10 AM ```Thanks, Marcus. :) I have to remember to do the HTML code. ``` Edited: 31 Oct 2010, 11:11 a.m.

 Possibly Related Threads... Thread Author Replies Views Last Post [HP Prime] Constants Library Values Timothy Roche 24 1,826 11-02-2013, 04:17 PM Last Post: Les Koller HP 300s+: Too expensive ! Dimitri 5 422 09-06-2013, 02:19 PM Last Post: Mic HP 35s - multiple program input values? Arno 3 431 04-29-2013, 11:27 AM Last Post: Gerson W. Barbosa Crate of HP 300s+ Mic 0 195 04-22-2013, 12:56 PM Last Post: Mic HP 300S+ Erturk Kocalar 2 299 03-19-2013, 07:16 AM Last Post: Cristian Arezzini [wp34s] Alternative MIO (allows calculations when entering element values) David Maier 1 257 02-03-2013, 02:51 PM Last Post: Marcus von Cube, Germany Free emulator of the new HP-300S+ available ! Mic 18 1,181 02-03-2013, 08:34 AM Last Post: Marcus von Cube, Germany Review of the HP-300S+ Mic 22 1,403 01-01-2013, 06:07 PM Last Post: chris smith DM-xxCC Default Display Values Mark Hardman 3 339 09-13-2012, 03:42 PM Last Post: Lode A show review of the SmartCalc 300s... Jose Gonzalez Divasson 3 328 02-22-2012, 05:10 PM Last Post: Chris Smith

Forum Jump: