{ "metadata": { "name": "S3-C3" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": "Trilateration" }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": "Example 3.1,Page 47" }, { "cell_type": "code", "collapsed": false, "input": "#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos\nAB=25145.32;\nR=6370.0e3;#radius of earth\nha=325.14;\n\n#calculation\ntheta=AB*cos(3+9.0/60+40.0/3600)/R;\nAB_dash=AB/sin(pi/2+theta/2)*sin(pi/2-theta/2-(3+9.0/60+40.0/3600)*pi/180);\nCD=AB_dash-AB_dash*ha/R;\nS=CD+CD**3/24.0/R**2;\n\n#result\nprint \"sea level length in m\",round(S,3)", "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": "sea level length in m 25108.53\n" } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": "Example 3.2,Page 50" }, { "cell_type": "code", "collapsed": false, "input": "#initialisation of variable\nfrom math import pi,tan,sqrt,sin,asin\nAB=31325.14\nR=6370.0e3;#radius of earth\nha=1582.15;\nh=2669.17\n\n#calculation\nAB_dash=AB-h**2/2/AB;\ntheta=2*asin(AB_dash/2/R);\nAB_dash=AB-(h*sin(theta/2)+h**2/AB/2)\nCD=AB_dash-AB_dash*ha/R;\nS=CD+CD**3/24.0/R**2;\n\n#result\nprint \"sea level length in m\",round(S,3)", "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": "sea level length in m 31197.163\n" } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": "Example 3.3,Page 53" }, { "cell_type": "code", "collapsed": false, "input": "#initialisation of variable\nfrom math import pi,tan,sqrt,sin, acos\nAB=1525.456;\nBC=2176.945;\nCD=1697.435;\nAD=2401.435;\nAC=3073.845;\nBD=2483.115;\n\n#calculation\n#alpha=A and beta=B and those are angles\nA1=acos((CD**2+AC**2-AD**2)/(2*CD*AC));\nA1=A1*180/pi;\nA2=acos((AD**2+BD**2-AB**2)/(2*AD*BD));\nA2=A2*180/pi;\nA3=acos((AB**2+AC**2-BC**2)/(2*AB*AC));\nA3=A3*180/pi;\nA4=acos((BC**2+BD**2-CD**2)/(2*BC*BD));\nA4=A4*180/pi;\nB1=acos((CD**2+BD**2-BC**2)/(2*CD*BD));\nB1=B1*180/pi;\nB2=acos((AD**2+AC**2-CD**2)/(2*AD*AC));\nB2=B2*180/pi;\nB3=acos((AB**2+BD**2-AD**2)/(2*AB*BD));\nB3=B3*180/pi;\nB4=acos((AC**2+BC**2-AB**2)/(2*AC*BC));\nB4=B4*180/pi;\ne1=360-A1-A2-A3-A4-B1-B2-B3-B4;#error\ne2=A1+B1-A3-B3;#error\ne3=A2+B2-A4-B4;#error\n#angle update\nA1=A1+e1/8-e2/4;\nA3=A3+e1/8+e2/4;\nB1=B1+e1/8-e2/4;\nB3=B3+e1/8+e2/4;\nA2=A2+e1/8-e3/4;\nB2=B2+e1/8-e3/4;\nA4=A4+e1/8+e3/4;\nB4=B4+e1/8+e3/4;\n#updating sides\nAD=1525.456*sin(B3*pi/180)/sin(A2*pi/180);\nBD=1525.456*sin(A3*pi/180+B3*pi/180)/sin(A2*pi/180);\nAC=1525.456*sin(A4*pi/180+B3*pi/180)/sin(B4*pi/180);\nBC=1525.456*sin(A3*pi/180)/sin(B4*pi/180);\nCD=BC*sin(A4*pi/180)/sin(B1*pi/180)\n\n#result\n\nprint \"equation for B2 is wrong\"\nprint \"corrected length of AD in m \",round(AD,3)\nprint \"corrected length of AC in m \",round(AC,3)\nprint \"corrected length of BD in m \",round(BD,3)\nprint \"corrected length of BC in m \",round(BC,3)\nprint \"corrected length of CD in m \",round(CD,3)\n", "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": "27.5965629411\nequation for B2 is wrong\ncorrected length of AD in m 2401.251\ncorrected length of AC in m 3073.446\ncorrected length of BD in m 2413.581\ncorrected length of BC in m 2176.758\ncorrected length of CD in m 1697.416\n" } ], "prompt_number": 25 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": "Example 3.4,Page 59" }, { "cell_type": "code", "collapsed": false, "input": "#initialisation of variable\nfrom math import pi,tan,sqrt,log,sin\n#angles found by cosine law\n#alpha=A and beta=B and those are angles\nA1=45.801596;\nA2=40.605250;\nA3=50.143258;\nA4=43.077646;\nB1=48.779868;\nB2=44.141587;\nB3=49.733152;\nB4=37.737035;\n\n#calculation\ne1=360-A1-A2-A3-A4-B1-B2-B3-B4;#error\n#angle update\nA1=A1+e1/8;\nA3=A3+e1/8;\nB1=B1+e1/8;\nB3=B3+e1/8;\nA2=A2+e1/8;\nB2=B2+e1/8;\nA4=A4+e1/8;\nB4=B4+e1/8;\nE2=log(sin(A1*pi/180),10)*log(sin(A2*pi/180),10)*log(sin(A3*pi/180),10)*log(sin(A4*pi/180),10)-log(sin(B1*pi/180),10)*log(sin(B2*pi/180),10)*log(sin(B3*pi/180),10)*log(sin(B4*pi/180),10);\nc3=E2/17.1;\nc4=E2/17.0;\nA1=A1-c3;\nB1=B1+c3;\n\n#result\nprint \"corrected angle A1 in degrees\",A1,\"corrected angle B1 in degrees\",B1", "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": "corrected angle A1 in degrees 45.7991704812 corrected angle B1 in degrees 48.7774455188\n" } ], "prompt_number": 2 } ], "metadata": {} } ] }