Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your question actually appears to be two homework questions.

1) Find the x-intercept for the given polynomial.

Your code has some extraneous lines in it. So, I'll shorten it.

f(x)=x^3 + 4*x - 7
p1= plot(f(x), (x,-15,15), ymin=-15, ymax=15)

This plot shows just one real root.

print ans

Solve gives two nonreal roots and one real root. This is consistent with the plot, and you can get the real root using:


Another option is to use find_root to find the root numerically:


Either way, you get the answer you expected: 1.25538315684475

Substituting this into f should give you 0, and what you saw was that you got 10^(-15) which is VERY close to zero. This often happens when using numerical approximations.

2) given f(x) = x^3 + 4*x - 2, one needs to evaluate f^-1(-5)

You need to use solve find x-values for which f(x)=-5.