Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Mathematics for Chemists (I) (Fall Term, 2004) (Fall Term, 2005) (Fall Term, 2006) Department of Chemistry National Sun Yat-sen University 化學數學(一)

Similar presentations


Presentation on theme: "The Mathematics for Chemists (I) (Fall Term, 2004) (Fall Term, 2005) (Fall Term, 2006) Department of Chemistry National Sun Yat-sen University 化學數學(一)"— Presentation transcript:

1 The Mathematics for Chemists (I) (Fall Term, 2004) (Fall Term, 2005) (Fall Term, 2006) Department of Chemistry National Sun Yat-sen University 化學數學(一)

2 Chapter 3 Vector Algebra and Analysis Definition Scalar (dot) product Vector (cross) product Scalar and vector fields Applications

3 Content covered in the textbook: Chapter 16 Assignment: pp : 15,17,18,24,25,30,32,35,40,41, 43,47,48,55,58,60

4 Definition (naïve) a B A a=AB Vectors are a class of quantities that require both magnitude and direction for their specification. Initial point Terminal point Unit vector: a vector of unit length. Null vector: a vector of zero length. (its direction is meaningless.)

5 Examples of Vectors Position, velocity, angular velocity, acceleration Force, torque, momentum, angular momentum Electric and magnetic fields, electric and magnetic dipole moments,

6 Vector Algebra Equality: Addition: Subtraction: Scalar multiplication: a b a+b a b -ba-b a 1.5a -a -0.5a a b

7 Example O a b A BD C C’ Show that the diagonals of a parallelogram bisect each other. We need to show that the midpoints of OD and AB coincide.

8 Classroom Exercise O A B C a bX Show that the mean of the position vectors of the vertices of a triangle is the position vector of the centroid of the triangle. B O A C a b X C’ C’’

9 Components and Decomposition x y i j a axiaxi ayjayj x=(2,3),y=(4.2,-5.6) θ a O N P

10 Components and Decomposition (in 3D Space) axiaxi azkazk ayjayj

11 Vector Algebra Restated Equality: Addition: Subtraction: Scalar multiplication:

12 Example

13 The Center of Mass (Gravity) m1m1 m4m4 m2m2 m3m3 r1r1 r2r2 r3r3 r4r4

14 Dipole Moments r1r1 r2r2 r -q q Dependence of reference frame: Total dipole moment: If the total charge Q is zero (e.g., in a molecule), then

15 Electric dipole moments

16 Symmetry and Dipole Moment The total dipole moment of a tetrahedron: r 1 =(a,a,a), r 2 =(a,-a,-a), r 3 =(-a,a,-a), r 4 =(-a,-a,a) r3r3 r2r2 r1r1 r4r4

17 Base Vectors axiaxi azkazk ayjayj Orthogonal basis: Nonorthogonal basis:

18 Classroom Exercise

19 Scalar Differentiation of a Vector A B O a(t) a(t+Δt) ΔaΔa

20 Parametric Representation of a Curve O x y z r(t) C a b t

21 Position, Velocity, Momentum, Acceleration Newton’s Second Law Linear momentum: Speed: Kinetic energy: Acceleration: Velocity: Newton’s second law:

22 Classroom Exercise Write the expression of momentum in terms of the planar polar coordinates

23 The Scalar (Dot) Product Proof: θ a b O B A

24 Example

25 If θ a b O B A θ a O θ a b O b Classroom exercise

26 Orthogonal and Coincident

27 Cartesian Base Vectors axiaxi azkazk ayjayj Orthogonality: Normalization (unit length):

28 Force and Work

29 Force and Work: General Case A B O r(t) r+Δrr+Δr ΔrΔr F(r) F(r+Δr)

30 Charges in an Electric Field θ μ E

31 Magnetic Moment in a Magnetic Field θ m B

32 HOW DO YOU KNOW THEY ARE PARALLEL WITH EACH OTHER?

33 The Vector (Cross) Product a b θ bsinθ A new vector can be constructed from two given vectors: Its magnitude: Its direction: v a b Right-hand rule: A B C=AxB

34 Important properties Classroom exercise: v a b -v Anti-commutative: If the cross product of two vectors is a zero vector, they must be parallel or antiparallel to each other. Nonassociative: (Proof to be given later)

35 In Cartesian Basis axiaxi azkazk ayjayj

36 Example

37 Classroom Exercise Calculate the cross product of above two vectors using

38 Application: Moment of Force (Torque) r F O θ d A

39 An Electric Dipole in an Electric Field r E -q q r1r1 r2r2 O μ E T

40 A Magnetic Dipole in a Magnetic Field r B -q m qmqm r1r1 r2r2 O m B T

41 Angular Velocity In a plane: General case: v ω r O θ rsinθ O r v ω

42 Exercise Classroom exercise

43 Exercise

44

45

46 Angular Momentum r p O θ d A (moment of inertia) A special case: ω is perpendicular r: r ω

47 Conservation of Angular Momentum m B T For nuclear spins: NMR measures how fast a nuclear spin precesses. If T=0, angular momentum is conserved.

48 Scalar and Vector Fields

49 The Gradient of a Scalar Field The gradient of a scalar field is a vector. Vector differential operator

50 The Meaning of the Gradient f(r+dr) f(r) drdr Gradient is a convenient vector expression of the derivative of multi-variable functions.

51 Example: Gradient

52 Example: Gradient as Force Force is the negative of the gradient of the potential energy.

53 Example: Gradient as Force q1q1 q2q2 r q1q1 r E

54 The Divergence of a Vector Field Laplacian operator Laplace’s Equation

55 Examples: Divergence The divergence is a measure of flux density: the amount of ‘something’ flowing out of a unit volume per second.

56 The Curl of a Vector Field

57

58 Classroom Exercise

59 Physical Meaning of curl (rot) The curl of a velocity field is angular velocity field (x2).

60 Example: Curl The curl of the velocity filed is a measure of the circulation of fluid around the point.

61 You may win 5 points for filling in the details here! Supplementary (Not Required)

62 Major Theorems in Integration L S V S ba Green: Gauss: Fundamental: Stokes:

63 Major Theorems in Integration L S V S ba M ∂M The general form: (Stokes’s theorem)

64 Classroom Exercise? Find out the result of the following integration by using Gauss’s theorem: x y z

65 The Maxwell Equations Related to the light speed c ElectrostaticsElectrodynamics In a medium:

66 Vector Spaces … Norm (length): Inner (scalar) product: Inner product space

67 You as a vector in a high dimensional space Name Gender Birth date Birth place ID Student ID Height Weight Favorite drink Favorite music …. …

68 Operations of Vectors in Fortran Array Loop: Dot/cross product Gradient Divergence Curl General vector spaces Subroutine

69 Dot Product of Vectors Write a program to calculate the dot product of any two vectors. C Program for calculating dot product of any two vectors c program dotpro1 parameter(n1=3) real a1(n1),a2(n1) 1 write(6,*)'Input three components of first vector:' read(5,*)(a1(i),i=1,n1) write(6,*)'Input three components of second vector:' read(5,*)(a2(i),i=1,n1) dot=0. DO 10,I = 1,n1 dot=dot+a1(i)*a2(i) 10 CONTINUE print *,'The dot product is ', dot print *,'Next calculation (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end

70 Cross Product of Vectors Write a program to calculate the cross product of any two vectors. C Program for calculating cross product of any two vectors c program crossp1 parameter(n1=3) real a1(n1),a2(n1),crossp(n1) 1 write(6,*)'Input three components of first vector:' read(5,*)(a1(i),i=1,n1) write(6,*)'Input three components of second vector:' read(5,*)(a2(i),i=1,n1) CROSSP(1)=a1(2)*a2(3)-a1(3)*a2(2) CROSSP(2)=a1(3)*a2(1)-a1(1)*a2(3) CROSSP(3)=a1(1)*a2(2)-a1(2)*a2(1) print *,'The cross product is \n', (crossp(i),i=1,3) print *,'Next calculation (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end

71 Cross Product of Vectors Write a program to calculate the following vector operations. C Program for calculating cross product of any three vectors program crossp2 parameter(n1=3) real a1(n1),a2(n1),a3(n1),crossp(n1) real tmp(n1) 1 write(6,*)'Input three components of first vector:' read(5,*)(a1(i),i=1,n1) write(6,*)'Input three components of second vector:' read(5,*)(a2(i),i=1,n1) write(6,*)'Input three components of third vector:' read(5,*)(a3(i),i=1,n1) tmp1=0.0 tmp2=0.0 DO 10,I = 1,n1 tmp1=tmp1+a1(i)*a2(i) tmp2=tmp2+a1(i)*a3(i) 10 CONTINUE do 20 i=1,n1 CROSSP(i)=tmp2*a2(i)-tmp1*a3(i) 20 continue print *,'The cross product is \n', (crossp(i),i=1,3) print *,'Next calculation (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end

72 Gradient of a Scalar Field Write a program to calculate the gradient of a scalar function.

73 C Program for calculating the gradient of any scalar function program grdt1 parameter(n1=3) real grt(n1) 1 write(6,*) 'please input the position (x,y,z):' read(5,*)x,y,z dx=0.001 dy=0.001 dz=0.001 x2=x+dx y2=y+dy z2=z+dz f1=x*sin(x+y)+2.0*y*z*exp(x)+3.0*z*z f2=x2*sin(x2+y)+2.0*y*z*exp(x2)+3.0*z*z fx=(f2-f1)/dx f2=x*sin(x+y2)+2.0*y2*z*exp(x)+3.0*z*z fy=(f2-f1)/dy f2=x*sin(x+y)+2.0*y*z2*exp(x)+3.0*z2*z2 fz=(f2-f1)/dz grt(1)=fx grt(2)=fy grt(3)=fz print *,'The gradient at (', x,y,z, ') is \n', (grt(i),i=1,3) print *,'Calculating the gradient of next point (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end

74 The Divergence of a Vector Field Write a program to calculate the divergence of a vector field.

75 C Program for calculating the divergence of any vector field program divg1 parameter(n1=3) real vecf(n1) 1 write(6,*) 'please input the position (x,y,z):' read(5,*)x1,y1,z1 dx= dy= dz= x2=x1+dx y2=y1+dy z2=z1+dz vx1=x1*x1 vx2=x2*x2 divgx=(vx2-vx1)/dx vy1=x1*cos(x1+x1*y1+x1*y1*z1) vy2=x1*cos(x1+x1*y2+x1*y2*z2) divgy=(vy2-vy1)/dy vz1=2.*y1+6.*z1+exp(-y1*z1) vz2=2.*y1+6.*z2+exp(-y1*z2) divgz=(vz2-vz1)/dy divg=divx+divy+divz print *,'The divergence at (', x,y,z, ') is \n', divg print *,'Calculating the gradient of next point (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end

76 The Curl of a Vector Field Write a program to calculate the rot of a vector field.

77 Using Subroutines (Go to Chapter 2)

78 Cross Product of Vectors Write a program to calculate the following vector operations by calling subroutine for calculating cross product of two vectors.

79 C Program for calculating cross product of any two vectors c program crossp1 parameter(n1=3) real a1(n1),a2(n1),crossp(n1) 1 write(6,*)'Input three components of first vector:' read(5,*)(a1(i),i=1,n1) write(6,*)'Input three components of second vector:' read(5,*)(a2(i),i=1,n1) CROSSP(1)=a1(2)*a2(3)-a1(3)*a2(2) CROSSP(2)=a1(3)*a2(1)-a1(1)*a2(3) CROSSP(3)=a1(1)*a2(2)-a1(2)*a2(1) print *,'The cross product is \n', (crossp(i),i=1,3) print *,'Next calculation (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end C Subroutine for calculating cross C product of any two vectors C subroutine(a,b,c,n) real a(n),b(n),c(n) c(1)=a1(2)*a2(3)-a1(3)*a2(2) c(2)=a1(3)*a2(1)-a1(1)*a2(3) c(3)=a1(1)*a2(2)-a1(2)*a2(1) return end

80 C Program for calculating the cross C product of any number of vectors program crossp parameter(n=3,n1=3) real a1(n),a2(n),a3(n),TMP1(1),TMP2(N) open(20,file=‘crossp.1’,err=9999) read(20,*)(a1(i),i=1,n) read(20,*)(a2(i),i=1,n) read(20,*)(a3(i),i=1,n) close(20) call vcross(a2,a3,tmp1,n) call vcross(a1,tmp1,tmp2,n) open(30,file=‘crossp.2’,err=9999) write(30,*)(tmp2(i),i=1,n) CLOSE(30) 9999 STOP END C Subroutine for calculating cross C product of any two vectors C subroutine(a,b,c,n) real a(n),b(n),c(n) c(1)=a1(2)*a2(3)-a1(3)*a2(2) c(2)=a1(3)*a2(1)-a1(1)*a2(3) c(3)=a1(1)*a2(2)-a1(2)*a2(1) return end

81 Cross Product of Vectors Write a program to calculate the following vector operations by calling subroutine for calculating cross product of two vectors.

82 C Program for calculating the cross C product of any number of vectors program crossp6 parameter(n=3) real a1(n),a2(n),a3(n),a4(n),a5(n),a6(n),a7(n) real TMP1(1),TMP2(N),TMP3(N),TMP4(N) real TMP5(n),TMP6(n) open(20,file=‘crossp6.1’,err=9999) read(20,*)(a1(i),i=1,n) read(20,*)(a2(i),i=1,n) read(20,*)(a3(i),i=1,n) read(20,*)(a4(i),i=1,n) read(20,*)(a5(i),i=1,n) read(20,*)(a6(i),i=1,n) read(20,*)(a7(i),i=1,n) close(20) call vcross(a6,a7,tmp1,n) call vcross(a5,a6,tmp2,n) call vcross(a3,a4,tmp3,n) call vcross(tmp1,tmp2,tmp4,n) call vcross(tmp3,tmp4,tmp5,n) call vcross(a1,tmp5,tmp6,n) open(30,file=‘crossp6.2’,err=9999) write(30,*)(tmp6(i),i=1,n) CLOSE(30) 9999 STOP END C Subroutine for calculating cross C product of any two vectors C subroutine(a,b,c,n) real a(n),b(n),c(n) c(1)=a1(2)*a2(3)-a1(3)*a2(2) c(2)=a1(3)*a2(1)-a1(1)*a2(3) c(3)=a1(1)*a2(2)-a1(2)*a2(1) return end

83 General Vector Spaces Write a subroutine to calculate the inner product of two vectors in any dimension.

84 C Program for calculating dot product of any two vectors c program dotpro1 parameter(n1=3) real a1(n1),a2(n1) 1 write(6,*)'Input three components of first vector:' read(5,*)(a1(i),i=1,n1) write(6,*)'Input three components of second vector:' read(5,*)(a2(i),i=1,n1) dot=0. DO 10,I = 1,n1 dot=dot+a1(i)*a2(i) 10 CONTINUE print *,'The dot product is ', dot print *,'Next calculation (0/1)?' read(5,*)i if(i.eq.1) goto 1 stop end C subroutine for calculating dot product of any two vectors subroutine vdot(a,b,n) real a(n),b(n) dot=0. DO 10,I = 1,n1 dot=dot+a(i)*b(i) 10 CONTINUE return end

85 C program for calculating the inner product of two vectors program innerp1 parameter(n=10) do 10 i=1,n a1(i)=i*1.2 a2(i)=-2.*+i*i 10 continue call vdot(a1,a2,dot,n) print *,'The inner product of two vectors is \n', dot stop end C subroutine for calculating inner product of any two vectors subroutine vdot(a,b,dot,n) real a(n),b(n) dot=0. DO 10,I = 1,n1 dot=dot+a(i)*b(i) 10 CONTINUE return end

86

87

88


Download ppt "The Mathematics for Chemists (I) (Fall Term, 2004) (Fall Term, 2005) (Fall Term, 2006) Department of Chemistry National Sun Yat-sen University 化學數學(一)"

Similar presentations


Ads by Google