Computation and Programming in Physics - Data Representation / Graphics
Computation and Programming in Physics - Data Representation / Graphics
Syeilendra Pramuditya
Physics Program
Institut Teknologi Bandung
1
2
Data Interpolation
Data xy
3
Data Interpolation
Lagrange Interpolation
Based on Taylor series
General: Polynomial
Simplest: Linear, y = ax + b
And many more methods..
x2,y2
p(x)
x1,y1
2 1 24 5
p ( x 2) 5 3 2 3.67
4 1 1 4 3
5
x2,y2
p(x)
x1,y1
1 4 1
p p (2.5) (3 5) 4
2 2
6
Data
Interpolated
9
Code Structure
Read Input Data File
Interpolate Data
Write (File/Array) Interpolated Output Data
Generate 2D map of the data
10
That gives:
Switching R to r,
15
r Scalar Equation
16
Code Structure
Read Input
How many particles?
Location of each particle
Charge of each particle
Calculation domain (xmin, ymin, xmax, ymax)
Grid resolution
Calculate potential at all nodes/grid-points
Write Output to Datafile
Code Structure
Read Input
How many particles?
Location of each particle
Charge of each particle
Calculation domain (xmin, ymin, xmax, ymax)
Grid resolution
Calculate electric field vector at all nodes/grid-
points
Write Output to Datafile (depends on your
graphic tools)
Position, magnitude, angle
x1, y1, x2, y2
Generate vector map of the output data