# Least Squares Fit

## Homework Statement

For the following data, find the least squares fit of the given form
x=1,2,3,4,6
y=14,10,8,6,5
h(x)=ae^x+be^(-x)

## The Attempt at a Solution

So I tried to linearize the equation by taking the natural log of everything
ln(h)=ln(ae^-x)+ln(be^ex)
ln(h)=ln(a)+ln(b)+x-x

that when I run into a problem, I eliminate the x's.
My question is, is there another way to linearize the equation or should I continue though?

## Answers and Replies

Related Calculus and Beyond Homework Help News on Phys.org
That's not right. In particular,
$$\ln (ae^{-x} + be^x) \neq \ln (ae^{-x}) + \ln (be^x)$$

HallsofIvy
If $h(x)= ae^{x}+ be^{-x}$ then $h(1)= ae+ be^{-1}$. Since you are told that y= 14 when x= 1, the "error" is $ae+ be^{-1}- 14$ and the "error squared" is $(ae+ be^{-1})^2$. Similarly, for x= 2, y= 10, the "error squared" is $(ae^2+ be^{-2}- 10)^2$.
For all 5 x,y pairs, the sum of errors squared is $(ae+ be^{-1}- 14)^2$$+ (ae^2+ be^{-2}- 10)^2$$+ (ae^3+ be^{-3}- 8)^2$$+ (ae^4+ be^{-4}- 6)^2+ (ae^6+ be^{-6}-5)^2$. Find a and b to minimize that.