# Numeric integration in python

by sola maths
Tags: numeric integration, python, scipy
 P: 8 I'm trying to write a python program that is able to numerically execute functions of the form: y(t) = exp(Integrate[A(x),x]) within the bounds of 0 and t I tried using quad from scipy.integrate but it seems not to be able to evaluate expressions of this form. Any other suggestions on appropriate packages or commands?
P: 2,751
 Quote by sola maths I'm trying to write a python program that is able to numerically execute functions of the form: y(t) = exp(Integrate[A(x),x]) within the bounds of 0 and t I tried using quad from scipy.integrate but it seems not to be able to evaluate expressions of this form. Any other suggestions on appropriate packages or commands?
Can you be a bit more specific sola maths? Do you mean:

$$y(t) = \exp(\int_0^t A(x) \, dx)$$

You have some specific function A(x) that you can evaluate numerically?

Also, is that just you integrand? Do you need to evaluate,

$$\int_a^b \, e^{\int_0^t A(x) \, dx} \, dt$$
 P: 8 Hi uart, Yes, I have some function A(x) that I need to evaluate numerically as x changes. The first expression you wrote is what I meant.
P: 2,751
Numeric integration in python

 Quote by sola maths Hi uart, Yes, I have some function A(x) that I need to evaluate numerically as x changes. The first expression you wrote is what I meant.
Ok so it's just $y(t) = \exp(\int_0^t A(x) \, dx)$ that you need to evaluate.

Quad can do this easily, but only for one particular value of "t" at a time. However you could call it (quad) from within a function if you wished to properly make a function of "t". For example,

def functA(x):
return x*x/2.0

def functY(t):
90.017131300521896