infinite
infinite

Reputation: 9

python Spyder interactive output

Recently I wrote this code trying to find some method to calculate the integrate of a parabola but thats not of any problem for me now but the point is that the code I have written doesnt give me any output and thats very strange I use spyder and the code is as follows:

def integrator(a,b,c):
    #a,b and c are the factors of the quadratic
    import numpy as np
    delta=((b**2)-4*a*c)
    answer1= (-b+delta)/2
    answer2=(-b-delta)/2 
    #it gets the answers of the quadratic eruation and uses them as the lower and upper bounds
    if delta<=0:
        return "this func has no real answer"
    if delta==0:
        return "this function has two equal answers"
        return  answer1
  else:
      return answer1
      return answer2
  #it also calculate the answers of the quadratic equation too
  integ_range=[]
  for i in np.arange(answer1,answer2,0.01):
      integ_range.append(i)
  for i in integ_range:
      heights=(a*(i**2))+(b*i)+c
  sum1=sum(integ_range)    
  integrate=sum1*0.01
  return (integrate)

integrator(1,2,3)

the decription of my code and the ungiven output

Upvotes: 0

Views: 74

Answers (1)

HarryS
HarryS

Reputation: 312

Assign a variable to the integrator as:

i=integrator(1,2,-3)
print(i)

That should work

Upvotes: 1

Related Questions