Computational Physics
|
|
|
- Scot Bell
- 10 years ago
- Views:
Transcription
1 Computational Physics Sheet 6, Computational Physics Course Professor: H. Ruhl, Exercises: N. Moschüring and N. Elkina Discussion of Solutions: Dec 03, 01, Room A49 Problem 1: Yee solver for Schrödinger s equation in 3D Write a C-program for a FDTD solver of the free Schrödinger equation with periodic boundary conditions in 3D. Assume that ψ( x, 0) = e x w x e y w y e z w z e ikx0x (1) holds, where w x, w y, and w z determine the widths of the Gaussian wave packet and k x0 is the initial momentum of the wave. Solution 1: Yee solver for Schrödinger s equation in 3D Header file for implementation: code/schroedinger.h // // s c h r o e d i n g e r. h // Uebungen Computational Physics 01/13 // // Created by N i l s Moschuering on // n i l s. moschuering@physik. uni muenchen. de // // f i e l d component i d e n t i f i e r s enum PSIRE, PSIIM, NR COMPS, ; #define sqr ( x ) ( ( x ) ( x ) ) // i d e n t i f i e r s f o r t he d i f f e r e n t boundaries // unused f o r s c h r o e d i n g e r f i e l d s enum BND REFLECT, BND PERIODIC, BND PML, BND UPML, ; //macro to l i n e a r i z e 3d space #define F3 OFF( pf, f l d n r, jx, jy, j z ) \ ( ( ( ( ( ( f l d n r ) \
2 ( pf ) >im [ ] + ( ( j z ) (pf ) >ib [ ] ) ) \ ( pf ) >im [ 1 ] + ( ( jy ) (pf ) >ib [ 1 ] ) ) \ ( pf ) >im [ 0 ] + ( ( jx ) (pf ) >ib [ 0 ] ) ) ) ) #define F3( pf, f l d n r, jx, jy, j z ) \ ( ( ( pf ) >data ) [ F3 OFF( pf, f l d n r, jx, jy, j z ) ] ) //macro to perform l o o p i n g over whole 3d space with c o r r e c t argument order // g h o s t c e l l s may be omitted v i a l = r = 0 // x i s the f a s t e s t changing dimension ( compare to F3 macro ) #define f o r e a c h 3 d ( ix, iy, iz, l, r ) \ int i l o [ 3 ] = l, l, l ; \ int i h i [ 3 ] = domain >im [ 0 ] + r, \ domain >im [ 1 ] + r, \ domain >im [ ] + r ; \ for ( int i z = i l o [ ] ; i z < i h i [ ] ; i z++) \ for ( int i y = i l o [ 1 ] ; i y < i h i [ 1 ] ; i y++) \ for ( int i x = i l o [ 0 ] ; i x < i h i [ 0 ] ; i x++) //macro to reduce confusion o f IDEs #define f o r e a c h 3 d e n d \ //macro to perform l o o p i n g over whole 3d space with c o r r e c t argument order // g h o s t c e l l s are i n c l u d e d // x i s the f a s t e s t changing dimension ( compare to F3 macro ) #define f o r e a c h 3 d g ( ix, iy, i z ) \ int i l o [ 3 ] = domain >ib [ 0 ], domain >ib [ 1 ], domain >ib [ ] ; \ int i h i [ 3 ] = domain >im [ 0 ] + domain >ib [ 0 ], \ domain >im [ 1 ] + domain >ib [ 1 ], \ domain >im [ ] + domain >ib [ ] ; \ for ( int i z = i l o [ ] ; i z < i h i [ ] ; i z++) \ for ( int i y = i l o [ 1 ] ; i y < i h i [ 1 ] ; i y++) \ for ( int i x = i l o [ 0 ] ; i x < i h i [ 0 ] ; i x++) / macro to c r e a t e f u n c t i o n s f o r s t r u c t u r e s c r e a t e : a l l o c a t e s memory f o r the s t r u c t u r e and i n i t i a l i z e s i t to zero d e s t r o y : o p t i o n a l l y c a l l s s u p p l i e d d e s t r o y f u n c t i o n f r e e s memory o f s t r u c t u r e / #define MAKE FUNCS(name, destroy ) \ struct name c r e a t e ##name ( ) \ \ return ( struct name ) c a l l o c ( 1, sizeof ( struct name) ) ; \ \ void d e s t r o y ##name( struct name obj ) \ \ void ( ##name## d e s t r o y ) ( struct name name) = destroy ; \ i f ( ##name## d e s t r o y ) ##name## d e s t r o y ( obj ) ; \
3 f r e e ( obj ) ; \ // return t r u e i f p o s i t i o n [ x, y, z ] can be found i n s i d e the pml r egion o f the domain #define i n s i d e p m l ( x, y, z ) \ ( ( ( x ) < domain >pml [ 0 ] ) ( ( x ) >= domain >im [ 0 ] domain >pml [ 0 ] ) \ ( ( y ) < domain >pml [ 1 ] ) ( ( y ) >= domain >im [ 1 ] domain >pml [ 1 ] ) \ ( ( z ) < domain >pml [ ] ) ( ( z ) >= domain >im [ ] domain >pml [ ] ) ) // s t r u c t u r e to contain f i e l d information struct f i e l d double data ; int im [ 3 ] ; int ib [ 3 ] ; ; // s t r u c t u r e to hold output information struct output FILE f i l e ; int output every ; // i n t e r v a l l between f i e l d o u t p u t s ; // s t r u c t u r e to hold information about the domain s t r u c t u r e struct domain double length [ 3 ] ; //some normalized box s i z e int im [ 3 ] ; //number o f grid p o i n t s int ib [ 3 ] ; //number o f g h o s t c e l l s ( must be 1) int tmax ; //number o f d e s i r e d t i m e s t e p s int bnds [ 3 ] ; // boundary type in each d i r e c t i o n int pml [ 3 ] ; //pml r e g i o n s i z e in each d i r e c t i o n // i f PMLs a c t i v e : constant c o n d u c t i v i t y in pml r e g i o n s // e l s e : constant c o n d u c t i v i t y everywhere // unused f o r s c h r o e d i n g e r f i e l d s double sigma [ 3 ] ; double s i g m a i [ 3 ] ; ; struct c o e f f double dx [ 3 ] ; double dt ; double eps0 ; ; Source file: code/schroedinger.c // // s c h r o e d i n g e r. c // Uebungen Computational Physics 01/13 // // Created by N i l s Moschuering on // n i l s. moschuering@physik. uni muenchen. de
4 // #include <s t d i o. h> #include <math. h> #include <s t d l i b. h> #include <a s s e r t. h> #include s c h r o e d i n g e r. h // f u n c t i o n to d e s t r o y memory s t r u c t u r e f o r f i e l d information void f r e e f i e l d ( struct f i e l d fp ) f r e e ( fp >data ) ; MAKE FUNCS( f i e l d, f r e e f i e l d ) ; // f u n c t i o n to d e s t r o y memory s t r u c t u r e f o r output information void f r e e o u t p u t ( struct output output ) f c l o s e ( output > f i l e ) ; MAKE FUNCS( output, f r e e o u t p u t ) ; MAKE FUNCS( domain, NULL) ; MAKE FUNCS( c o e f f, NULL) ; // f u n c t i o n to c r e a t e memory s t r u c t u r e f o r f i e l d information void c r e a t e f i e l d d a t a ( struct f i e l d fp, struct domain domain, int nr comps ) int s i z e = nr comps ; for ( int i = 0 ; i < 3 ; i++) fp >im [ i ] = domain >im [ i ] + domain >ib [ i ] ; fp >ib [ i ] = domain >ib [ i ] ; s i z e = fp >im [ i ] ; fp >data = ( double ) c a l l o c ( s i z e, sizeof ( fp >data ) ) ; // v a l u e o f a 3d gaussian ( with maximum at xm, width dxm and frequency f, // f l y i n g in x d i r e c t i o n ) r e a l p a rt // at p o s i t i o n [ xx, yy, z z ] // needed f o r i n i t i a l i z a t i o n i n l i n e double wave 3d re ( double xx, double yy, double zz, double xm, double dxm, double f ) double xr = xx xm [ 0 ] ; double yr = yy xm [ 1 ] ; double zr = zz xm [ ] ; return ( exp( sqr ( xr /dxm [ 0 ] ) ) exp( sqr ( yr /dxm [ 1 ] ) ) exp( sqr ( zr /dxm [ ] ) ) ) cos ( f. M PI ( xr ) ) ;
5 // v a l u e o f a 3d gaussian ( with maximum at xm, width dxm and frequency f, // f l y i n g in x d i r e c t i o n ) imaginary part // at p o s i t i o n [ xx, yy, z z ] // needed f o r i n i t i a l i z a t i o n i n l i n e double wave 3d im ( double xx, double yy, double zz, double xm, double dxm, double f ) double xr = xx xm [ 0 ] ; double yr = yy xm [ 1 ] ; double zr = zz xm [ ] ; return ( exp( sqr ( xr /dxm [ 0 ] ) ) exp( sqr ( yr /dxm [ 1 ] ) ) exp( sqr ( zr /dxm [ ] ) ) ) s i n ( f. M PI ( xr ) ) ; // p e r i o d i c boundaries f o r f i e l d s ( one g h o s t c e l l ) void exchange PSI ( struct f i e l d fp, int im ) for ( int i z = 0 ; i z < im [ ] ; i z++) for ( int i y = 0 ; i y < im [ 1 ] ; i y++) F3( fp, PSIRE, 1, iy, i z ) = F3( fp, PSIRE, im [ 0 ] 1, iy, i z ) ; F3( fp, PSIIM, 1, iy, i z ) = F3( fp, PSIIM, im [ 0 ] 1, iy, i z ) ; F3( fp, PSIRE, im [ 0 ], iy, i z ) = F3( fp, PSIRE, 0, iy, i z ) ; F3( fp, PSIIM, im [ 0 ], iy, i z ) = F3( fp, PSIIM, 0, iy, i z ) ; for ( int i z = 0 ; i z < im [ ] ; i z++) for ( int i x = 0 ; i x < im [ 0 ] ; i x++) F3( fp, PSIRE, ix, 1, i z ) = F3( fp, PSIRE, ix, im [ 1 ] 1, i z ) ; F3( fp, PSIIM, ix, 1, i z ) = F3( fp, PSIIM, ix, im [ 1 ] 1, i z ) ; F3( fp, PSIRE, ix, im [ 1 ], i z ) = F3( fp, PSIRE, ix, 0, i z ) ; F3( fp, PSIIM, ix, im [ 1 ], i z ) = F3( fp, PSIIM, ix, 0, i z ) ; for ( int i y = 0 ; i y < im [ 1 ] ; i y++) for ( int i x = 0 ; i x < im [ 0 ] ; i x++) F3( fp, PSIRE, ix, iy, 1) = F3( fp, PSIRE, ix, iy, im [ ] 1) ; F3( fp, PSIIM, ix, iy, 1) = F3( fp, PSIIM, ix, iy, im [ ] 1) ; F3( fp, PSIRE, ix, iy, im [ ] ) = F3( fp, PSIRE, ix, iy, 0) ; F3( fp, PSIIM, ix, iy, im [ ] ) = F3( fp, PSIIM, ix, iy, 0) ; void i n i t o u t p u t ( struct output out, struct domain domain, int output every ) out > f i l e = fopen (. / out, wb ) ; f w r i t e (&domain >tmax, sizeof ( domain >tmax ), 1, out > f i l e ) ; f w r i t e ( domain >im, sizeof ( int ), 3, out > f i l e ) ;
6 f w r i t e (&output every, sizeof ( int ), 1, out > f i l e ) ; out >output every = output every ; // i n i t i a l i z a t i o n o f f i e l d data void i n i t f i e l d ( struct f i e l d fp, struct c o e f f c o e f f, struct domain domain ) double x0 [ 3 ] =. 5,. 5,. 5 ; double sigma [ 3 ] =. 1 5,. 1 5,. 1 5 ; double f r e q = 5. ; f o r e a c h 3 d g ( ix, iy, i z ) F3( fp, PSIRE, ix, iy, i z ) = wave 3d re ( i x c o e f f >dx [ 0 ], i y c o e f f >dx [ 1 ], i z c o e f f >dx [ ], x0, sigma, f r e q ) ; F3( fp, PSIIM, ix, iy, i z ) = wave 3d im ( i x c o e f f >dx [ 0 ], i y c o e f f >dx [ 1 ], i z c o e f f >dx [ ], x0, sigma, f r e q ) ; f o r e a c h 3 d e n d ; // output a b s o l u t e v a l u e o f wave f u n c t i o n to f i l e void output data ( struct output output, int t, struct f i e l d fp, struct domain domain ) i f ( ( t % output >output every ) == 0) f o r e a c h 3 d ( ix, iy, iz, 0, 0) double a b s v a l u e = sqr (F3( fp, PSIRE, ix, iy, i z ) ) + sqr (F3( fp, PSIIM, ix, iy, i z ) ) ; f w r i t e (& abs value, sizeof ( double ), 1, output > f i l e ) ; // f w r i t e (&F3( fp, PSIRE, ix, iy, i z ), s i z e o f ( double ), 1, output > f i l e ) ; f o r e a c h 3 d e n d ; // s p a t i a l and temporal s t e p s i z e c a l c u l a t i o n in 3d void i n i t c o e f f ( struct c o e f f c o e f f, struct domain domain ) for ( int i = 0 ; i < 3 ; i ++) c o e f f >dx [ i ] = domain >l e n g t h [ i ] / domain >im [ i ] ; double inv sum = 0. ; for ( int d=0;d<3;d++) i f ( domain >im [ d ] > 1) inv sum += sqr ( 1. / ( c o e f f >dx [ d ] c o e f f >dx [ d ] ) ) ; a s s e r t ( inv sum ) ; // Simulation has 0 dimensions c o e f f >dt = 0. 5 s q r t ( 1. / inv sum ) ; // courant f a c t o r a p p a r e n t l y needs to very low c o e f f >eps0 = 1. ; // i n i t i a l i z e your s i m u l a t i o n domain
7 void i n i t d o m a i n ( struct domain domain ) domain >length [ 0 ] = 1. ; domain >length [ 1 ] = 1. ; domain >length [ ] = 1. ; domain >im [ 0 ] = 5 0 ; domain >im [ 1 ] = 5 0 ; domain >im [ ] = 5 0 ; domain >ib [ 0 ] = 1 ; domain >ib [ 1 ] = 1 ; domain >ib [ ] = 1 ; domain >tmax = 00; domain >bnds [ 0 ] = BND PERIODIC ; domain >bnds [ 1 ] = BND PERIODIC ; domain >bnds [ ] = BND PERIODIC ; // unused double sigma = 3 0. ; domain >sigma [ 0 ] = sigma ; domain >sigma [ 1 ] = sigma ; domain >sigma [ ] = sigma ; domain >s i g m a i [ 0 ] = sigma ; domain >s i g m a i [ 1 ] = sigma ; domain >s i g m a i [ ] = sigma ; domain >pml [ 0 ] = 7 ; domain >pml [ 1 ] = 7 ; domain >pml [ ] = 7 ; ; int main ( int argc, char argv ) // c r e a t e and i n i t i a l i z e s t r u c t u r e s struct domain domain = create domain ( ) ; i n i t d o m a i n ( domain ) ; struct c o e f f c o e f f i c i e n t s = c r e a t e c o e f f ( ) ; i n i t c o e f f ( c o e f f i c i e n t s, domain ) ; struct output output = c r e a t e o u t p u t ( ) ; int output every = 1 0 ; i n i t o u t p u t ( output, domain, output every ) ; struct f i e l d fp = c r e a t e f i e l d ( ) ; c r e a t e f i e l d d a t a ( fp, domain, NR COMPS) ; i n i t f i e l d ( fp, c o e f f i c i e n t s, domain ) ; double cnx = c o e f f i c i e n t s >dt / (. 0 c o e f f i c i e n t s >dx [ 0 ] c o e f f i c i e n t s >dx [ 0 ] ) ; double cny = c o e f f i c i e n t s >dt / (. 0 c o e f f i c i e n t s >dx [ 1 ] c o e f f i c i e n t s >dx [ 1 ] ) ; double cnz = c o e f f i c i e n t s >dt / (. 0 c o e f f i c i e n t s >dx [ ] c o e f f i c i e n t s >dx [ ] ) ; //FDTD i n t e g r a t i o n loop for ( double t = 0 ; t < domain >tmax ; t++)
8 output data ( output, t, fp, domain ) ; // data output exchange PSI ( fp, domain >im ) ; // p e r i o d i c boundary c o n d i t i o n s // imaginary p a r t update f o r e a c h 3 d ( ix, iy, iz, 0, 0) F3( fp, PSIIM, ix, iy, i z ) += ( cnx (F3( fp, PSIRE, i x +1, iy, i z ). F3( fp, PSIRE, ix, iy, i z ) + F3( fp, PSIRE, ix 1, iy, i z ) ) + cny (F3( fp, PSIRE, ix, i y +1, i z ). F3( fp, PSIRE, ix, iy, i z ) + F3( fp, PSIRE, ix, iy 1, i z ) ) + cnz (F3( fp, PSIRE, ix, iy, i z +1). F3( fp, PSIRE, ix, iy, i z ) + F3( fp, PSIRE, ix, iy, iz 1) ) ) ; f o r e a c h 3 d e n d ; exchange PSI ( fp, domain >im ) ; // p e r i o d i c boundary c o n d i t i o n s // r e a l p a rt update f o r e a c h 3 d ( ix, iy, iz, 0, 0) F3( fp, PSIRE, ix, iy, i z ) = ( cnx (F3( fp, PSIIM, i x +1, iy, i z ). F3( fp, PSIIM, ix, iy, i z ) + F3( fp, PSIIM, ix 1, iy, i z ) ) + cny (F3( fp, PSIIM, ix, i y +1, i z ). F3( fp, PSIIM, ix, iy, i z ) + F3( fp, PSIIM, ix, iy 1, i z ) ) + cnz (F3( fp, PSIIM, ix, iy, i z +1). F3( fp, PSIIM, ix, iy, i z ) + F3( fp, PSIIM, ix, iy, iz 1) ) ) ; f o r e a c h 3 d e n d ; // cleanup d e s t r o y c o e f f ( c o e f f i c i e n t s ) ; d e s t r o y f i e l d ( fp ) ; d e s t r o y o u t p u t ( output ) ; destroy domain ( domain ) ; The following python script can be used to analyze the resulting data: from pylab import import array as ar code/anim.py ion ( ) f = open ( out, rb ) x = ar. array ( i ) x. f r o m f i l e ( f, 5) x = x. t o l i s t ( ) t i m e s t e p s = x [ 0 ] g r i d s i z e = x [ 1 : 4 ] output every = x [ 4 ] t i m e s t e p s = ( ( t i m e s t e p s 1) / output every + 1)
9 (a) (b) Figure 1: Plot of the real part of a Gaussian wave packet propagating to the right with h = m e = 1, box dimensions L x = L y = L z = 1.0, resolution x = y = z = 0.01, t = , Gaussian packet widths w x = w y = w z = 0.1. Plot (a) gives the real part of the wave packet at t = 0 and plot (b) at t = 300 t. s i z e = t i m e s t e p s g r i d s i z e [ 0 ] g r i d s i z e [ 1 ] g r i d s i z e [ ] x = ar. array ( d ) x. f r o m f i l e ( f, s i z e ) x = array ( x. t o l i s t ( ) ) f. c l o s e ( ) g r i d s i z e. r e v e r s e ( ) x = x. reshape ( timesteps, g r i d s i z e ) #s l i c e in x y d i r e c t i o n image = imshow ( x [ 0 ] [ g r i d s i z e [ 0 ] / ], animated=true ) for i in arange ( 1, t i m e s t e p s ) : raw input ( Wait ) image. s e t d a t a ( x [ i ] [ g r i d s i z e [ 0 ] / ] ) #image. a u t o s c a l e ( ) draw ( ) A plot of the real part can be found in fig. 1. A plot of the absolute value of the wave function can be found in fig.. Problem : Dispersion relation for the Yee solver of Schrödinger s equation Obtain the dispersion relation of the free non-relativistic Schrödinger equation in 3D. Solution : Dispersion relation for the Yee solver of Schrödinger s equation
10 (a) (b) Figure : Plot of the absolute value of a Gaussian wave packet propagating to the right with h = m e = 1, box dimensions L x = L y = L z = 1.0, resolution x = y = z = 0.01, t = , Gaussian packet widths w x = w y = w z = 0.1. Plot (a) gives the absolute value of the wave packet at t = 0 and plot (b) at t = 300 t. The FDTD discretization for the free Schrödinger equation becomes ψ n+ 1 j,im 1 ψn j,im = + ( ψ n m x j+1,re ψj,re n + ψj 1,Re n ), () ψ n+1 j,re ψn j,re = ( ) m x ψ n+ 1 j+1,im 1 ψn+ j,im + 1 ψn+ j 1,Im. (3) To solve the discrete free Schrödinger equation we make the ansatz We obtain ψ n j,re = ψ 0,Re e i(ωn t kj x), (4) ψ n j,im = ψ 0,Im e i(ωn t kj x). (5) Or alternatively we find ωn t ωn t i e +i e ψ 0,Re t ωn t ωn t i e +i e ψ 0,Im t = hψ 0,Im m = hψ 0,Re m e +ik x + e ik x x, (6) e +ik x + e ik x x. (7) ( ) ( ) ω t k x i ψ 0,Re sin = ψ 0,Im m x sin, (8) ( ) ( ) ω t k x i ψ 0,Im sin = +ψ 0,Re m x sin (9) or alternatively Finally, we obtain ( i sin ( ) ω t sin ( k x m x ) m x sin ( ) ) ( ) k x ) ψre = 0. (10) ψ Im i sin ( ω t ( ) ( ) ( ) ω t k x sin = m x sin 4. (11)
11 Performing this calculation in 3D leads to the following or ( ) ω t sin ω t ( ) ( ) = m x sin 4 kx x ( ) ( ) + m y sin 4 ky y ( ) ( ) + m z sin 4 kz z ([ ( ) ( ) = arcsin m x sin 4 kx x ( ) ( ) + m y sin 4 ky y ( ) ( ) ] 1 + m z sin 4 kz z. (1) (13) Problems are published in the lecture material. Hence, there is always the chance to work on the problems ahead of time.
Illustration 1: Diagram of program function and data flow
The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline
Mathematics. (www.tiwariacademy.com : Focus on free Education) (Chapter 5) (Complex Numbers and Quadratic Equations) (Class XI)
( : Focus on free Education) Miscellaneous Exercise on chapter 5 Question 1: Evaluate: Answer 1: 1 ( : Focus on free Education) Question 2: For any two complex numbers z1 and z2, prove that Re (z1z2) =
Scientific Programming in Python
UCSD March 9, 2009 What is Python? Python in a very high level (scripting) language which has gained widespread popularity in recent years. It is: What is Python? Python in a very high level (scripting)
MATH 381 HOMEWORK 2 SOLUTIONS
MATH 38 HOMEWORK SOLUTIONS Question (p.86 #8). If g(x)[e y e y ] is harmonic, g() =,g () =, find g(x). Let f(x, y) = g(x)[e y e y ].Then Since f(x, y) is harmonic, f + f = and we require x y f x = g (x)[e
Signal Processing First Lab 01: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization.
Signal Processing First Lab 01: Introduction to MATLAB Pre-Lab and Warm-Up: You should read at least the Pre-Lab and Warm-up sections of this lab assignment and go over all exercises in the Pre-Lab section
MATH 425, PRACTICE FINAL EXAM SOLUTIONS.
MATH 45, PRACTICE FINAL EXAM SOLUTIONS. Exercise. a Is the operator L defined on smooth functions of x, y by L u := u xx + cosu linear? b Does the answer change if we replace the operator L by the operator
Scientific Programming
1 The wave equation Scientific Programming Wave Equation The wave equation describes how waves propagate: light waves, sound waves, oscillating strings, wave in a pond,... Suppose that the function h(x,t)
4. Complex integration: Cauchy integral theorem and Cauchy integral formulas. Definite integral of a complex-valued function of a real variable
4. Complex integration: Cauchy integral theorem and Cauchy integral formulas Definite integral of a complex-valued function of a real variable Consider a complex valued function f(t) of a real variable
RAJALAKSHMI ENGINEERING COLLEGE MA 2161 UNIT I - ORDINARY DIFFERENTIAL EQUATIONS PART A
RAJALAKSHMI ENGINEERING COLLEGE MA 26 UNIT I - ORDINARY DIFFERENTIAL EQUATIONS. Solve (D 2 + D 2)y = 0. 2. Solve (D 2 + 6D + 9)y = 0. PART A 3. Solve (D 4 + 4)x = 0 where D = d dt 4. Find Particular Integral:
Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart
Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart Overview Due Thursday, November 12th at 11:59pm Last updated
d d Φ * Φdx T(B) Barrier (B ) : Vo = 5, a = 2 Well (W ) : Vo= -5, a = 2 0.0 0 2 4 6 8 10 12 14 16 18 20 ENERGY (E)
Quantum Mechanical Transmission with Absorption S. MAHADEVAN, A. UMA MAHESWARI, P. PREMA AND C. S. SHASTRY Physics Department, Amrita Vishwa Vidyapeetham, Coimbatore 641105 ABSTRACT Transmission and reflection
The continuous and discrete Fourier transforms
FYSA21 Mathematical Tools in Science The continuous and discrete Fourier transforms Lennart Lindegren Lund Observatory (Department of Astronomy, Lund University) 1 The continuous Fourier transform 1.1
Lecture 18-19 Data Types and Types of a Language
Lecture 18-19 Data Types and Types of a Language April 29, 2014 Data Types and Types of a Language Data, Data Types and Types Type: Generalities Type Systems and Type Safety Type Equivalence, Coercion
Mode Patterns of Parallel plates &Rectangular wave guides Mr.K.Chandrashekhar, Dr.Girish V Attimarad
International Journal of Scientific & Engineering Research Volume 3, Issue 8, August-2012 1 Mode Patterns of Parallel plates &Rectangular wave guides Mr.K.Chandrashekhar, Dr.Girish V Attimarad Abstract-Parallel
This makes sense. t 2 1 + 1/t 2 dt = 1. t t 2 + 1dt = 2 du = 1 3 u3/2 u=5
1. (Line integrals Using parametrization. Two types and the flux integral) Formulas: ds = x (t) dt, d x = x (t)dt and d x = T ds since T = x (t)/ x (t). Another one is Nds = T ds ẑ = (dx, dy) ẑ = (dy,
An Introduction to FreeFem++ UPMC, September 2010 O. Pantz. CMAP, Ecole Polytechnique.
An Introduction to FreeFem++ UPMC, September 2010 O. Pantz CMAP, Ecole Polytechnique. FreeFem++ What is it? FreeFEM++ is a Free software to solve PDE using the Finite Element Method. It runs on Windows,
Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies:
Exercise 0 Deadline: None Computer Setup Windows Download Python(x,y) via http://code.google.com/p/pythonxy/wiki/downloads and install it. Make sure that before installation the installer does not complain
440 Geophysics: Heat flow with finite differences
440 Geophysics: Heat flow with finite differences Thorsten Becker, University of Southern California, 03/2005 Some physical problems, such as heat flow, can be tricky or impossible to solve analytically
Introduction to Complex Numbers in Physics/Engineering
Introduction to Complex Numbers in Physics/Engineering ference: Mary L. Boas, Mathematical Methods in the Physical Sciences Chapter 2 & 14 George Arfken, Mathematical Methods for Physicists Chapter 6 The
Object Oriented Software Design II
Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February
7. DYNAMIC LIGHT SCATTERING 7.1 First order temporal autocorrelation function.
7. DYNAMIC LIGHT SCATTERING 7. First order temporal autocorrelation function. Dynamic light scattering (DLS) studies the properties of inhomogeneous and dynamic media. A generic situation is illustrated
FX 115 MS Training guide. FX 115 MS Calculator. Applicable activities. Quick Reference Guide (inside the calculator cover)
Tools FX 115 MS Calculator Handouts Other materials Applicable activities Quick Reference Guide (inside the calculator cover) Key Points/ Overview Advanced scientific calculator Two line display VPAM to
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Channel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG
Channel Access Client Programming Andrew Johnson Computer Scientist, AES-SSG Channel Access The main programming interface for writing Channel Access clients is the library that comes with EPICS base Written
ESPResSo Summer School 2012
ESPResSo Summer School 2012 Introduction to Tcl Pedro A. Sánchez Institute for Computational Physics Allmandring 3 D-70569 Stuttgart Germany http://www.icp.uni-stuttgart.de 2/26 Outline History, Characteristics,
Lecture 3: Linear methods for classification
Lecture 3: Linear methods for classification Rafael A. Irizarry and Hector Corrada Bravo February, 2010 Today we describe four specific algorithms useful for classification problems: linear regression,
Transmission Lines. Smith Chart
Smith Chart The Smith chart is one of the most useful graphical tools for high frequency circuit applications. The chart provides a clever way to visualize complex functions and it continues to endure
L 2 : x = s + 1, y = s, z = 4s + 4. 3. Suppose that C has coordinates (x, y, z). Then from the vector equality AC = BD, one has
The line L through the points A and B is parallel to the vector AB = 3, 2, and has parametric equations x = 3t + 2, y = 2t +, z = t Therefore, the intersection point of the line with the plane should satisfy:
General Theory of Differential Equations Sections 2.8, 3.1-3.2, 4.1
A B I L E N E C H R I S T I A N U N I V E R S I T Y Department of Mathematics General Theory of Differential Equations Sections 2.8, 3.1-3.2, 4.1 Dr. John Ehrke Department of Mathematics Fall 2012 Questions
Module 816. File Management in C. M. Campbell 1993 Deakin University
M. Campbell 1993 Deakin University Aim Learning objectives Content After working through this module you should be able to create C programs that create an use both text and binary files. After working
5.4 The Heat Equation and Convection-Diffusion
5.4. THE HEAT EQUATION AND CONVECTION-DIFFUSION c 6 Gilbert Strang 5.4 The Heat Equation and Convection-Diffusion The wave equation conserves energy. The heat equation u t = u xx dissipates energy. The
Programming a truss finite element solver in C
CHAPTER 4 Programming a truss finite element solver in C In this section, some C functions are developed that allow to compute displacements and internal efforts of a two-dimensional truss structure. 4.1
GPR Polarization Simulation with 3D HO FDTD
Progress In Electromagnetics Research Symposium Proceedings, Xi an, China, March 6, 00 999 GPR Polarization Simulation with 3D HO FDTD Jing Li, Zhao-Fa Zeng,, Ling Huang, and Fengshan Liu College of Geoexploration
19.6. Finding a Particular Integral. Introduction. Prerequisites. Learning Outcomes. Learning Style
Finding a Particular Integral 19.6 Introduction We stated in Block 19.5 that the general solution of an inhomogeneous equation is the sum of the complementary function and a particular integral. We have
2.2 Magic with complex exponentials
2.2. MAGIC WITH COMPLEX EXPONENTIALS 97 2.2 Magic with complex exponentials We don t really know what aspects of complex variables you learned about in high school, so the goal here is to start more or
Lecture 6 Black-Scholes PDE
Lecture 6 Black-Scholes PDE Lecture Notes by Andrzej Palczewski Computational Finance p. 1 Pricing function Let the dynamics of underlining S t be given in the risk-neutral measure Q by If the contingent
COMPLEX NUMBERS AND DIFFERENTIAL EQUATIONS
COMPLEX NUMBERS AND DIFFERENTIAL EQUATIONS BORIS HASSELBLATT CONTENTS. Introduction. Why complex numbers were introduced 3. Complex numbers, Euler s formula 3 4. Homogeneous differential equations 8 5.
The Bending Strength of Pasta
The Bending Strength of Pasta 1.105 Lab #1 Louis L. Bucciarelli 9 September, 2003 Lab Partners: [Name1] [Name2] Data File: Tgroup3.txt On the cover page, include your name, the names of your lab partners,
Solving ODEs in Matlab. BP205 M.Tremont 1.30.2009
Solving ODEs in Matlab BP205 M.Tremont 1.30.2009 - Outline - I. Defining an ODE function in an M-file II. III. IV. Solving first-order ODEs Solving systems of first-order ODEs Solving higher order ODEs
MATH 31B: MIDTERM 1 REVIEW. 1. Inverses. yx 3y = 1. x = 1 + 3y y 4( 1) + 32 = 1
MATH 3B: MIDTERM REVIEW JOE HUGHES. Inverses. Let f() = 3. Find the inverse g() for f. Solution: Setting y = ( 3) and solving for gives and g() = +3. y 3y = = + 3y y. Let f() = 4 + 3. Find a domain on
Lecture 8. Generating a non-uniform probability distribution
Discrete outcomes Lecture 8 Generating a non-uniform probability distribution Last week we discussed generating a non-uniform probability distribution for the case of finite discrete outcomes. An algorithm
Mathematics Discrete Mathematics (F06-S07), Finite Mathematics (F00-S01, S07), Intermediate Algebra
Curriculum Vitae J.F. (Jim) Nystrom, Ph.D. Visiting Assistant Professor School of Natural Sciences and Mathematics Shepherd University Shepherdstown, WV 25443-3210 Research Interest Areas Algorithm design
FUNDAMENTALS OF ENGINEERING (FE) EXAMINATION REVIEW
FE: Electric Circuits C.A. Gross EE1-1 FUNDAMENTALS OF ENGINEERING (FE) EXAMINATION REIEW ELECTRICAL ENGINEERING Charles A. Gross, Professor Emeritus Electrical and Comp Engineering Auburn University Broun
Controller Design in Frequency Domain
ECSE 4440 Control System Engineering Fall 2001 Project 3 Controller Design in Frequency Domain TA 1. Abstract 2. Introduction 3. Controller design in Frequency domain 4. Experiment 5. Colclusion 1. Abstract
Programming languages C
INTERNATIONAL STANDARD ISO/IEC 9899:1999 TECHNICAL CORRIGENDUM 2 Published 2004-11-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE
Computer Science 1 CSci 1100 Lecture 3 Python Functions
Reading Computer Science 1 CSci 1100 Lecture 3 Python Functions Most of this is covered late Chapter 2 in Practical Programming and Chapter 3 of Think Python. Chapter 6 of Think Python goes into more detail,
2. Length and distance in hyperbolic geometry
2. Length and distance in hyperbolic geometry 2.1 The upper half-plane There are several different ways of constructing hyperbolic geometry. These different constructions are called models. In this lecture
MATLAB Tutorial. Chapter 6. Writing and calling functions
MATLAB Tutorial Chapter 6. Writing and calling functions In this chapter we discuss how to structure a program with multiple source code files. First, an explanation of how code files work in MATLAB is
Parameter Passing. Standard mechanisms. Call by value-result Call by name, result
Parameter Passing Standard mechanisms Call by value Call by reference Other methods Call by value-result Call by name, result Terms Function definition where the details of the function are presented (type,
arxiv:1603.01211v1 [quant-ph] 3 Mar 2016
Classical and Quantum Mechanical Motion in Magnetic Fields J. Franklin and K. Cole Newton Department of Physics, Reed College, Portland, Oregon 970, USA Abstract We study the motion of a particle in a
EA-200. http://world.casio.com/edu/ Technical Reference. Contents. Sampling... 2 Analog Sampling... 3 Memory... 3 Pulse Sampling...
E Contents EA-200 Technical Reference Sampling... 2 Analog Sampling... 3 Memory... 3 Pulse Sampling... 4 Command Tables... 5 Command 1: Channel Settings... 9 Command 3: Sampling and Trigger Settings...
Wavelet analysis. Wavelet requirements. Example signals. Stationary signal 2 Hz + 10 Hz + 20Hz. Zero mean, oscillatory (wave) Fast decay (let)
Wavelet analysis In the case of Fourier series, the orthonormal basis is generated by integral dilation of a single function e jx Every 2π-periodic square-integrable function is generated by a superposition
SOLUTIONS. f x = 6x 2 6xy 24x, f y = 3x 2 6y. To find the critical points, we solve
SOLUTIONS Problem. Find the critical points of the function f(x, y = 2x 3 3x 2 y 2x 2 3y 2 and determine their type i.e. local min/local max/saddle point. Are there any global min/max? Partial derivatives
The Wave Equation in 1D and 2D
The Wave Equation in 1D and 2D Knut Andreas Lie Dept. of Informatics, University of Oslo INF234 / Spring 25 p. Wave Equation in 1D Physical phenomenon: small vibrations on a string Mathematical model:
LINEAR ALGEBRA W W L CHEN
LINEAR ALGEBRA W W L CHEN c W W L Chen, 1997, 2008 This chapter is available free to all individuals, on understanding that it is not to be used for financial gain, and may be downloaded and/or photocopied,
Chapter 13 Storage classes
Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same
Electromagnetism - Lecture 2. Electric Fields
Electromagnetism - Lecture 2 Electric Fields Review of Vector Calculus Differential form of Gauss s Law Poisson s and Laplace s Equations Solutions of Poisson s Equation Methods of Calculating Electric
Lecture Notes on Polynomials
Lecture Notes on Polynomials Arne Jensen Department of Mathematical Sciences Aalborg University c 008 Introduction These lecture notes give a very short introduction to polynomials with real and complex
Finite Difference Time Domain and BPM: Flexible Algorithm Selection Technology
Finite Difference Time Domain and BPM: Flexible Algorithm Selection Technology 1. Introduction This application note shows the use of the Finite Difference Time Domain (FDTD) module in the calculation
Design and Optimization of a Portable Lattice Boltzmann Code for Heterogeneous Architectures
Design and Optimization of a Portable Lattice Boltzmann Code for Heterogeneous Architectures E Calore, S F Schifano, R Tripiccione Enrico Calore INFN Ferrara, Italy Perspectives of GPU Computing in Physics
Frequency-domain and stochastic model for an articulated wave power device
Frequency-domain stochastic model for an articulated wave power device J. Cândido P.A.P. Justino Department of Renewable Energies, Instituto Nacional de Engenharia, Tecnologia e Inovação Estrada do Paço
Time Series Analysis
Time Series Analysis [email protected] Informatics and Mathematical Modelling Technical University of Denmark DK-2800 Kgs. Lyngby 1 Outline of the lecture Identification of univariate time series models, cont.:
The sample space for a pair of die rolls is the set. The sample space for a random number between 0 and 1 is the interval [0, 1].
Probability Theory Probability Spaces and Events Consider a random experiment with several possible outcomes. For example, we might roll a pair of dice, flip a coin three times, or choose a random real
SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA
SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA This handout presents the second derivative test for a local extrema of a Lagrange multiplier problem. The Section 1 presents a geometric motivation for the
College of the Holy Cross, Spring 2009 Math 373, Partial Differential Equations Midterm 1 Practice Questions
College of the Holy Cross, Spring 29 Math 373, Partial Differential Equations Midterm 1 Practice Questions 1. (a) Find a solution of u x + u y + u = xy. Hint: Try a polynomial of degree 2. Solution. Use
Vector and Matrix Norms
Chapter 1 Vector and Matrix Norms 11 Vector Spaces Let F be a field (such as the real numbers, R, or complex numbers, C) with elements called scalars A Vector Space, V, over the field F is a non-empty
Solutions for Math 311 Assignment #1
Solutions for Math 311 Assignment #1 (1) Show that (a) Re(iz) Im(z); (b) Im(iz) Re(z). Proof. Let z x + yi with x Re(z) and y Im(z). Then Re(iz) Re( y + xi) y Im(z) and Im(iz) Im( y + xi) x Re(z). () Verify
3. Regression & Exponential Smoothing
3. Regression & Exponential Smoothing 3.1 Forecasting a Single Time Series Two main approaches are traditionally used to model a single time series z 1, z 2,..., z n 1. Models the observation z t as a
Some strong sufficient conditions for cyclic homogeneous polynomial inequalities of degree four in nonnegative variables
Available online at www.tjnsa.com J. Nonlinear Sci. Appl. 6 (013), 74 85 Research Article Some strong sufficient conditions for cyclic homogeneous polynomial inequalities of degree four in nonnegative
Integration. Topic: Trapezoidal Rule. Major: General Engineering. Author: Autar Kaw, Charlie Barker. http://numericalmethods.eng.usf.
Integration Topic: Trapezoidal Rule Major: General Engineering Author: Autar Kaw, Charlie Barker 1 What is Integration Integration: The process of measuring the area under a function plotted on a graph.
Euler s Method and Functions
Chapter 3 Euler s Method and Functions The simplest method for approximately solving a differential equation is Euler s method. One starts with a particular initial value problem of the form dx dt = f(t,
Solutions for Review Problems
olutions for Review Problems 1. Let be the triangle with vertices A (,, ), B (4,, 1) and C (,, 1). (a) Find the cosine of the angle BAC at vertex A. (b) Find the area of the triangle ABC. (c) Find a vector
How To Factor By Gcf In Algebra 1.5
7-2 Factoring by GCF Warm Up Lesson Presentation Lesson Quiz Algebra 1 Warm Up Simplify. 1. 2(w + 1) 2. 3x(x 2 4) 2w + 2 3x 3 12x Find the GCF of each pair of monomials. 3. 4h 2 and 6h 2h 4. 13p and 26p
Programming Languages & Tools
4 Programming Languages & Tools Almost any programming language one is familiar with can be used for computational work (despite the fact that some people believe strongly that their own favorite programming
Scicos is a Scilab toolbox included in the Scilab package. The Scicos editor can be opened by the scicos command
7 Getting Started 7.1 Construction of a Simple Diagram Scicos contains a graphical editor that can be used to construct block diagram models of dynamical systems. The blocks can come from various palettes
Help on the Embedded Software Block
Help on the Embedded Software Block Powersim Inc. 1. Introduction The Embedded Software Block is a block that allows users to model embedded devices such as microcontrollers, DSP, or other devices. It
Math 241, Exam 1 Information.
Math 241, Exam 1 Information. 9/24/12, LC 310, 11:15-12:05. Exam 1 will be based on: Sections 12.1-12.5, 14.1-14.3. The corresponding assigned homework problems (see http://www.math.sc.edu/ boylan/sccourses/241fa12/241.html)
A QUICK GUIDE TO THE FORMULAS OF MULTIVARIABLE CALCULUS
A QUIK GUIDE TO THE FOMULAS OF MULTIVAIABLE ALULUS ontents 1. Analytic Geometry 2 1.1. Definition of a Vector 2 1.2. Scalar Product 2 1.3. Properties of the Scalar Product 2 1.4. Length and Unit Vectors
Time domain modeling
Time domain modeling Equationof motion of a WEC Frequency domain: Ok if all effects/forces are linear M+ A ω X && % ω = F% ω K + K X% ω B ω + B X% & ω ( ) H PTO PTO + others Time domain: Must be linear
Informatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
Advanced Microeconomics
Advanced Microeconomics Ordinal preference theory Harald Wiese University of Leipzig Harald Wiese (University of Leipzig) Advanced Microeconomics 1 / 68 Part A. Basic decision and preference theory 1 Decisions
Elementary Functions
Chapter Three Elementary Functions 31 Introduction Complex functions are, of course, quite easy to come by they are simply ordered pairs of real-valued functions of two variables We have, however, already
AIMMS Function Reference - Arithmetic Functions
AIMMS Function Reference - Arithmetic Functions This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com Aimms 3.13 Part I Function
Comparison of Power Título Transmission Line Models with Finite Elements
CEPEL Comparison of Power Título Transmission do trabalho Line Models with Finite Elements Carlos K. C. Arruda, Anny A. Silveira, Fernando C. Dart Autor/apresentador Área Departamento de Linhas e Estações
C++ Class Library Data Management for Scientific Visualization
I. Introduction C++ Class Library Data Management for Scientific Visualization Al Globus, Computer Sciences Corporation 1 [email protected] Abstract Scientific visualization strives to convert large
Part VI. Scientific Computing in Python
Part VI Scientific Computing in Python Compact Course @ GRS, June 03-07, 2013 80 More on Maths Module math Constants pi and e Functions that operate on int and float All return values float ceil (x) floor
Some probability and statistics
Appendix A Some probability and statistics A Probabilities, random variables and their distribution We summarize a few of the basic concepts of random variables, usually denoted by capital letters, X,Y,
CS 241 Data Organization Coding Standards
CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.
3. Experimental Results
Experimental study of the wind effect on the focusing of transient wave groups J.P. Giovanangeli 1), C. Kharif 1) and E. Pelinovsky 1,) 1) Institut de Recherche sur les Phénomènes Hors Equilibre, Laboratoire
1 3 4 = 8i + 20j 13k. x + w. y + w
) Find the point of intersection of the lines x = t +, y = 3t + 4, z = 4t + 5, and x = 6s + 3, y = 5s +, z = 4s + 9, and then find the plane containing these two lines. Solution. Solve the system of equations
Two Topics in Parametric Integration Applied to Stochastic Simulation in Industrial Engineering
Two Topics in Parametric Integration Applied to Stochastic Simulation in Industrial Engineering Department of Industrial Engineering and Management Sciences Northwestern University September 15th, 2014
Descriptive Statistics
Y520 Robert S Michael Goal: Learn to calculate indicators and construct graphs that summarize and describe a large quantity of values. Using the textbook readings and other resources listed on the web
DEFINITION 5.1.1 A complex number is a matrix of the form. x y. , y x
Chapter 5 COMPLEX NUMBERS 5.1 Constructing the complex numbers One way of introducing the field C of complex numbers is via the arithmetic of matrices. DEFINITION 5.1.1 A complex number is a matrix of
An Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c
Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection
