Previous Up Next

20.2.5  Exponential regression

You might expect a set of points to lie on an exponential curve y=b ax. The exponential_regression command finds the values of a and b which give you the best fit exponential.

Example

evalf(exponential_regression([[1,1],[2,4],[3,9],[4,16]]))

or:

evalf(exponential_regression([1,2,3,4],[1,4,9,16]))

(where the evalf is used to get a numeric approximation to an exact expression, see Section 7.3.1).

     
2.49146187923,0.5           

so the best fit exponential curve will be y=0.5·(2.49146187923)x.

The exponential_regression_plot command draws the best fit exponential.

Example

exponential_regression_plot([1,2,3,4],[1,4,9,16])

Previous Up Next