Showing posts with label Mathematics. Show all posts
Showing posts with label Mathematics. Show all posts

Thursday, January 5, 2012

Derivation of combined angle- Version 2

The simple analysis of combined 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 . The sheet also contains VBA codes to visualize the alignment.

Friday, May 27, 2011

Monte Carlos Simulation to find value of PI


Inception:






I was going through a book named "Fooled by Randomness" by Nassim Nicholas Taleb. On one of the chapter, the writer claimed that according to Monte Carlo theory, if some bullets are fired inside the square, and a circle is drawn inside this square, the ratio of bullets inside the circle to the total number of bullets is equal to some ratio of PI. Now the question arouse in my mind what is the value of this ratio. Hence i prepared an excel sheet to know this value.














Methodology:






I tried with about 17150 bullets (the points), the point are generated randomly within the boundary of the square. A circle was drawn inside this square. Then to check if the points lie inside the circle distance formula was used. Finally the total number of bullets inside the circle and total number of bullets were counted and the ratio was calculated.







Simulation:




Try changing the size of square and radius of circle and check how the ratio changes. I found that when the circle is inscribed inside the ratio comes out to be about PI/4.







Download:






monte carlo pi sumulation.xlsx

Derivation of Combined Angle


Abstract: Derivation of combined angle may become useful when you want to know the magnitude and direction of force due to bend in both XY and XZ plane. For eg in design of bend in pipeline.


Let us consider a straight line which deflects at O along OA as shown in the figure. The deflection angles are also shown in the figure.


Let R be the position vector of A. OB is projection of OA on XY plane and AB is projection of OA on a plane parallel to YZ plane. Similarly, OC is projection of line OB in X axis and BC is projection of OB on axis parallel to Y axis.


From figure it can inferred that


OB=R cosα


AB=R sinα


OC=OB cosβ = R cosα cosβ


BC= OB sinβ =R cosα sinβ


Therefore, the position vector of A is OA which is given by


R=|R| (cosα cosβ i + cosα sinβ j + sinα k )


And the unit vector along R is given by


r= (cosα cosβ i + cosα sinβ j + sinα k )


Now the combined deflection angle is given by


r . i =|r| |i| cosδ


Or, r . i =1*1 cosδ


Or, cosδ = cosα cosβ+0+0


Or, δ =cos-1(cosα cosβ)


The angle δ lies in the plane OAC. This plane is shown in the figure in hatch line.


Forces


If F be the magnitude of force due to the deflection δ (e.g. deflection in pipeline) then the vertical and horizontal component of this force is given by,


Fx1 =F r . i =F cosα cosβ


Fx2 =F r . j =F cosα sinβ


Fx =F


=F cosα


Fy =F r . j


=F sinα

Sunday, September 12, 2010

Centroid of trapezoidal

The centroid of the trapezoidal with its one face perpendicular is given be


X=-1/3 (-2b^2-2ab+a^2)/(a+b)


Y=1/3 h (b+2a)/(a+b)


Where a, b, h and origin is as shown in the figure below.













Similarly, the centroid of any trapezoidal is given by


x= 1/3(3ab+3bc+b^2+6ac+3a^2+2c^2)/(b+2a+c)


y=1/3 h (b+3a+c)/(b+2a+c)


Where a, b ,c, h and origin is as shown in the figure below.

















The result was obtained using MathLab 7.0