The equation y=145x−37y=145x−37 will contact the x-axis. You can solve it manually for y=0y=0 to see where this is. But it is also possible to use a very small ΔxΔx to gradually home in on an approximate answer. Have a go. Hint: try to do it in 100 or fewer steps, start with x=1x=1 and use a ΔxΔx 10 to 100 times smaller than xx. Consider using if and else statements to handle what happens if you go past the solution.
#HERE IS MY CODES
import numpy as np
x = np.linspace(1,100,0.1)
for i in range(100):
y = 145 * x[i] - 37
print(x[i])
print(y)
print('-----------')
please help with this python exercise. thanks in advance.
numpy.
linspace
(start,
stop, num=50, endpoint=True,
retstep=False, dtype=None, axis=0) , so
in your code you pass it as numy.linespace(1,100,0.1) third
argument can't be 0.1 , it is value how much you want fraction. so
write here 1000
numy.linespace(1,100,1000)
code
import numpy as np
x = np.linspace(0,100,1000)
for i in range(100):
y = 145 * x[i] - 37
print(x[i])
print(y)
print('-----------')
check now
The equation y=145x−37y=145x−37 will contact the x-axis. You can solve it manually for y=0y=0 to see...