Showing posts with label infinite series. Show all posts
Showing posts with label infinite series. Show all posts

Saturday, June 13, 2020

Graph Gallery Series with GeoGebra

Graph Gallery Series with GeoGebra

The following graphs are from one to five terms of an infinite series of the form:

Σ f(n,x) from n = 0 to ∞

I use the GeoGebra online graphing tool, it is a great online, and free, graphing, mathematics, and geometry app.  Check GeoGebra out at https://www.geogebra.org

Enjoy!

Series 1: 

Σ( n * x ) from n = 0 to ∞

Σ( n * x ) from n = 0 to ∞


Series 2:

Σ( x^n * e^(-n*x) ) from n = 0 to ∞

Σ( x^n * e^(-n*x) ) from n = 0 to ∞


Series 3:

Σ( x^(-n) ) from n = 0 to ∞

Σ( x^(-n) ) from n = 0 to ∞


Series 4:

Σ( n * erf((n * x) / (n + 1)) ) from n = 0 to ∞

Σ( n * erf((n * x) / (n + 1)) ) from n = 0 to ∞


Series 5:

Σ( n * sin x + sin( x * n ) ) from n = 0 to ∞

Σ( n * sin x + sin( x * n ) ) from n = 0 to ∞


Series 6:

Σ( x^(-n) * cos( x * n ) ) from n = 0 to ∞

Σ( x^(-n) * cos( x * n ) ) from n = 0 to ∞
One of my favorite pictures.  I used this as a wallpaper on my PC.  Eddie 



Eddie

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Friday, March 20, 2020

Casio fx-9860g and fx-CG 50: Binomial Series

Casio fx-9860g and fx-CG 50: Binomial Series

Generating The Binomial Series

The binomial series (1 + b*x)^a can be generated by the series:

(1 + b*x)^a = 1 + a*b*x +  a*(a-1) / 2! * (b*x)^2 + a*(a-1)*(a-2) / 3! * (b*x)^3 + ....

= ∑ ( a NCR k) * (b * x)^k for k = 0 from ∞

where:

(a NCR k) = (a * (a - 1) * (a - 2) * ... * (a - k + 1) ) / k!

The values a and b can be complex and do not have to be integers.

If a is not a positive integer, the series continues on indefinitely. 

Output:  List 5 has the coefficients.  The program BINOMSRS calculates the coefficients and any approximation of that series (f(x)).

Casio fx-9860GII and fx-CG 50 Program BINOMSRS

Lbl 2
"2020-02-24 EWS"
"BINOMIAL SERIES"
"EXPAND (1+BX)^A"
"B"? → B
"A"? → A
Lbl 0
"TERMS (≥3)"? → T
Int T → T
T < 3 ⇒ Goto 0
T → Dim List 5
1 → List 5[1]
1 → N
For 2 → K To T
N (A - (K - 2)) → N
N ÷ (K - 1)! * B^(K - 1) → List 5[K]
Next
Lbl 1
Menu "MENU","LIST COEFS",C,"APPROX F(X)",E,"NEW SERIES",2,"EXIT",X
Lbl C
"COEFS IN List 5"
List 5 ◢
Goto 1
Lbl E
"X"? → X
Sum( List 5 * X^Seq(I, I, 0, T-1, 1) ) → Y
"F(X) IS ABOUT:"
Y ◢
Goto 1
Lbl X 
"DONE"

The program allows the user to evaluate the series for given values and create new series for different problems. 

Download the fx-9860gII and fx-9750gII version: 
https://drive.google.com/open?id=1fgxjwf4UkyxhY7XIWqx7HRQHJf-PKnbi

Download the fx-CG 50 and fx-CG 10/20 version:
https://drive.google.com/open?id=1H0Sq2-h6NcWFIw7_pM25PAHHQ2QKtKEy

Example

Expand (1 - x)^(1/2) to six terms.   Approximate f(0.35).

Hint:  Use the fraction key  ( [ a b/c ] or [ []/[] ] ) to get results in fractions (whenever possible). 

b = -1
a = 1/2
t = 6

Coefficients (List 5):
{1, -1/2, -1/8, -1/16, -5/128, -7/256}

(1 - x)^(1/2) ≈ 1 - 1/2 * x - 1/8 * x^2 - 1/16 * x^3 - 5/128 * x^4 - 7/256 * x^5

Approx F(X):  X = 0.35
Result:  0.8062780164


Eddie

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Thursday, May 2, 2019

HP Prime and Casio fx-CG50 MicroPython: √(x + √(x + √(x + ... )))

HP Prime and Casio fx-CG50 MicroPython:  √(x + √(x + √(x + ...  )))

Introduction

Made with LibreOffice Math


The program SQRADD attempts to find a calculation to:

√(x + √(x + √(x + ...  )))

That is:

1.  Start with a number x  (any positive number, we're assuming that we are in the Real Number domain)
2.  Take the square root
3.  Add x to the result
4.  Take the square root of the result
5.  Repeat steps 3 and 4 forever. (or until a condition is satisfied, such as machine accuracy is reached)


HP Prime Program SQRADD

The loop repeats until the difference between two terms is less than machine accuracy, 1E-12 (since HP Prime has floating point accuracy of 12 digits).  Output:  {x, answer, number of iterations it took to get machine accuracy}

EXPORT SQRADD(X)
BEGIN
// 2019-04-28 EWS
// √(X+√(X+√(X+...)))

// setup
LOCAL T,U,N:=1;
T:=√X;
U:=√(X+T);

// loop
WHILE ABS(U-T)≥1E−12 DO
T:=U;
U:=√(X+T);
N:=N+1;
END;

// display results {X,U,N}
RETURN {X,U,N};
END;

Casio fx-CG50 MicroPython Script sqradd.py

Use the Python mode of the Casio fx-CG50 (software versions 3.2 or greater).  For more information of this procedure, please see: http://edspi31415.blogspot.com/2018/10/casio-fx-cg50-version-320-python-comes.html

# 2019-04-28 EWS

import math

# sqrt(X+sqrt(X+...))
# declare variables
# as float
N=1.0
X=float(input("X="))
T=float(math.sqrt(X))
U=float(math.sqrt(X+T))

# loop
# Casio Micropython
# has precision of 15
while abs(U-T)>=1e-15:
  T=U
  U=math.sqrt(X+T)
  N+=1

# results
print("X= "+str(X))
print("Result= ")
print(str(U))
print("Iterations= "+str(N))

Procedure on a Four-Function or Desktop Calculator

1.  Clear the memory (usually [ MRC ] [ MRC ] )
2.  Enter x and store it in memory  (x  [ M+ ] )
3.  Take the square root [ √ ]
4.  Repeat this loop (until machine accuracy is reached, that is, the the result doesn't "change"):  [ + ] [ MR ] [ = ] [ √ ]

Results

HP Prime

x = 1,  Result:  1.61803398875, 23 iterations
x = 2, Result:  2,  20 iterations
x = 3,  Result: 2.30277563773, 18 iterations
x = 4, Result: 2.56155281281, 17 iterations
x = 5, Result: 2.79128784748, 17 iterations
x = 6, Result: 3,  16 iterations
x = 7, Result: 3.19258240357, 16 iterations
x = 8, Result: 3.37228132327, 15 iterations
x = 9, Result:  3.54138126514, 14 iterations
x = 10, Result: 3.70156211871, 14 iterations
x = 11, Result: 3.85410196624, 13 iterations
x = 12, Result: 4,  14 iterations
x = 20, Result: 5, 12 iterations
x = 30, Result: 6, 12 iterations
x = 42, Result: 7, 11 iterations
x = 56, Result: 8, 11 iterations

Casio fx-CG50 MicroPython

x = 1, Result:  1.618033988749895, 30 iterations
x = 2, Result: 2,  26 iterations
x = 3, Result: 2.302775637731994, 24 iterations
x = 4, Result: 2.56155281280883, 22 iterations
x = 5, Result: 2.79128784747792, 21 iterations
x = 6, Result: 3, 20 iterations
x = 7, Result: 3.192582403567252, 20 iterations
x = 8, Result: 3.372281323269014, 19 iterations
x = 9, Result: 3.54138126514911, 19 iterations
x = 10, Result: 3.701562118716424, 18 iterations
x = 11, Result: 3.854101966249685, 18 iterations
x = 12, Result: 4, 18 iterations
x = 20, Result: 5, 16 iterations
x = 30, Result: 6, 15 iterations
x = 42, Result: 7, 14 iterations
x = 56, Result: 8, 14 iterations

Some Interesting Observations

When x = 1, the result is the Golden Ratio, Φ = (1 + √5)/2.

When x = n * (n-1) where n is an integer and n ≥ 2, the result is n. 

Examples: 
x = 2 =  2 * 1, result: 2
x = 12 = 4 * 3, result: 4
x = 56  = 8 * 7, result: 8
x = 240 = 16 * 15, result: 16
x = 992 = 32 * 31, result:  32

Fun stuff.  What other patterns can we find with this or other similar calculation?  Until next time,

Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Sunday, December 9, 2018

Fun with the Infinite Series 1 + x + x^2 + x^3 + x^4 + x^5 + ...

Fun with the Infinite Series 1 + x + x^2 + x^3 + x^4 + x^5 + ...


The Series and Its Derivatives

Let F be the infinite series:

F = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + ... = ∑ x^k from k = 0 to ∞.

Working with derivatives:

----

First Derivative of F:  (F' = dF/dx)

F' = 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + 6*x^5 + 7*x^6 + ... 
= ∑ (k+1)*x^k from k = 0 to ∞

----

Second Derivative of F:  (F'' = d^2F/dx^2)

F'' = 2 + 6*x + 12*x^2 + 20*x^3 + 30*x^4 + 42*x^5 + 56*x^6 + ....

Factor out a 2:
= 2 * (1 + 3*x + 6*x^2 + 10*x^3 + 15*x^4 + 21*x^5 + 28*x^6 + .... )

Note the sequence 1, 3, 6, 10, 15, 21, 28...  These are triangle numbers, denoted as T_n.  

T_1 = 1
T_2 = 1 + 2 = 3
T_3 = 1 + 2 + 3 = 6
T_4 = 1 + 2 + 3 + 4 = 10 
and so on.

Using summation notation,  T_n = ∑ k from k = 1 to n

Going back to the series:

F'' = 2 + 6*x + 12*x^2 + 20*x^3 + 30*x^4 + 42*x^5 + 56*x^6 + ....
= 2 * (1 + 3*x + 6*x^2 + 10*x^3 + 15*x^4 + 21*x^5 + 28*x^6 + .... )
= 2 * (∑ x^k * T_k+1 from k = 0 to ∞)

In nested summation notation:

= 2 * (∑ x^k * (∑ m from m = 1 to k+1) from k = 0 to ∞)


Addition with F, F', and F"


F + F' = 2 + 3*x + 4*x^2 + 5*x^3 + 6*x^4 + 7*x^5 + 8*x^6 + ...
= ∑ ((k + 2) * x^k from k = 0 to ∞)

----

F + F' + F'' = 4 + 9*x + 16*x^2 + 25*x^3 + 36*x^4 + 49*x^5 + 64*x^6 + ...
= ∑ ((k + 2)^2 * x^k from k = 0 to ∞)

----

F' + F" = 3 + 8*x + 15*x^2 + 24*x^3 + 35*x^4 + 48*x^5 + 63*x^6 + ...

Note the sequence 3, 8, 15, 24, 35, 48, 63... where
3 = 4 - 1 = 2^2 -1
8 = 9 - 1 = 3^2 - 1
15 = 16 - 1 = 4^2 - 1
24 = 25 - 1 = 5^2 - 1
35 = 36 - 1 = 6^2 - 1
48 = 49 - 1 = 7^2 - 1
63 = 64 - 1 = 8^2 - 1
and so on...

This can be summarized as ∑( (k + 2)^2 - 1 from k = 0 to ∞)

Hence:
F' + F" = 3 + 8*x + 15*x^2 + 24*x^3 + 35*x^4 + 48*x^5 + 63*x^6 + ...
= ∑  ((k + 2)^2 - 1) * x^k from k = 0 to ∞)

Multiplying F and F' by x and x^2 

F = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + ... = ∑ x^k from k = 0 to ∞.
x * F = x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + ... = ∑ x^(k+1) from k = 0 to ∞.
x^2 * F =  x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + ... = ∑ x^(k+2) from k = 0 to ∞.

-----

F + x * F = 1 + 2*x + 2*x^2 + 2*x^3 + 2*x^4 + 2*x^5 + 2*x^6 + ...
= 2 - 1 + 2*x + 2*x^2 + 2*x^3 + 2*x^4 + 2*x^5 + 2*x^6 + ...
= 2 + 2*x + 2*x^2 + 2*x^3 + 2*x^4 + 2*x^5 + 2*x^6 + ... - 1
= 2 * F - 1

This is one way to dervie the formula for the Infinite Geometric Series (for |x| < 1), to solve for F:

F + x * F  = 2 * F - 1
F + x * F - 2 * F = -1
F * (1 + x - 2) = -1
F * (x - 1) = -1
F = -1 / (x - 1)
F = 1 / (1 - x)   (keep this mind, this is true only when |x| < 1)

----

F - x * F = (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + ... ) - (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + ... )
= F * (1 - x)

For |x| < 1,

F * (1 - x) = 1 / (1 - x) * (1 - x) = 1

In general:
F - x * F = (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + ... ) - (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + ... )
= 1 + (x - x) + (x^2 - x^2) + (x^3 - x^3) + (x^4 - x^4) + (x^5 - x^5) + (x^6 - x^6) + ...
= 1

F - x * F = 1

----

F' = 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + 6*x^5 + 7*x^6 + ... 
= ∑ ((k + 1) * x^k from k = 0 to ∞)

x * F' = x + 2*x^2 + 3*x^3 + 4*x^4 + 5*x^5 + 6*x^6 + 7*x^7 + ... 
= ∑ ((k + 1) * x^(k + 1) from k = 0 to ∞)


x^2 * F' = x^2 + 2*x^3+ 3*x^4 + 4*x^5 + 5*x^6 + 6*x^7 + 7*x^8 + ... 
= ∑ ((k + 1) * x^(k + 1) from k = 0 to ∞)

----

F' + x * F' = 1 + 3*x + 5*x^2 + 7*x^3 + 9*x^4  + 11*x^5 + 13*x^6 + ...

The sequence of 1, 3, 5, 7, 9, 11, 13, ... is the sequence of odd numbers which can be summarized as:

∑(2 * k + 1 from k = 0 to ∞)

Then:

F' + x * F'  =  F' * (1 + x) = ∑( (2*k + 1) * x^k from k = 0 to ∞)

----

F' + x * F' + x^2 * F' = 1 + 3*x + 6*x^2 + 9*x^3 + 12*x^4 + 15*x^5 + 18*x^6 + ...
= 1 + ( 3*x + 6*x^2 + 9*x^3 + 12*x^4 + 15*x^5 + 18*x^6 + ... )
= 1 + ∑(3 * k * x^k from k = 0 to ∞)

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Thursday, May 10, 2012

Calculus Revisited #18: Series

Welcome to Part 18 of our wonderful 21 part of our Calculus Revisited Series. I hope you are enjoying this series. An announcement: Part 21 will be a "catch all" section - covering some of the topics we don't get to in detail in this series.

The next three blog entries will be about series. Today, the basics.

Series:

A series is a sum of terms in a sequence. The series can be finite or infinite. An infinite series is convergent (has a value) if the following is true:


∑ a_n = S
n=i

and S < ∞

Here are some famous series:

Arithmetic Series:

a + (a + d) + (a + 2d) + (a + 3d) + ...

Sum for a finite arithmetic series:

n-1
∑ a + k * d
k=0

= a * n + (d * n * (n -1))/2

Geometric Series:

a + a * r + a * r^2 + a * r^3 + ...

Sum for an infinite geometric series, provided that |r| < 1:


∑ a * r^k = a / (1 - r)
k = 0

Harmonic Series:


∑ 1/n
n=1

= 1 + 1/2 + 1/3 + 1/4 + 1/5 + ....

There is no closed formula for a finite harmonic series. In addition the infinite harmonic series diverges (has no sum).

Series Properties:

∑ c * a(n) = c * ∑ a(n) (c is a constant)

∑ a(n) + b(n) = ∑ a(n) + ∑ b(n)

n
∑ k = n * (n + 1)/2
k=1

n
∑ k^2 = n * (n + 1) * (2n + 1)/6
k = 1

n
∑ k^3 = n^2 *(n + 1)^2 / 4
k = 1


Subtracting from a whole:
If t > 1:

k
∑ a(n) =
n = t

∑( a(n) for n = 1 to k) - ∑( a(n) for n = 1 to t - 1)


Problems

1. Calculate

6
∑ 50 - 2k
k = 0

This is an arithmetic series with n = 6 + 1 = 7, a = 50, and d = -2.

Then the sum is:
(50)(7) + (-2 * 7 * 6)/2 = 308


2. Show why the (infinite) harmonic series is divergent.

Here is one way:

Let S be the sum of the harmonic series, that is:

S = 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8 + ...

Note that:
1 + 1/2 > 2/2
1/3 + 1/4 > 2/4
1/5 + 1/6 > 2/6
1/7 + 1/8 > 2/8
and so on...

Then we have 2/2 + 2/4 + 2/6 + 2/8 + ....

Which simplifies to 1 + 1/2 + 1/3 + 1/4 + .... = S

Which implies S > S, which is impossible.

The harmonic series is divergent.

3. Find the sum:


∑ .5^n + .3^n
n=0

We can first break the sum up:

∑(.5^n for n=0 to ∞) + ∑(.3^n for n=0 to ∞)

Both terms are geometric series. r = .5 for the first term and r = .3 for the second term.

Then:

∑(.5^n for n=0 to ∞) + ∑(.3^n for n=0 to ∞)
= 1 / (1 - .5) + 1 / (1 - .3)
= 1 / .5 - 1 / .7
= 24/7 ≈ 3.42857

4. Find the sum:


∑ 2 / (5^n)
n = 1

This looks like a geometric series with r = 1/5. If we can put the sum into it's proper form, perhaps by adding and subtracting 2 / 5^0:

∑( 2 / (5^n) for n = 1 to ∞)
= ∑ ( 2 / (5^n) for n = 0 to ∞) - 2 / 5^0
= ∑ ( 2 / (5^n) for n = 0 to ∞) - 2
= 2 / ( 1 - 1/5) - 2
= 2 / (4/5) - 2
= 5/2 - 2 = 1/2

5. Find the sum:

20
∑ k^2
k=10

Again, looks like a k^2 series, but use the subtraction from the whole technique and:

∑( k^2 for k = 10 to 20)
= ∑(k^2 for k = 1 to 20) - ∑(k^2 for k = 1 to 10 - 1)
= (20)(20 + 1)(2 * 20 + 1)/6 - (9)(9 + 1)(2 * 9 + 1)/6
= 17220 / 6 + 1710 / 6
= 15510 / 6 = 2585

Thank you once again for joining us. Next time we will work some series convergence tests.

Eddie

This blog is property of Edward Shore. © 2012

RPN HP 12C: Fibonacci and Lucas Sequences

  RPN HP 12C: Fibonacci and Lucas Sequences Golden Ratio, Formulas, and Sequences Let φ be the Golden Ratio: φ = (1 + √5) ÷ 2...