I was given the following assignment:
f(x)=2x^3-8x^2+x+16
1. create a python program that will fing f(x)
2.find the axtreme in function 1 acoss the closed interval (1,-3)
below was my solution, but doesnt seem to work.. could you please help me out.
f(x)=2x^3-8x^2+x+16
"2x^3 was my attempt to say (2x)cubed and 8x^2 was my attempt to say (8x)squared", I apologize if that is confusing.
2.find the axtreme in function 1 acoss the closed interval (1,-3)
below was my solution, but doesnt seem to work.. could you please help me out.
Code:
def main():
highest= -9999999
x = 1.0
f=0
while x <= 3:
y = f
if y > highest:
x = x + f
y=calc(f)
print y
raw.input("press enter to go on")
def calc(f):
f = (2(x**3))-(8(x**2))+ x + 16
return f
main()
Comment