General method to numerically solve for the absolute maximum(s) of an irregular sinusoid

66 Views Asked by At

I am trying to find a strictly mathematical (i.e., not manual graphing or plugging) method to solve for the absolute (global) maximum value of an irregular sinusoid.

Given a rational function $f(x)$, i.e., $$f(x) = \frac{8480128-33x}{100x+63}$$ and a sinusoid transformed by the above function, i.e., $$r(x) = \cos(\pi f(x)) \cos(\pi x)$$ I am trying to numerically solve for the absolute maximum of $r(x)$. Right now, I have plotted the function on Desmos and manually checked for an intersection with the line $y=1$. I am also aware that I can iterate $x = 0, 1, ...$ at the peaks of $r(x)$ and checking $r(x)=1$ but both of these methods are unsatisfactory for $f(x)$ with large coefficients.

Setting $\cos\left(\pi \frac{8480128-33x}{100x+63}\right) \cos(\pi x)=1$, I do not know how to proceed algebraically or with calculus. I am looking for a way to deterministically find whether or not this function $r(x)$ will ever reach $y=1$ without doing too much manual work.

2

There are 2 best solutions below

7
On

One way to proceed can be find for $x$ real such that

$$8480128-33x=0 \implies x\approx 256973.6$$

therefore for $x=256974$ we obtain a value very close at $1$, that is

$$\cos\left(\pi \frac{8480128-33x}{100x+63}\right) \cos(\pi x)\approx 0.9999999999985...$$

Another strategy is look at integer solution for

$$f(x) = \frac{8480128-33x}{100x+63}$$

and, in this special case for example, we can find that $x=139$ is a solution with $f(139) = 607$ therefore

$$\cos(607\pi ) \cos(139\pi )=(-1)\cdot (-1)=1$$


Idea for a general method

Following the idea used in the particular example, more in general we can proceed as follows.

1. Look for solutions in $\mathbb Z$ of the rational equation $f(x)=n$ and we have three cases:

  • $\exists n\in\mathbb Z$ even/odd for $x_0\in\mathbb Z$ even/odd $\implies r(x_0)=1$
  • $\exists n\in\mathbb Z$ even/odd for $x_0\in\mathbb Z$ odd/even $\implies r(x_0)=-1$
  • no solutions

To determine/check for an integer solution, we can refer, for example, to the general methods discussed here.

2. When no integer solutions exist, we can search for real solutions of $r(x_0)=0$ and then:

  • for $\lceil x_0\rceil$ even $r(\lceil x_0\rceil) \approx 1$
  • for $\lceil x_0\rceil$ odd $r(\lceil x_0\rceil) \approx -1$
  • for $\lfloor x_0\rfloor$ even $r(\lfloor x_0\rfloor) \approx 1$
  • for $\lfloor x_0\rfloor$ odd $r(\lfloor x_0\rfloor) \approx -1$

3. The previous method can be generalized searching for real solutions of $r(x_0)=2k$ and of $r(x_0)=2k+1$ with $k\in\mathbb Z$.

0
On

The only way the product of two cosines (of real numbers) can ever be $1$ is if either both are equal to $1$ or both equal to $-1$. This simplifies things a lot!

If $\cos A = 1$, then $A=2k\pi$ for some integer $k$. So if $\cos \pi x = 1$ and $\cos \pi f(x) = 1$, we have $x=2k$ and $f(2k)$ is an even integer, say $2l$.

This means $$8480128-66k = 2l(200k+63)$$

and it's (fairly) easy to check this has no integer solutions.


If $\cos A = -1$, then $A=2k\pi+\pi$ for some integer $k$. So if $\cos \pi x = -1$ and $\cos \pi f(x) = -1$, we have $x=2k+1$ and $f(2k+1)$ is an odd integer, say $2l+1$.

Substituting again, this is $$8480128-66k-33 = (100(2k+1)+63)(2l+1)$$

which has the unique integer solution $k=69$, $l=303$, giving the unique maximum at $x=139$.