#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 10 19:52:16 2019

@author: li
"""
import numpy as np 
import matplotlib.pyplot as plt


x0  =  0
y0  =  1
xf  =  1
n=  101
deltax  =  (xf - x0) / (n - 1)
x  = np.linspace(x0 , xf , n)

lamb = [ 0.01, 0.1, 1 ,10 , 100, 1000]
l=len(lamb)
y  =  np.zeros((l,n))

y[:,0]   =  y0
err = y

for i in range(l):
    for j in range(1,n):
        y[i,j]= -lamb[i]*(deltax*(x[j-1]))+y[i,j-1]
        err[i,j]=-lamb[i]*(deltax*j)-y[i,j]
for j in range(l):
    plt.plot(x, err[j,:])
    plt.yscale('log')
    plt.xlabel(j)
    plt.show()
