Mathematical Calculations with 3-Dimensional Vectors
|
09-25-2016, 06:56 AM
Post: #1
|
|||
|
|||
Mathematical Calculations with 3-Dimensional Vectors
Note: all examples are calculated in Degrees mode.
Rectangular to Spherical Coordinates The program RECT2SPH converts the coordinates [x, y, z] to [r, θ, ϕ]. Syntax: RECT2SPH([x, y, z]) HP Prime RECT2SPH: Rectangular to Spherical Coordinates Code: EXPORT RECT2SPH(v) Example: RECT2SPH([2, 3, 4]) return [5.38516480713, 56.309932474, 42.0311137741] Spherical to Rectangular Coordinates The program SPH2RECT converts the coordinates [r, θ, φ] to [x, y, y]. Syntax: SPH2RECT([r, θ, φ]) HP Prime SPH2RECT: Spherical Coordinates to Rectangular Coordinates Code: EXPORT SPH2RECT(v) Example: SPH2RECT([6, 30, 48]) returns [3.86149378532, 2.22943447643, 4.01478363815] Linear Distance The program LIN3DIST is the linear distance between two three-dimensional points. The coordinates are Cartesian. Enter each coordinate point separately. Syntax: LIN3DIST(x1, x2, y1, y2, z1, z2) HP Prime LIN3DIST: Linear distance between coordinates Code: EXPORT LIN3DIST(x1,x2,y1,y2,z1,z2) Example: Find the linear distance between points (2,3,-7) and (-1,8,2). Input: LIN3DIST(2, -1, 3, 8, -7, 2) returns 10.7238052948. Spherical Distance (Arc Length) The program SPH3DIST is the spherical distance between two three-dimensional points that share the same radius. This is similar to the great circle distance. Syntax: SPH3DIST(r, φ1, φ2 ,λ1 ,λ2) HP Prime SPH3DIST: Spherical distance between coordinates Code: EXPORT SPH3DIST(r,φ1,φ2,λ1,λ2) Example: Find the spherical distance between points φ1 = 40°, φ2 = 64°, λ1 = -18°, λ2 = 33°. The radius is 14. SPH3DIST(14, 40, 64, -18, 33) returns 519.226883434 Angle between Two Three-Dimensional Coordinates The program VANGLE calculates the angle between two points. Both points are entered in vector form. Syntax: VANGLE([x1,y1,z1], [x2,y2,z2]) HP Prime VANGLE: Angle between two coordinates Code: EXPORT VANGLE(v1,v2) Example: Find the angle between [5,4,5] and [2,0,-3]. VANGLE([5,4,5],[2,0,-3]) returns 99.8283573577° Rotating a Cartesian Coordinate Vector The program ROT3X, ROT3Y, and ROT3Z rotates the three-dimensional vector [x, y, z] with respect to the x-axis (ax), respect to the y-axis (ay), and respect to the z-axis (az), respectively. Syntax: ROT3X(v, ax), ROT3Y(v, ay), ROT3Z(v, az) Caution: the result will be a matrix instead of a vector HP Prime: ROT3X Code: EXPORT ROT3X(v,ax) HP Prime: ROT3Y Code: EXPORT ROT3Y(v,ay) HP Prime: ROT3Z Code: EXPORT ROT3Z(v,az) Example: Rotate the vector [2, 3, 4] 30°, with respect to the x-axis, y-axis, and z-axis, separately and respectfully. ROT3X([2, 3, 4], 30) returns [[ 2, 0.598076211352, 4.96410161514 ]] ROT3Y([2, 3, 4], 30) returns [[ 3.73205080757, 3, 2.46410161514 ]] ROT3Z([2, 3, 4], 30) returns [[ 0.232050807568, 3.59807621135, 4]] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)