# Using numerical methods to solve $x^2 \sin (2 \pi x)=33 \sin \left(\frac{66 \pi }{x}\right)$

On a recent question I asked, Claude Leibovici had a nice answer. However, I do not understand one part when he says "[solving the equation] would require numerical methods". What are these "numerical methods" and how would I use it to solve my problem? For reference, I put my equation below: $$x^2 \sin (2 \pi x)=33 \sin \left(\frac{66 \pi }{x}\right)$$ I am primarily focused on intergral solutions.

• On this site, do not hesitate to ask the answerer any clarification you need. In such a way, everything will stay in the same post. Cheers :-) May 29, 2019 at 3:47
• @Moo, no as there are no clear methods, but there are some very good answers, just no the ones I need. May 29, 2019 at 15:29
• And @ClaudeLeibovici Ok! May 29, 2019 at 15:29
• @Moo Any one that gets the job done. I'm open to options. May 29, 2019 at 19:44

$$\def\e{\varepsilon} \def\d{\delta}$$Here is another approach for finding approximate solutions. Define $$f(x) = x^2\sin 2\pi x - 33\sin \frac{66\pi}{x}.$$ We wish to find the zeros of $$f(x)$$.

For small $$x$$, $$f(x)\approx -33\sin 66\pi/x$$, the zeros for which are \begin{align*} x_n = \frac{66}{n} \tag{1} \end{align*} for $$n$$ an integer. This integer must be large for the technique to be self-consistent, $$n\gg 66$$. It can be shown that for large $$n$$ the error on this approximation is of order $$1/n^5$$. In fact, if $$X_n$$ is the true zero nearest $$x_n=66/n$$, one can show that $$X_n-x_n\approx (-1)^{n+1}1149984/n^5$$.

For large $$x$$ we must search for zeros near the zeros of $$\sin 2\pi x$$, since in the limit $$\sin 66\pi/x\approx 66\pi/x\rightarrow 0$$. For integral $$n$$, we expand $$f(n/2+\e)$$ for small $$\e$$ to linear order, set the result equal to zero, and solve for $$\e$$. We find \begin{align*} \e \approx \e_n \equiv \frac{66}{\pi} \frac{ n^2 \sin \frac{132\pi}{n}}{(-1)^n n^4+17424\cos\frac{132\pi}{n}}.\tag{2} \end{align*} For $$n$$ very large we find \begin{align*} \e \approx \e_n' \equiv (-1)^n\frac{8712}{n^3}.\tag{3} \end{align*} Thus, the zeros of $$f(x)$$ for large $$x$$ are given by $$x_n \approx \frac{n}{2}+\e_n \approx \frac{n}{2}+\e_n'.$$ We expect the approximation $$x_n = n/2+\e_n'$$ to work well if $$n\gg 132\pi$$. If $$X_n$$ is the true zero nearest $$x_n=n/2+\e_n'$$, one can show that $$X_n-x_n\approx (-1)^{n+1}25299648/n^5$$.

Below we plot $$f(x)$$ and some of the predicted zeros using the approximations above.   It has become clear to me from the comments that this question is about finding exact integer solutions, not all real solutions. If $$x$$ is an integer we immediately have $$\sin 2\pi x=0$$ and so the problem reduces to solving $$\sin 66\pi/x=0$$ where $$x$$ is an integer. Thus, $$66\pi/x=n\pi$$ for some integer $$n$$ and so $$x=66/n$$. The solutions will be the divisors of $$66$$, so $$x=\pm1,\pm2,\pm3,\pm6,\pm11,\pm22,\pm33,\pm66$$. Note that there are in fact an infinite number of real solutions but only a finite number of integer solutions to this equation.

More generally if we wish to solve $$x^2\sin 2\pi x=a\sin\frac{N\pi}{x},$$ where $$N$$ is an integer, for integer $$x$$ we again must only satisfy $$\sin N\pi/x = 0$$ and so $$x= N/n$$ where $$n$$ is an integer, i.e., $$x$$ is a divisor of $$N$$. The problem is fundamentally about factoring $$N$$. This can be done by hand or by using software. Here is a starting point to learn about integer factorization.

• For small n, it seems that I would need to factor. Any way not to do that. And, how large would the x have to be to be considered "large" as in your context? May 29, 2019 at 15:30
• @QuoteDave: The error for large $n$ on $x_n = n/2 + \varepsilon_n'$ using approximation (3) is also of order $1/n^5$. To determine how large $n$ should be we need a criterion for either how close we wish to be to the zero or a bound on how large $|f|$ is allowed to be. I am not sure what you mean about factoring for small $n$. All of these approximations depend on $n$ being large. May 30, 2019 at 2:09
• @QuoteDave: I have added some specific error estimates above. May 31, 2019 at 0:31
• Ok, thank you. Can you just tell me how to find integer solutions without factorizing and minimizing the range you have to search for integer solutions? May 31, 2019 at 1:51

What are these "numerical methods"

Numerical Methods refer to a set of mathematical techniques that enable one to find an approximate solution to problems such as your problem and many others such as area calculation, differential equations where there is no known or easy to apply "closed form". All such methods use repeated calculations rather than steps of algebraic logic.

Numeric Methods are great because they can be programmed, hence automate the solution of some problems. However, they may produce results with varying accuracy. Some values can be approximated better by increasing the number of iterations (calculations).

For solving your equation there are different methods such as:

1-Bisection Method.

2-False Position Method.

3-Newton-Raphson Method

You can find many references for the above, for example: Numerical Methods-Examples.

• So, how would I use them to find approximations (at least to the hundredth place) for the solutions (or just the integer solutions) May 28, 2019 at 20:54
• Pick a method from the ones above and give it a try, if you are stuck you could then post where you are stuck. If you are only interested in the answer, then an online tool could help without having to learn the steps. In addition you could plot the equation and see the roots. May 28, 2019 at 20:55
• I'm thinking of the Bisection Method as I know how to do it, but where do I start finding solutions? From where do I start my search? May 28, 2019 at 21:00
• You can take a look at the plot of the function here: desmos.com/calculator/060gg5pcn4 - There is a large density of roots between x=[0,2], and infinite number of roots following. If you are looking for a generalized formula for the roots, then I don't know how to do this. May 28, 2019 at 21:07
• Ok. Thanks anyway! May 28, 2019 at 21:10

There is no analytical way of solving this equation. This means that there is no good way to represent a solution of this equation by using basic functions.

A numerical method is a series of computations, usually performed by a computer, that yield a sequence of numbers which (hopefully) approximate the exact solution better and better. For instance, a computer could try to approximate the root of $$x^2 \sin (2 \pi x)-33 \sin \left(\frac{66 \pi }{x}\right)$$ using Newton's method.

See for instance the numerical solutions that Wolfram Alpha gives.

• Thank you! So, can you tell me how to approximate all integer solutions, or will I have to compute them all? May 28, 2019 at 20:52

Here is a solution using the Newton–Raphson method.

We have the function

$$f(x) = x^2\sin\left( 2\pi x\right) - 33\sin\left( \frac{66\pi}{x}\right)$$

A plot shows that this is a highly periodic and oscillatory function and it has many zeros. The Newton-Raphson iteration is given

$$g(x) = x- \dfrac{f(x)}{f'(x)} = x+ \frac{33 x^2 \sin \left(\frac{66 \pi }{x}\right)-x^4 \sin (2 \pi x)}{2 x^3 (\sin (2 \pi x)+\pi x \cos (2 \pi x))+2178 \pi \cos \left(\frac{66 \pi }{x}\right)}$$

Lets select an $$x_0 = 0.204$$, and iterate $$g(x)$$

• $$x_0 = 0.2040000000000000, g(x_0) = 32.89911766050774$$

• $$x_1= 0.2018314436615791, g(x_1) = 0.6130866300979277$$

• $$x_2 = 0.2018350942149161, g(x_2) = -0.00005275314444857377$$

• $$x_3 = 0.2018350939008396, g(x_3) = 4.02178290670463*10^{-14}$$

• $$x_4 = 0.2018350939008396, g(x_4) = 4.02178290670463*10^{-14}$$

• $$x_5 = 0.2018350939008396, g(x_5) = 4.02178290670463*10^{-14}$$

So, the root it converged on is (try another root and see what you get)

$$x_5 = 0.2018350939008396$$

A different starting value will converge to a different root or no root at all.

Lastly, for integer solutions, in your original equation, try

$$x = 1, 2, 3, 6, 11, 66$$

• So, I would need to pick a value. Any way to know the values that will converge to integral solutions, which I am primarily interested in? May 30, 2019 at 0:06
• Solutions that are integers. May 30, 2019 at 0:47
• But I will have to factor to get those results. Any other ways? May 30, 2019 at 14:34
• No but you said to try "$x=1,2,3,6,11,66$", all of which are factors of $66$. But, what about $$x^2 \sin (2 \pi x)=3595 \sin \left(\frac{7190 \pi }{x}\right)$$ or $$x^2 \sin (2 \pi x)=3173 \sin \left(\frac{6346 \pi }{x}\right)$$ As the numbers get bigger, how can I still solve it without having to factor? May 30, 2019 at 19:48
• Yes, I understand that. But I see that for each of them, the factors of the number in the $sin$ term are zeros. For example, for $x^2\sin\left( 2\pi x\right) - 33\sin\left( \frac{66\pi}{x}\right)$, factors are $1,2,3,6,11,66$. So, that's why I want to get the zeroes without factoring. May 30, 2019 at 20:28