Category Archives: Mathematics

Little bit of logics and derivations

Derivation of Euler’s forumula for imaginary numbers [e(x)=coz(x)+i*sin(x)]

Derivation of Euler’s forumula for imaginary numbers
a+ib=r(cosθ+ i sinθ)
eulers derivation
From Tylor’s series:
F(x)=F(0)+x*f’(x)/1!+x^2*f’’(0)/2!+……+x^n*fn(0)/n!+….
Therefore,
Sin(x)=x-x^3/3!+x^5/5!-x^7/7!+….
Cos(x)=1-x^2/2!+x^4/4!-x^6/6!+….
e(x)=1+x+x^2/2!+x^3/3!+..

Now,
E(ix)=1+ix+(ix)^2/2!+(ix)^3/3!+(ix)^4/4!+(ix)^5/5!+…
E(ix)=(1-x^2/2!+x^4/4!-x^6/6!+…)+i(x-x^3/3!+x^5/5!-x^7/7!+…)
=cos(x)-i*sin(x)

the video for derivation is here

for derivation of Taylor’s series:

Derivation for sum of angles

sinCos

Cos(A+B)=OP/OS=(OQ-PQ)/OS
	=OQ/OS-PQ/OS
	=OQ/OR*OR/OS-PQ/SR*SR/OS
	=CosA*CosB-SinA*SinB …………(since PQ=TR)
Sin(A+B)=SP/OS=(ST+TP)/OS
	=ST/OS+TP/OS
	=ST/SR*SR/OS+TP/OR*OR/OS
	=CosA*SinB +SinA*CosB	………..(since TP=RQ)
Tan(A+B)=Sin(A+B)/Cos(A+B)
	=(SinA*CosB+CosA*SinB)/(CosA*CosB-SinA*SinB)
	=(TanA+TanB)/(1-TanA*TanB)………(dividing both side by CosA*CosB) 

For A-B note that sin is odd function and cos is even function, therefore, Sin(-A)=-SinA and Cos(-A)=Cos(A). Graphically this means the cos function is symmetric over x axis while sine function is not so.

Radius of earth (classical trignometry)

Question: Suppose that, while lying on a beach near the equator watching the sun set over a calm ocean, you start a stopwatch just as the top of the sun disappears. You then stand, elevating your eyes by a height H=1.7m, and stop the watch when the top of the sun again disappears. If the elapsed time is t=11.1 secs, what is the radius r of the earth?

Solution
One day=24hrs=86400sec

The earht rotate 2*pi() in one day=2*pi=6.2832 radians

angle traversed in 11.1sec=0.000807215 radians

observation height=1.7m

R=(h*cosX)/(1-cosX)=5.22E+06

earthRadius
Download calculation file

Solving Laplace equation in MS Excel for two dimensional solution

Laplace equation is second order derivative of the form shown below.

laplace.pngwhere phi is a potential function.

This equation is used to describe the behavior of electric, gravitational, and fluid potentials. In the study of heat conduction, the Laplace equation is the steady-state heat equation. This equation also describes seepage underneath the dam.

Direct solution of this equation is very tedious( and uninteresting). Numerical technique gives another approach to solve this equation. In numerical method, the solution space is converted in discrete number of points (a two dimensional array). Any point ‘p’ inside the solution matrix is the average of its surrounding points (4 points if 4 direction is considerer, 6 points if diagonal elements are included). The known points will be the potential(Phi value) at the boundary. Iteration has to done until desired accuracy is obtained. (similar to playing Minesweeper)

Excel sheet is nothing but a huge matrix.Thus providing ideal place to play with matrix. To solve Laplace equation, first of all each cell should be given a fixed width, i.e. say each cell will be 0.5m. After that, draw boundary, by putting the known phi value at the boundary. Any cells within the boundary will now given a formula which says =average(all surrounding cells). By doing so you will create cyclic function which will run automatically until desired level of accuracy is met. You must enable iterative calculation and set the desired accuracy in excel in its option menu.

I will demonstrate this with an example of seepage problem underneath the dam(green) as shown in figure. The dam has a pile in the upstream toe. There is seepage treatment 25m u/s and 30m d/s of dam. The base width of dam is 10m. The pile is 7m deep sheet pile (where seepage=0). The u/s water head is 5m and d/s water head is 1m. We are interested in distribution of water head inside the soil ( shown in yellow). As 2 dimensional Laplace equation will describe the flow field in this problem, we will solve it in excel sheet. Let us suppose at 25m below the dam foundation there is impermeable layer (another impermeable boundary).seepage under dam.png

Each cell is considered to be1.0m wide. Red cells denotes the boundary. The pile is also hydraulic boundary. The green is dam (done to show similarity with picture). Now a formula is written in any cell stating it as average of 4 surrounding cells (for e.g I10=AVERAGE(I9,H10,I11,J10)) and copy the cell in yellow zone. The boundary condition at u/s is phi=5m water head and at d/s is phi=1m of water head. After you copy formula to each of yellow cell, excel starts to calculate. For this iterative calculation has to be turned on (check Excel>options>formula). The higher the number of iteration, more accurate the result. Sometimes you may have to hit “Calculate sheet” button multiple times to get the result. A chart will show equipotential lines. A sample is shown in figure below. The excel sheet can be downloaded here.

potential.png

Derivation of combined angle- Version 2

The simple analysis of combined angle (or compound angle) was described in this article.There the derivation was based on two deflection angles only. And hence the solution was approximate. For more accurate analysis, same approach can be used. The additional parameter included is the slope of incoming line.

However, a different approach which uses only coordinates can be used to calculate the actual deflection angle of two lines in 3D space. This approach will not only give the deflection angle but also provide accurate length of those lines.

angle3D.JPG

Let us suppose three coordinates in space and let X be the angle between these two lines
A(x1,y1,z1)
B(x2,y2,z2)
C(x3,y3,z3)

The vector AB is given by

AB=(x2-x1)i+(y2-y1)j+(z2-z1)k
=(a1)i+(a2)j+(a3)k

Similarly BC is given by

BC=(x3-x2)i+(y3-y2)j+(z3-z2)k

=(b1)i+(b2)j+(b3)k

The dot product of vector is given by AB.BC =AB*BC*CosX

Here AB and BC=length of segment AB and BC respectively and is given by
L1=AB=sqrt(a1^2+a2^2+a3^2)

L2=BC=sqrt(b1^2+b2^2+b3^2)

Thus CosX=AB.BC/(L1*L2)

Total Lent of segment L=L1+L2

A worksheet using this approach can be downloaded here. (combinedAngle_vectorMethod) . The sheet also contains VBA codes to visualize the alignment.

3Danimation.gif