Help with homework | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help with homework

I want the solution from the equation (solve1) to be the 'y' axis. How can I do this?? It works if I print the solution from the equation and then paste it instead of solve1. But I cant do it directly. Please help me with this. import sympy as sp import matplotlib.pyplot as plt import numpy as np from scipy import constants as constant h1 = sp.Symbol('h1') v1 = sp.Symbol('v1') h0 = 2.0 v0 = 20 a = 30 g = constant.g m = 1 eqn = sp.Eq(m*g*h0 + 0.5*m*v0**2, m*g*h1 + 0.5*m*v1**2) solve = (sp.solve(eqn)) solve1 = solve[0][h1] v1 = np.linspace(1,10,10) y = solve1 print(y) plt.plot(v1,y)

27th Sep 2022, 8:50 PM
mariusep
1 Answer
28th Sep 2022, 4:50 AM
Oma Falk
Oma Falk - avatar