1

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.

user
  • 154,566
J W
  • 13

2 Answers2

2

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$.

Chris Lewis
  • 1,941
1

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$.

user
  • 154,566
  • I considered that too, but finding integer solutions to the rational function appears to be NP-hard... I am trying to find a method that works for large coefficients in the rational, let's say $f(x)=\frac{716415207617514354551336164756670904340633322282478717948-37x}{100x+17}$ – J W Jul 02 '23 at 21:33
  • I think that at first we should look for integer solutions, we can use the method discussed here. – user Jul 02 '23 at 21:35
  • For very large coefficients I think we can use the first method I proposed to find very effectively close solutions. – user Jul 02 '23 at 21:38
  • Does the first method yield x=139 with the initial example? It seems to be a decent approximation but I am trying to get the true absolute max, not a super close estimate. Can it be tuned to find precise $x$? Is there another way to rewrite this problem to make it more feasible? – J W Jul 02 '23 at 21:45
  • @user you have to be careful with the parity of an integer solution. If $x$ is odd and $f(x)$ is even (or vice-versa), the product of the two cosines will be $-1$. – Chris Lewis Jul 02 '23 at 21:50
  • @ChrisLewis Yes of course! indeed it works in this particular case, I'm not claiming that it is good in general. Of course we need to try with it, for a trivial solution. – user Jul 02 '23 at 21:51
  • @JW Sorry but I'm not aware for a general solution! – user Jul 02 '23 at 21:52