Wednesday, September 15, 2021

Python (numpy && matplotlib) solving one relatively difficult math problem

The problem itself is to find all solutions of the following equation on real axis

cos (cos (cos (cos (x)))) - sin (sin (sin (sin (x)))) = 0

We intend to prove that equation above doesn't have any solution via creating a python script importing NumPy and Matplotlib. Just recall that the function understudy has a period of 2*pi .

[boris@fedora34server ~]$ cat  yandexPlot5.py

import numpy as np # import numpy package

import matplotlib.pyplot as plt # import matplotlib.pyplot package

x = np.arange(0,9 * np.pi, 0.1) # create x array of angels from range 0 to 9*3.14

y = np.cos(np.cos(np.cos(np.cos(x)))) -  np.sin(np.sin(np.sin(np.sin(x)))) 

plt.plot(x, y) # plot grah 

plt.title(" Graphical Representation of sine function")

plt.xlabel("x axis ")

plt.ylabel("y axis ")

plt.show() # show plotted graph















Thus mentioned equation doesn't have any solution. Moreover increasing number of nested sines and cosines produces similar plotted graphs

































No comments:

Post a Comment