# Thread: Request help graphing high degree polynomial

1. ## Request help graphing high degree polynomial

I am working on a Java project where I have implemented an interest rate solver using the Newton and Secant methods.
The TVM formula and associated use of solver methods have been tested and proofed.

I would like to graph the TVM equation which takes financial variables and solves to zero.

The participles of the TVM formula mapped to variables are:
a = PV (present value)
b = PMT (annuity payment)
c = FV (future value)
d = Begin/End period calculation of interest
x = i/100 where i is the interest rate expressed as a percentage

The TVM formula is:
f(x) = a+(1+x*d)*b*((1-(1+x)^-n)/x)+c*(1+x)^-n
where f(x) with the correct value of x will solve to 0

I would like to graph this to see the root or roots of the function.
Normally there is a single root (in x) which is the interest rate solution.
Sometimes there can be a double root, and this is what I would like to be able to see.
This is a complex function and I am not sure how to graph it in this perspective.

I would like to see where double roots tend to form so I can generate a seed value of i for the Newton/Secant solvers.
Any suggestions on how I can roughly determine a second root through the application of a formula would be most welcome.

I appreciate any help, thanks, matt

2. ## Re: Request help graphing high degree polynomial

Sometimes there can be a double root, and this is what I would like to be able to see.
The above statement doesn't really make sense, since you explicitly state that $f$ is a single-variable function, in which case you're treating a, b, c, d as constants and so you'd always get the same number of roots, be it one, none, or otherwise.

I'm not sure how many independent variables you have (for example, the "future value" should be dependent on the "present value", no?), so if you were to make c a function of a, you would reduce your input space down to four-dimensions and have a function $F(a, b, d, x)$. That would still produce a graph-space of five-dimensions, so if you really wanted to visualize all of it, you could generate a 2d-array of 3d graphs.

3. ## Re: Request help graphing high degree polynomial

I have found 2 scenarios which have double roots:
N=10 PV=100 PMT=-30 FV=100 K=0 with roots: 58.203829688346610, -28.443599888025595
N=10 PV=100 PMT=-30 FV=400 K=0 with roots: 53.172213268384720, 14.435871328079967

Both of these scenarios can be put into a spreadsheet with the formula to solve for payment, with identical results.
PMT = -[ (PV+FV * (1/(1+R)^N)) / ((1+R*K) * ((1+R)^N-1) / (R * (1+R)^N)) ]
Where K is the beg/end period value of {0,1}, R is i/100 for the interest rate, N is the number of compounding periods.

The function in my first post is the TVM (time value of money) equation that solves to 0 when all values are correctly matched.
This is what I would like to plot because it will show where a root corresponds to a point on the x axis.

It is true that all the values are constants except for the value of x, the function of which - is what I would like to plot.

I have plotting software that will allow me to try different values for the constants, which will help me to test a variety of scenarios.
If only I could determine the method for plotting the function of x. This is where I could use some help. Thanks.

-matt