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) B a a=AB A
Vectors are a class of quantities that require both magnitude and direction for their specification. a Terminal point Terminal point A a=AB B Initial point Initial 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 a b Equality: a b a+b Addition: a b a+b -b a-b
Subtraction: Scalar multiplication: a 1.5a -a -0.5a

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

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

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

10 Components and Decomposition (in 3D Space)
axi azk ayj

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

12 Example

13 The Center of Mass (Gravity)

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

15 Electric dipole moments

16 Symmetry and Dipole Moment
The total dipole moment of a tetrahedron: r4 r1=(a,a,a), r2=(a,-a,-a), r3=(-a,a,-a), r4=(-a,-a,a) r1 r2 r3

17 Base Vectors Orthogonal basis: axi azk ayj Nonorthogonal basis:

18 Classroom Exercise

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

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

21 Position, Velocity, Momentum, Acceleration Newton’s Second Law
Speed: Linear momentum: Kinetic energy: Acceleration: 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 θ a b O B A b b θ a θ O a O If Classroom exercise

26 Orthogonal and Coincident

27 Cartesian Base Vectors
Orthogonality: axi azk ayj Normalization (unit length):

28 Force and Work

29 Force and Work: General Case
B O r(t) 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 new vector can be constructed from two given vectors: a b θ bsinθ Its magnitude: Its direction: v a b A B C=AxB Right-hand rule:

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

35 In Cartesian Basis axi azk ayj

36 Example

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

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

39 An Electric Dipole in an Electric Field
-q q r1 r2 O μ E T

40 A Magnetic Dipole in a Magnetic Field
r B -qm qm r1 r2 O m B T

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

42 Exercise Classroom exercise

43 Exercise

44

45

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

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

48 Scalar and Vector Fields

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

50 The Meaning of the Gradient
f(r+dr) f(r) dr 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
q1 q2 r q1 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 Supplementary (Not Required)
You may win 5 points for filling in the details here!

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

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

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

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

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

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) 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) 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) 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) 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) CONTINUE do 20 i=1,n1 CROSSP(i)=tmp2*a2(i)-tmp1*a3(i) 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) 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) write(6,*) 'please input the position (x,y,z):' read(5,*)x1,y1,z1 dx=0.0001 dy=0.0001 dz=0.0001 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
program crossp1 parameter(n1=3) real a1(n1),a2(n1),crossp(n1) 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) 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 Subroutine for calculating cross C product of any two vectors C
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) 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
program dotpro1 parameter(n1=3) real a1(n1),a2(n1) 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) 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) 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 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) CONTINUE return

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