import os import subprocess from nonlinear import NonLinear from animator import Animator import numpy as np RG = NonLinear() RG.dx = 0.1 RG.dy = 0.1 x = np.arange(-10, 10, RG.dy) y = np.arange(-10, 10, RG.dy) RG.x, RG.y = np.meshgrid(x, y) RG.dz = 0.02 RG.z = np.arange(0, 6, RG.dz) # RG.eta = 0.25065 RG.eta = 0.3 RG.a0 = np.exp(-RG.eta * (RG.x**2 + RG.y**2)) RG.kappa = 1 RG.integrate() filename = 'repulse.mp4' anim = Animator(RG) anim.start_animation(filename) devnull = open(os.devnull, 'w')
from nonlinear import NonLinear from animator import Animator import numpy as np RG = NonLinear() RG.dt = 0.1 RG.times = np.arange(-10, 10, RG.dt) RG.dz = 0.02 RG.z = np.arange(0, 50, RG.dz) RG.T0 = 2 RG.a0 = np.exp(-RG.times**2 / RG.T0**2) RG.integrate('c') anim = Animator(RG) anim.start_animation()
from nonlinear import NonLinear from animator import Animator import numpy as np RG = NonLinear() RG.dt = 0.02 RG.times = np.arange(-10, 10, RG.dt) RG.dz = 0.02 RG.z = np.arange(0, 10, RG.dz) RG.eta = 1 RG.a0 = RG.eta / np.cosh(RG.times * RG.eta) RG.integrate() anim = Animator(RG) anim.start_animation()
#Tiffany Wang 260684152 #Numerical Methods ECSE 543 - Assignment 3 import math from curvefitting import CurveFitting from nonlinear import NonLinear from circuit import Circuit from integration import Integration cv = CurveFitting() nl = NonLinear() c = Circuit() i = Integration() #======================================Question 1====================================== # # a) # B_1 = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0] # H_1 = [0.0, 14.7, 36.5, 71.7, 121.4, 197.4] # #get H value at every 0.01 # x = [0.01 * i for i in range(101)] # result = [] # for i in range(len(x)): # print "B: ", i, " H: ", round(cv.lagrange(x[i], B_1, H_1), 5) # result.append(cv.lagrange(x[i], B_1, H_1)) # file = open("magnetic1.csv", "w") # for i in range(len(x)): # string = str(x[i]) + ", " + str(result[i]) + "\n" # file.write(string)
from nonlinear import NonLinear from animator import Animator import numpy as np RG = NonLinear() RG.dt = 0.01 RG.times = np.arange(-50, 50, RG.dt) RG.dz = 0.0001 RG.z = np.arange(0, 1, RG.dz) # RG.T0 = 7 # RG.a0 = np.exp(-RG.times**2 / RG.T0**2) size = len(RG.times) RG.a0 = np.zeros(size) RG.a0[np.where(abs(RG.times) < .5)] = 0.5 * np.pi RG.integrate() anim = Animator(RG) anim.start_animation()
import numpy as np from nonlinear import NonLinear from animator1 import Animator RG = NonLinear() RG.dt = 0.1 RG.times = np.arange(-150, 150, RG.dt) RG.dz = 0.02 RG.z = np.arange(0, 20, RG.dz) T0 = 1.5 RG.a0 = T0 * np.exp(-RG.times**2 * T0) RG.integrate('NLS') anim = Animator(RG) anim.start_animation()
from nonlinear import NonLinear from animator import Animator import numpy as np RG = NonLinear() RG.dt = 0.1 RG.times = np.arange(-25, 25, RG.dt) RG.dz = 0.01 RG.z = np.arange(0, 50, RG.dz) RG.T0 = 7 RG.a0 = np.exp(-RG.times**2 / RG.T0**2) RG.integrate('d') anim = Animator(RG) anim.start_animation()