Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by heihei ( 5 years ago )
# We introduce a linear function y = a+b(x-x0) and specify the values of the intercept a and the slope b as follows,
a = 2.; b = -1.
# Also set the x-value of the intercept to
xic = -3.
# ... and specify two x values of the endpoints of the line to be plotted
xdata = [-3, 3]


def linefunction(a, b, xic, xdata):
    y = a + b*(xdata - xic)
    return y


ydata = [linefunction(a,b,xic,xdata[0]),linefunction(a,b,xic,xdata[1])]
print(ydata)

plt.plot(xdata, ydata)

 

Revise this Paste

Your Name: Code Language: