In [1]:
import numpy as np
import scipy as sp

In [12]:
p1 = np.array([1,7])

In [13]:
p2 = np.array([5,1])

In [6]:
import os
my_plotly_api_key = os.environ.get('MY_PLOTLY_API_KEY')
# setting up a key:
# in Terminal:
# export MY_PLOTLY_API_KEY = 'DHAHH3DSAD43D' (EXAMPLE)

import plotly
plotly.tools.set_credentials_file(username='agu3rra', api_key=my_plotly_api_key) # setting up credentials; Plotly is an online service.
import plotly.plotly as py # import graphics library
import plotly.graph_objs as go

In [14]:
trace = go.Scatter(
    x = p1,
    y = p2,
    mode = 'lines',
    name = 'lines'
)
data = [trace]
py.iplot(data, filename='basic-line')


Out[14]:

In [16]:
import scipy.integrate as integrate

In [20]:
x=p1
y=p2

In [21]:
from scipy.integrate import simps
area = simps(y,x)

In [22]:
area


Out[22]:
18.0

In [23]:
x


Out[23]:
array([1, 7])

In [24]:
y


Out[24]:
array([5, 1])

In [25]:
from scipy.integrate import trapz

In [26]:
area = trapz(y,x)

In [27]:
area


Out[27]:
18.0

In [28]:
def f1(x):
    return x**2

In [ ]:
x =