CSC 130 Power Series
This program generates a sequence of numbers
based on your selection of the type of series and
the starting and ending points in that series.
Please select from the following list
A: Fibonacci Sequence
B: Power Series
a
Please enter the number of permutations you would like to print from the Fibonocii sequence.
5
This segment of the Fibonacci sequence contains the following numbers:
0
1
1
2
3
Now let's select a short segment of the Fibonacci sequence to print.
Please enter the first number in your Fibonacci sequence segment.
8
Please enter the second number in your Fibonacci sequence segment.
13
Please enter the number of permutations you would like to print from the Fibonacci sequence.
7
This segment of the Fibonacci sequence contains the following numbers:
8
13
21
34
55
89
144
Would you like to look at another sequence?
Please enter "Y" for Yes and "N" for No.
y
Please select from the following list
A: Fibonacci Sequence
B: Power Series
a
Please enter the number of permutations you would like to print from the Fibonacci sequence.
6
This segment of the Fibonacci sequence contains the following numbers:
0
1
1
2
3
5
Now let's select a short segment of the Fibonacci sequence to print.
Please enter the first number in your Fibonacci sequence segment.
13
Please enter the second number in your Fibonacci sequence segment.
21
Please enter the number of permutations you would like to print from the Fibonacci sequence.
10
This segment of the Fibonacci sequence contains the following numbers:
13
21
34
55
89
144
233
377
610
987
Would you like to look at another sequence?
Please enter "Y" for Yes and "N" for No.
y
Please select from the following list
A: Fibonacci Sequence
B: Power Series
b
In mathematics there are several functions that can be found my using a power series.
First we will look at the convergence of a power series for e to the x power.
Please enter the value for "x". (Between the values of 0 and 1 exclusive)
.3
Please enter a value for the number of terms in the series. (from 1 to 20)
2
The convergent series is :
1.0 + 0.3
The Java Math library method exp() returns the value of 1.3498588075760032
Your power series answer, for the same function, is 1.3
Would you like to try again?
Please answer "y" for Yes or "n" for No.
y
Please enter the value for "x". (Between the values of 0 and 1 exclusive)
.3
Please enter a value for the number of terms in the series. (from 1 to 20)
20
The convergent series is :
1.0 + 0.3 + 0.045 + 0.0045 + 3.3749999999999996E-4 + 2.0249999999999994E-5 + 1.0124999999999998E-6 + 4.339285714285713E-8 + 1.6272321428571422E-9 + 5.4241071428571416E-11 + 1.627232142857142E-12 + 4.4379058441558425E-14 + 1.1094764610389605E-15 + 8.251960914639345E-17 + 3.7397761067619695E-17 + 7.159025742253234E-18 + 2.147837207368143E-18 + -4.475917107811166E-18 + -4.3121799694664804E-19 + 1.0600539486207289E-18
The Java Math library method exp() returns the value of 1.3498588075760032
Your power series answer, for the same function, is 1.349858807576003
Would you like to try again?
Please answer "y" for Yes or "n" for No.
n
Next we will look at the convergence of a power series for sin of X.
Please enter the value for "x". (In degree between the values of 90 and 0 inclusive)
30
Please enter a value for the number of terms in the series. (from 1 to 17)
2
0.5235987750000001 + -0.023924596121921538
The Java Math library method sin() returns the value of 0.499999999481858
Your power series answer, for the same function, is 0.4996741788780785
Would you like to try again?
Please answer "y" for Yes or "n" for No.
y
Please enter the value for "x". (In degree between the values of 90 and 0 inclusive)
30
Please enter a value for the number of terms in the series. (from 1 to 17)
17
0.5235987750000001 + -0.023924596121921538 + 3.2795319255496527E-4 + -2.1407197521128953E-6 + 8.15125657356007E-9 + -2.0315575143677455E-11 + 1.1507021763935572E-13 + -3.0409860679773704E-14 + -5.791582878894843E-14 + -4.1782838752101464E-14 + -1.0509003675849863E-15 + -3.992385612396906E-16 + 4.5467433660840977E-17 + -1.7430089709523856E-17 + -5.71489712455298E-18 + -2.6350247806620016E-18 + -2.4832740732677156E-19
The Java Math library method sin() returns the value of 0.499999999481858
Your power series answer, for the same function, is 0.4999999994818059
Would you like to try again?
Please answer "y" for Yes or "n" for No.
n
Finally, we will look at the convergence of a power series for the series:
Sum from n = 0 to n = infinity x to the nth.
For the values of x from 0 to 1 exclusive.
Please enter the value for "x". (from 0 to 1 exclusive)
.3
Please enter a value for the number of terms in the series. (from 1 to 20)
3
1.0 + 0.3 + 0.09
The Function 1/(1 - x) returns the value of 1.4285714285714286
Your power series answer, for the same function, is 1.3900000000000001
Would you like to try again?
Please answer "y" for Yes or "n" for No.
y
Please enter the value for "x". (from 0 to 1 exclusive)
.3
Please enter a value for the number of terms in the series. (from 1 to 20)
20
1.0 + 0.3 + 0.09 + 0.026999999999999996 + 0.0081 + 0.0024299999999999994 + 7.289999999999998E-4 + 2.1869999999999995E-4 + 6.560999999999998E-5 + 1.9682999999999994E-5 + 5.9048999999999975E-6 + 1.7714699999999993E-6 + 5.314409999999998E-7 + 1.5943229999999992E-7 + 4.782968999999997E-8 + 1.4348906999999992E-8 + 4.3046720999999976E-9 + 1.291401629999999E-9 + 3.8742048899999975E-10 + 1.1622614669999992E-10
The Function 1/(1 - x) returns the value of 1.4285714285714286
Your power series answer, for the same function, is 1.4285714285216178
Would you like to try again?
Please answer "y" for Yes or "n" for No.
n
Would you like to look at another sequence?
Please enter "Y" for Yes and "N" for No.
n