Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
import sympy as sb
def Chebyshev(N):
P = [0]*(N+1)
P[0] = 1
P[1] = x
for n in range(1,N):
P[n+1] = 2 * x*P[n] - P[n-1]
import numpy as np
import matplotlib.pyplot as plt
import sympy as sb
# 森正武, "数値解析", 共立出版株式会社, 第2版, 2002.
# 4.12 ラグランジュ補間公式の標本点の分布
# 等間隔な標本点の分布(P170 - P173)
def LagrangePolynomial(X,Y):
def l(j,N):
import numpy as np
import matplotlib.pyplot as plt
import sympy as sb
x = sb.Symbol('x')
def Chebyshev1st(N):
T = [0]*(N+1)
T[0] = 1
T[1] = x
# x
Δx = 0.1
X = 10.0
xlm = [0, X]
x = collect(xlm[1]:Δx:xlm[2])
I = length(x)
# y
Δy = 0.1
Y = 10.0
# x
X = 5.0
xlm = [-X,X]
dx = 0.1
x = xlm[1]:dx:xlm[2]
x_n = length(x)
# t
T = 50.0
tlm = [0,T]
using PyPlot
function motion(event)
x = event[:xdata]
y = event[:ydata]
ln[:set_data](x,y)
draw()
end
using PyPlot
using PyCall
@pyimport matplotlib.animation as anim
dx = 0.05
xlm = [0, 2π]
x = collect(xlm[1]:dx:xlm[2])
n = length(x)
y = sin.(x)
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from numba import jit
# Julia set
# https://en.wikipedia.org/wiki/Julia_set#Quadratic_polynomials
def motion(event):
if (event.xdata is None) or (event.ydata is None):
@ceptreee
ceptreee / main
Last active August 12, 2018 19:09
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from numba import jit
# Julia set
# https://en.wikipedia.org/wiki/Julia_set#Quadratic_polynomials
@jit
def JuliaSet(N,Nx,Ny,z,c):