Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a function that I'm trying to model using an exponential function and I'm trying to determine the constants for the exponential. I know I could optimize it using trial-and-error in R or another language, but I'd like to learn an analytic solution.

I figured that minimizing mean squared error would be the way to go about this, so I have:

$$\underset{r,k}{\operatorname{argmin}}\sum_{t=0}^T (s(t)-\hat{s}(t\mid r,k))^2$$

Where $s(t)$ is the function that I'm trying to model and $\hat{s}(t)$ is $(1+r)^{t+k}$ .

The only constraint I could come up with was $r>0$. I suppose I could also assume $k>0$ for now.

I learned about Kuhn-Tucker constraints as an extension to Lagrange constraints (which I already know) but I wasn't able to solve it.

Am I even going about this the right way? If I am, how can I solve this problem?

Thanks in advance!

share|cite|improve this question
up vote 2 down vote accepted

Your setup is fine. This sort of problem will not (usually) have an analytic solution. You have a two-dimensional non-linear minimization problem. There are many numeric routines that can solve this in libraries, and they are discussed in any numerical analysis text. They really consist of informed trial and error, where the informed part comes from keeping track of past trials to build up information about the error function.

share|cite|improve this answer
Thank you for the answer! That's a bit disappointing to hear though. Are there constraints or other pieces of information I could add to allow for an analytic solution? – Andy Bromberg May 16 '13 at 22:46
@AndyBromberg: no, the problem is that equations involving sums of non-integral powers usually can't be solved except numerically. Think of $1.45^{2.3+x}+1.45^{4.7+x}=10000$ You would like to take logs of both sides, but the log of a sum is not the sum of the logs, so it doesn't help. – Ross Millikan May 16 '13 at 23:22
Thanks again for the response. So if I removed the $k$ term from the equation so all I had was $(1+r)^{t}$, that would be solvable? Or is the issue that there's a variable exponent in the first place? – Andy Bromberg May 16 '13 at 23:48
@AndyBromberg: it might be if all your $t$'s are integers and not too big (no more than four or larger and you get lucky). But problems like this usually have more data points than that. One-dimensional root finding is much easier, so if you don't need $k$ for a decent fit it would be nice to remove it. But with one fewer parameter, you may have more trouble fitting. – Ross Millikan May 16 '13 at 23:50
Thanks for your help! – Andy Bromberg May 20 '13 at 5:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.