Skip to content

Instantly share code, notes, and snippets.

@accessnash
accessnash / tesla_stock.py
Created May 17, 2020 13:03
Stock returns for Tesla for a 5 yr period
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 20:26:35 2020
@author: User
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
@accessnash
accessnash / image_classification.py
Created February 10, 2020 21:12
Image classification using CNN for the CIFAR10 dataset
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 9 17:57:10 2020
@author: DASA0
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
@accessnash
accessnash / purchase_amount_prediction.py
Last active February 6, 2020 19:13
Car sales prediction using Artificial Neural netwroks
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 3 20:02:37 2020
@author: DASA0
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
@accessnash
accessnash / runge-kutta.py
Created January 22, 2020 20:31
4th order Runge-Kutta for a given ODE
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 22 21:08:27 2020
@author: DASA0
"""
""" Solve y' = y + 3 for the domain [2, 4] and y(2) = -2. Analytical solution: y = exp(x-2) - 3"""
import numpy as np
@accessnash
accessnash / gauss-siedel.py
Created January 19, 2020 11:53
Solving a system of linear equations using Gauss Siedel method, where the only difference from Jacobi's method is that the new values of x are applied to the subsequent equations in the same iteration
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 12:47:08 2020
@author: DASA0
"""
""" Gauss- Sidel's method"""
import numpy as np
@accessnash
accessnash / jacobi.py
Created January 19, 2020 11:20
Solving a system of linear equations using Jacobi's method
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 11:53:03 2020
@author: DASA0
"""
import numpy as np
a = np.array([[1, 2, -3, 4],
@accessnash
accessnash / gauss-elimination.py
Created January 18, 2020 18:52
Solving a system of linear equations by Gauss elimination method - Udemy
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 18 19:44:20 2020
@author: DASA0
"""
""" Solve the system of linear equations given in the matrices below"""
from numpy import array, zeros
@accessnash
accessnash / simpsons-rules.py
Created January 15, 2020 19:42
Simpson's 1/3rd and 3/8th Rules
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 19:23:13 2020
@author: DASA0
"""
""" find the value of the integral xsinx from 0 to pi/2"""
"""Simpson's 1/3rd rule"""
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 30 21:00:52 2019
@author: DASA0
"""
""" find the value of the integral xsinx from 0 to pi/2"""
from math import sin, pi
@accessnash
accessnash / finite-differences.py
Created December 29, 2019 16:13
Solving for the 1st & 2nd derivatives of a given polynomial using Finite differences methods
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 29 16:51:25 2019
@author: DASA0
"""
""" find the 1st & 2nd derivatives of the polynomial at x = 0.1:
f(x) = 0.1x^5 -0.2x^3 + 0.1x - 0.2 """