May-21-2023, 12:15 PM
I was never good at maths!
Now, I want to get the value of arcsine(y), given any particular sine(x) = y
I can plot sine(x), and, as I understand it, maybe I'm wrong, from my plot, given a particular value of sine(x), I should be able to draw a horizontal line through y, where that line meets my graph, go down to the x axis and I should have the value of the angle corresponding to x in radians. If I multiply that value by π/180 I hope I will get the value in degrees, and so I hope to have reversed the function y = sine(x) and got the value of the angle from the value of sine((x)
Trouble is, I don't really understand what I am doing, it's maths!
This plots sine(x) with -π/2 ≤ x ≤ π/2
How can I get the value of the x axis for any value of y = sine(x)
Now, I want to get the value of arcsine(y), given any particular sine(x) = y
I can plot sine(x), and, as I understand it, maybe I'm wrong, from my plot, given a particular value of sine(x), I should be able to draw a horizontal line through y, where that line meets my graph, go down to the x axis and I should have the value of the angle corresponding to x in radians. If I multiply that value by π/180 I hope I will get the value in degrees, and so I hope to have reversed the function y = sine(x) and got the value of the angle from the value of sine((x)
Trouble is, I don't really understand what I am doing, it's maths!
This plots sine(x) with -π/2 ≤ x ≤ π/2
How can I get the value of the x axis for any value of y = sine(x)
def myApp():
import matplotlib.pyplot as plt
import numpy as np
# 100 linearly spaced numbers
x = np.linspace(-np.pi/2,np.pi/2,200)
# the function, which is y = sin(x) here
y = np.sin(x)
# setting the axes at the centre
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.spines['left'].set_position('center')
ax.spines['bottom'].set_position('center')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
# plot the function
plt.plot(x,y, 'b-')
# show the plot
plt.show()
