#
#
#
#
#
#
#
#
#
#
#
#
a simple cubic spline example.
generate some random data in 10 intervals - note the data changes
each time this is run.
Our form of the spline polynomial comes from Pang, Ch. 2
solve the matrix system for the splines
plot the splin
Spectroscopic Challenges of Photoionized Plasmas
ASP Conference Series, Vol. 247, 2001
Gary Ferland and Daniel Wolf Savin, eds.
Reliability in the face of complexity the challenge of high-end
scientific computing
Gary Ferland
Physics Department, The Unive
arXiv:1210.0530v4 [cs.MS] 26 Sep 2013
Best Practices for Scientific Computing
Greg Wilsona , D.A. Aruliahb , C. Titus Brownc ,
Neil P. Chue Hongd , Matt Davise , Richard T. Guyf ,
Steven H.D. Haddockg , Kathryn D. Huffh , Ian M. Mitchelli ,
Mark D. Plumbl
Basics of Computation
PHY 688: Numerical Methods for (Astro)Physics
Basics of Computation
Computers store information and allow us to operate on it.
That's basically it.
Computers have finite memory, so it is not possible to store the infinite
range of nu
Introduction to distributed version control with git
Mark Longair
April 19, 2011
Abstract
This document is a companion to a talk I gave at the Institute for Neuroinformatics at the University
/ ETH Zrich. The aim is to introduce people to the version cont
How to Scale a Code in the Human Dimension
arXiv:1301.7064v1 [astro-ph.IM] 29 Jan 2013
Matthew J. Turk ([email protected])
Columbia University
This is a re-telling of a talk given at Scientific Software Days in December, 2012, at
the Texas Advanced Co
faug
July 12, 2011
10:51
Page 1
Six Myths of Polynomial Interpolation and
Quadrature
Lloyd N. Trefethen FRS, FIMA, Oxford University
t is a pleasure to offer this essay for Mathematics Today as a
On the face of it, this caution is justified by two theor
x = 1.0
eps = 1.0
while (not x + eps = x):
eps = eps/2.0
# machine precision is 2*eps, since that was the last value for which
# 1 + eps was not 1
print 2*eps
Practices in source code sharing in astrophysics
Lior Shamir1, John F. Wallin2, Alice Allen3, Bruce Berriman4, Peter Teuben5, Robert J. Nemiroff6, Jessica
Mink7, Robert J. Hanisch8, Kimberly DuPrie3
1. Lawrence Technolo
Roots
PHY 688: Numerical Methods for (Astro)Physics
Root Finding
Basic methods can be understood by looking at the func#on
graphically
Func#on f(x) has a zero at x
Note the sign of f(x) changes at the root
PHY 688: Numerical Methods for (Astro)Physics
Bis
# Simpson's rule
#
# M. Zingale (2013-02-13)
from _future_ import print_function
import math
import numpy as np
import sys
def fun(x):
# function we wish to integrate
return np.exp(-x)
def I_exact(a,b):
# analytic value of the integral
return -math.exp(-b
# compare various approximations of derivatives
from _future_ import print_function
import math
import numpy as np
import matplotlib.pyplot as plt
def func(x):
" the function to be plotted "
f = np.sin(x)
return f
def fprime(x):
" the analytic derivative
# lagrange interpolation example
import math
import numpy
import pylab
# globals to control some behavior
func_type = "tanh"
# can be sine or tanh
points = "fixed" # can be variable or fixed
npts = 15
def fun_exact(x):
" the exact function that we sample
from _future_ import print_function
from scipy.special import erf
import math
# compute erf(1) by numerically doing the integral as a 3-point quadrature:
# trapezoid (compound), Simpson's, and Gauss-Legendre
#
# erf(x) = 2/sqrt(pi) int_0^x exp(-y^2) dy
#
# trapezoidal rule
#
# M. Zingale (2013-02-13)
from _future_ import print_function
import math
import numpy as np
def fun(x):
# function we wish to integrate
return np.exp(-x)
def I_exact(a,b):
# analytic value of the integral
return -math.exp(-b) + math.
Software Engineering Practices
PHY 688: Numerical Methods for (Astro)Physics
Class Business
Does everyone have access to a Linux or Unix machine to work from?
What programming languages do each of you typically use?
PHY 688: Numerical Methods for (Astro)P
Differentiation / Integration
PHY 688: Numerical Methods for (Astro)Physics
Numerical Differentiation
We'll follow the discussion in Pang (Ch. 3) with some additions along
the way
Numerical differentiation approximations are key for:
Solving ODEs
PDEs
PHY