Post Reply 
Summation on HP 42S
09-24-2018, 01:52 PM
Post: #14
RE: Summation on HP 42S
(09-24-2018 11:56 AM)Albert Chan Wrote:  This almost look like integration !
Any reference to show it is always true ?

Just have a look at the definition of Pascal's triangle:

\({n \choose k}={n-1 \choose k-1}+{n-1 \choose k}\)

Or then just check the diagonals.
E.g. for \(k=2\) the partial sum of the first elements is just below on the next line:

1 = 1
1 + 3 = 4
1 + 3 + 6 = 10
1 + 3 + 6 + 10 = 20
1 + 3 + 6 + 10 + 15 = 35



Quote:I normally just fit the data to search for the formula (assume I don't cheat by googling)
For sum(x^2 - 3*x), formula should be a cubic, with no constant term (sum=0 when n=0)

Try:
n = 1, sum = (1^2 - 3) = -2
n = 2, sum = -2 + (2^2 - 3*2) = -4
n = 3, sum = -4 + (3^2 - 3*3) = -4

3 equations, 3 unknowns (cubic coefficients), we get sum = n^3/3 - n^2 - 4/3*n

So, for n = 100, sum = n/3 * (n^2 - 3*n - 4) = 100/3 * 9696 = 323200

You might be interested in Newton's Forward Difference Formula:

\(f(x+a)=\sum_{n=0}^\infty{a \choose n}\Delta^nf(x)\)

Quote:the formula looks suspiciously like a finite analog of a Taylor series expansion

So for the given example we get:

x: 0 1 2 3 …
f: 0 -2 -4 -4 …
∆f: -2 -2 0 …
∆²f: 0 2 …
∆³f: 2


And so with \(x=0\) we end up with: \(f(a)=2{a \choose 3} - 2{a \choose 1}\)

This leads to an even shorter program:
Code:
00 { 11-Byte Prgm }
01 RCL ST X
02 3
03 COMB
04 X<>Y
05 -
06 2
07 ×
08 END

Conclusion: We don't really have to solve the linear system of equations.

Kind regards
Thomas


We don't even have to calculate the sum f but can only calculate ∆f:

x: 0 1 2 3 …
f: 0
∆f: -2 -2 0 …
∆²f: 0 2 …
∆³f: 2
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Summation on HP 42S - lrdheat - 09-23-2018, 06:14 PM
RE: Summation on HP 42S - Didier Lachieze - 09-23-2018, 06:28 PM
RE: Summation on HP 42S - lrdheat - 09-23-2018, 06:41 PM
RE: Summation on HP 42S - lrdheat - 09-23-2018, 06:51 PM
RE: Summation on HP 42S - ijabbott - 09-23-2018, 07:40 PM
RE: Summation on HP 42S - burkhard - 09-25-2018, 12:58 PM
RE: Summation on HP 42S - John Keith - 09-25-2018, 04:15 PM
RE: Summation on HP 42S - Thomas Klemm - 09-23-2018, 08:29 PM
RE: Summation on HP 42S - lrdheat - 09-23-2018, 09:25 PM
RE: Summation on HP 42S - Didier Lachieze - 09-23-2018, 10:03 PM
RE: Summation on HP 42S - lrdheat - 09-23-2018, 10:02 PM
RE: Summation on HP 42S - lrdheat - 09-23-2018, 10:37 PM
RE: Summation on HP 42S - Thomas Klemm - 09-24-2018, 12:56 AM
RE: Summation on HP 42S - Albert Chan - 09-24-2018, 11:56 AM
RE: Summation on HP 42S - Thomas Klemm - 09-24-2018, 01:17 AM
RE: Summation on HP 42S - Thomas Klemm - 09-24-2018 01:52 PM
RE: Summation on HP 42S - Albert Chan - 09-24-2018, 04:20 PM
RE: Summation on HP 42S - pier4r - 09-24-2018, 01:55 PM
RE: Summation on HP 42S - Frido Bohn - 09-25-2018, 01:59 PM
RE: Summation on HP 42S - Dieter - 09-25-2018, 04:47 PM
RE: Summation on HP 42S - Frido Bohn - 09-26-2018, 10:10 AM
RE: Summation on HP 42S - Albert Chan - 09-26-2018, 03:13 PM
RE: Summation on HP 42S - Albert Chan - 09-25-2018, 05:28 PM
RE: Summation on HP 42S - lrdheat - 09-25-2018, 05:17 PM
RE: Summation on HP 42S - lrdheat - 09-25-2018, 05:28 PM
RE: Summation on HP 42S - Albert Chan - 09-25-2018, 07:17 PM
RE: Summation on HP 42S - Valentin Albillo - 09-25-2018, 08:01 PM
RE: Summation on HP 42S - Albert Chan - 09-25-2018, 08:59 PM
RE: Summation on HP 42S - Albert Chan - 09-26-2018, 01:23 PM
RE: Summation on HP 42S - pier4r - 09-26-2018, 04:09 PM
RE: Summation on HP 42S - Thomas Klemm - 09-27-2018, 03:47 AM
RE: Summation on HP 42S - Ángel Martin - 09-27-2018, 05:27 AM
RE: Summation on HP 42S - pier4r - 09-27-2018, 10:37 PM
RE: Summation on HP 42S - Thomas Okken - 09-28-2018, 12:33 AM
RE: Summation on HP 42S - pier4r - 09-28-2018, 01:40 PM
RE: Summation on HP 42S - ijabbott - 09-28-2018, 11:20 PM
RE: Summation on HP 42S - Albert Chan - 09-29-2018, 12:51 AM
RE: Summation on HP 42S - Valentin Albillo - 09-29-2018, 01:15 AM
RE: Summation on HP 42S - Thomas Okken - 09-29-2018, 01:24 AM
RE: Summation on HP 42S - ijabbott - 09-29-2018, 11:58 AM
RE: Summation on HP 42S - Albert Chan - 09-29-2018, 12:49 PM
RE: Summation on HP 42S - Thomas Okken - 09-29-2018, 01:50 PM
RE: Summation on HP 42S - ijabbott - 09-29-2018, 04:06 PM
RE: Summation on HP 42S - Thomas Okken - 09-29-2018, 06:15 PM
RE: Summation on HP 42S - ijabbott - 09-29-2018, 09:10 PM
RE: Summation on HP 42S - Thomas Okken - 09-29-2018, 09:33 PM
RE: Summation on HP 42S - Albert Chan - 09-30-2018, 03:03 PM
RE: Summation on HP 42S - ijabbott - 09-30-2018, 05:28 PM
RE: Summation on HP 42S - brickviking - 10-01-2018, 08:40 AM
RE: Summation on HP 42S - pier4r - 09-29-2018, 05:59 PM
RE: Summation on HP 42S - Thomas Okken - 09-29-2018, 08:59 PM



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