Question

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('-----------')

/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:2: DeprecationWarning: object of type <class float> cannot beplease help with this python exercise. thanks in advance.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

Add a comment
Know the answer?
Add Answer to:
The equation y=145x−37y=145x−37 will contact the x-axis. You can solve it manually for y=0y=0 to see...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT