Find value of the cubic equation in python by R4R Team

Cubic Equation-
-A equation in which highest power of the variable is 3.

Example-
Cubic equation is f(x)=x**3+x**2+x**1+3
then at x=1, f(1)=6
and f(2)=17


program-

print("Enter Cubic Equation")
equation=input()

print("Enter value of x")
x=int(input())
z=eval(equation)
print("Value of equation at",x,"is",z)

print("Enter value of x")
x=int(input())
z=eval(equation)
print("Value of equation at",x,"is",z)


output-

Enter Cubic Equation
x**3+x**2+x**1+3
Enter value of x
1
Value of equation at 1 is 6
Enter value of x
3
Value of equation at 3 is 42

Enter Cubic Equation
x**1+3
Enter value of x
2
Value of equation at 2 is 5
Enter value of x
10
Value of equation at 10 is 13


-In this program, we take a input of cubic equation and find the value at different value of x.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!