Linked Questions

Popular Questions

I am trying to use the SymPy library to find the point of intersection(s) between two functions:

f(x) = e ^ (x / 2) and g(x) = 3 - 3 * x

I tried:

import sympy as syp

x = syp.symbols('x')

f_x = syp.E ** (x / 2)
g_x = 3 - 3 * x

print(syp.nsolve(f_x, g_x, x))

syp.nsolve(f_x, g_x, x) spits out a TypeError. Replacing that line with syp.solve([f_x, g_x], x) results in an empty list []. This is wrong because f(x) and g(x) intersect at exactly one point.

How do I get the x and y values of the point of intersection(s) between any f(x) and g(x) using SymPy?

Related Questions