#🔒plotting singularity function

4 messages · Page 1 of 1 (latest)

lucid elm
#

I have an equation for q(x) and I want to find v(x) and M(x) in each plane, then add them vectorwise and plot them. I can't even get them to plot correctly,

from sympy import symbols, integrate, sqrt, lambdify, Heaviside, SingularityFunction
import sympy as sp
from sympy.abc import x, a, n
from numpy import linspace
import matplotlib.pyplot as plt


Q = (
    -450.37 * SingularityFunction(x, 0, 1)
    + 909.92 * SingularityFunction(x, 0.114, 1)
    + 454.96 * SingularityFunction(x, 0.170, 1)
    - 914.51 * SingularityFunction(x, 0.198, 1)
    + 19193.2 * SingularityFunction(x, 0.114, -2)
    - 19193.2 * SingularityFunction(x, 0.170, -2)
)
V = integrate(Q)
M = integrate(V)

print(V)
print(M)

V_func = lambdify(x, V, "numpy")


x = linspace(0, 0.198, 500)
V_plot = V_func(x)

plt.plot(x, V_plot)
plt.show()

This is what I have so far, I can't even get it eval at a point I just get the equation back without the x's plugged in any help would be appreciated.

potent jettyBOT
#

@lucid elm

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

flint pasture
#

closing as this has received no activity for a while