# Math Help - Find maximum

1. ## Find maximum

I would like to find the $n$ that maximizes this discrete function

$d(n) = \frac{R^{n+1}}{\sin(\theta)}\left[R\sin(\theta(n+1)) - \sin(\theta(n+2))\right]$

where n is 0,1,2,....
$0 and $0<\theta < \pi$

Is that even possible?

2. ## Re: Find maximum

Hey niaren.

Hint: Try treating n as a continuous variable and using calculus to get the maximum points and look at answers that are integer values around those points.

With regards to the constraints on R and theta, consider using multi-variable optimization with those constraints.

If you get a small number of turning points, then it will be easy to find the values of N that maximizes the function.

3. ## Re: Find maximum

I will write $t$ instead of $n$, just to make clear that $t$ is continuous.

$d'(t) = R^{t+1}\log(R) \left[R\sin(\theta(t+1)) + \sin(\theta(t+2))\right] + R^{t+1}\left[R\cos(\theta(t+1))\theta + \cos(\theta(t+2))\theta\right] \\ = R^{t+1}\left[\log(R) \left(R\sin(\theta(t+1)) + \sin(\theta(t+2))\right) +\left(R\cos(\theta(t+1))\theta + \cos(\theta(t+2))\theta\right)\right]$

Now setting equal to zero gives

$0 = R^{t+1}\left[\log(R) \left(R\sin(\theta(t+1)) + \sin(\theta(t+2))\right) +\left(R\cos(\theta(t+1))\theta + \cos(\theta(t+2))\theta\right)\right] \\ 0 = \log(R) \left(R\sin(\theta(t+1)) + \sin(\theta(t+2))\right) +\left(R\cos(\theta(t+1))\theta + \cos(\theta(t+2))\theta\right) \\ 0 = \log(R)R\sin(\theta(t+1)) + \log(R)\sin(\theta(t+2)) + R\cos(\theta(t+1))\theta + \cos(\theta(t+2))\theta$

Is it possible to isolate t? It seems hard but my PC says it is possible, it also gives a result but I haven't found out yet how to do it manually. Any hints?

4. ## Re: Find maximum

I'm not sure but you might want to look at the various trig identities to see if you can simply the RHS in terms of a single trig representation.

5. ## Re: Find maximum

Thanks chiro.
I think I've got it now. I worked backwards and figured out the trick. I found the trig identity to use and the underlying idea. The idea is to take the trig terms with argument $\theta(t+2)$ and factor them out in terms of $\theta(t+1)$. Then the terms involving $\theta(t+1)$ can be boiled down to a tangent. The remaining terms does not depend on t. Very nice .

Actually, this max value I have been working on finding an expression for is a special case of a more general problem which I am now more prepared to tackle (a max overshoot value in some digital filters).
Thanks for your feedback.

Although not relevant anymore, I though I just mention that the expression for the derivative I posted is not correct. It has some sign issues. I thought I just mention it. Anyway thanks.