Wednesday, May 24, 2017

The Change Depends on the Direction of the Motion: Generating All Directions in 3D Space

In physics science and engineering especially fluid dynamics and electromagnetism fields, we usually need to investigate the changes of a function in different directions. In this case, the best way for analyzing and designing is to have different directions all together in our hand in which we will be able to compare all results to reach the new theorems and the new physical phenomena. The purpose of this article is to make a spreadsheet on excel file by using a new method where you will have all unit vectors in 3D space in different directions.

Unit Vectors in 2D and 3D

You as well as know, we can easily get all unit vectors in 2D surface by using bellow formula:

U = i cosθ + j sinθ

On the other hand, we can obtain the direction of a vector in 2D and 3D, by using below formula:

Direction of A = A / │A│

 But, how can we prove above formula?

A vector in 3D space can be modelled as the radius of a sphere in which we will have below function:

w = r (x, y, z) = (x^2 + y^2 + z^2) ^0.5

The gradient vector in any point is:

As you can see, the gradient vector proves above formula (formula:

Direction of A = A / │A│) where vector A = xi + yj + zk because we have:

Generating all directions in 3D space

 Consider a particle starts its circular motion on surface XY and simultaneously has a circular motion on surface XZ perpendicular to surface XY. In this case, this particle will produce a sphere where its circular angle on surface XY is “θ” and its circular angle on surface XZ is “β”.
According to above circular angles and radius of sphere (r), we can calculate coordination of point P (x, y, z) on sphere by using below equations:

x = r * cos β * cos θ
y = r * cos β * sin θ
z = r * sin β


Solve equation:    x^2 + y^2 + z^2 = 225
If θ = 25 degree and β = 56 degree


We have:  r = (225) ^0.5 = 15
x = 15 * cos 56 * cos 25 = 7.602013
y = 15 * cos 56 * sin 25 = 3.544877
z = 15 * sin 56 = 12.43556
(7.602013 ^2) + (3.544877 ^2) + (12.43556 ^2) = 225

In fact, we have below vector:

V = xi + yj + zk

V = (r * cos β * cos θ)i + (r * cos β * sin θ)j + (r * sin β)k

For r = 1, we have below unit vector in 3D space:

U = (cos β * cos θ)i + (cos β * sin θ)j + (sin β)k

It is clear; the range of changes for “θ” and “β” is between 0 and 360 degree.
Therefore, for making a spreadsheet included all directions, we should go below steps:

- Choose ∆θ and ∆β between 0 and 360 degree. For instance, I considered ∆θ = ∆β = 1

- By using the method stated in article of “Can We Solve a Nonlinear Equation with Many Variables?” posted on link:, we should find all combinations of “θ” and “β” for ∆θ and ∆β between 0 and 360 degree. For example, when I considered ∆θ = ∆β = 1, I will have 130321 combinations on my excel spreadsheet (361^2 = 130321).
If you choose ∆θ = ∆β = 0.5, you will have 519841 combinations (directions) on your excel spreadsheet (721^2 = 519841).
Anyway, I think that ∆θ = ∆β = 1 is enough.

- Using from above equations for r = 1 and each set of combinations.  In this case, you have 130321 rows that it show you all directions which you need to your analysis.

In the next articles, I will show you how we can utilize this spreadsheet as a template to investigate the changes of some physical functions.