Question 852459: 22,59,120,_,358.
What is the missing number in the blank and how do we create a c++ program for this problem using virtual function??
Answer by Edwin McCravy(20056) (Show Source):
You can put this solution on YOUR website!
Since we have 4 terms, we will assume a third degree
polynomial for the nth term, because a third degree polynomial
has four coefficients.
That is, we assume a virtual function of the form
Y = A*N^3+B*N^2+C*N+D
Substitute these for (N,Y) (1,22), (2,59), (3,120), and (5,358)
A*1^3+B*1^2+C*1+D = 22
A*2^3+B*2^2+C*2+D = 22
A*3^3+B*3^2+C*3+D = 22
A*5^3+B*5^2+C*5+D = 358
And solve the augmented matrix:
We solve that matrix and get
A = 1.83333333
B = 1
C = 21.16666667
D = -2
Then we substitute X=4 in
Y = A*N^3+B*N^2+C*N+D
and get 216.
Edwin
|
|
|