1

I'm new to sympy plotting, when I repeatedly try to graph the solution set for one variable linear inequality like here, I can't figure it out, can anyone help me with my problem?

My code is like this

from sympy import symbols, plot
from sympy.plotting import plot 
from sympy import *
import numpy as np
x, y = symbols("x, y", real=True)
init_printing(use_unicode=True)
ekpr =  (4*x - 2 <= 5 + 3*x)
pprint(ekpr)
xs = np.linspace(0, 10, 11)
yvals = [solve(ekpr, x, xi) for xi in xs]
sol = solve(ekpr, x)
print(sol)
plot = plot(ys, xlim=[0.0, 10.10],
           markers=[{'args': [sol, [0], xs, yvals, 'ro']}])

The result of the graph that I expect is like the image below. enter image description here

Fahrizal
  • 47
  • 6
  • Please, tell us exactly what are you trying to do with the following line of code: `yvals = [solve(ekpr, x, xi) for xi in xs]` – Davide_sd Oct 07 '22 at 17:54
  • Saya ingin mengikuti kode yang ada di sini https://stackoverflow.com/questions/70128588/how-to-add-markers-at-certain-x-coordinates-using-sympy-plot – Fahrizal Oct 07 '22 at 18:53

0 Answers0