# Calculate a line integral in a close path for a list of data?

Posted 9 months ago
856 Views
|
2 Replies
|
1 Total Likes
|
 Please I need help doing line integral for the vector field v (z,x) components that are list of data vz and vx in specific small region (z, 0.26, 0.029), (x, 0.076, 0.079) The move direction counterclockwise.I need to do this integration in a close path. I tried to do that in a square path, so it has 4 sides. The side (a) from this point( 0.26,0.076) to ( 0.029,0.076) and the side (b) from this point ( 0.029,0.076) to ( 0.029,0.079),the side (c) ( 0.29,0.079) to ( 0.026,0.079), and (d) from( 0.026,0.079) to ( 0.026,0.076). z = {0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03, 0.025, 0.025500000000000002, 0.026000000000000002, 0.026500000000000003, 0.027000000000000003, 0.0275, 0.028000000000000004, 0.0285, 0.028999999999999998, 0.029500000000000002, 0.03}; x = {0.075, 0.075, 0.075, 0.075, 0.075, 0.075, 0.075, 0.075, 0.075, 0.075, 0.075, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.0755, 0.076, 0.076, 0.076, 0.076, 0.076, 0.076, 0.076, 0.076, 0.076, 0.076, 0.076, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.0765, 0.077, 0.077, 0.077, 0.077, 0.077, 0.077, 0.077, 0.077, 0.077, 0.077, 0.077, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.0775, 0.078, 0.078, 0.078, 0.078, 0.078, 0.078, 0.078, 0.078, 0.078, 0.078, 0.078, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.0785, 0.079, 0.079, 0.079, 0.079, 0.079, 0.079, 0.079, 0.079, 0.079, 0.079, 0.079, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.0795, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08}; for sides a and c the integration over vz with the below list:  vz={77.05900060522465, 135.48059457479437, 295.6383722929741, 983.4858599351398, 3279.366990725374, 797.9335820199495, 259.4877468688586, 123.68302415658533, 71.8688421747467, 46.95456824451762, 33.13259150649985, 62.65467604965143, 109.76680685716522, 239.3878557786202, 824.2295002851661, 4018.612046150325, 772.7570574840665, 230.48596788690622, 106.91295953900378, 61.37945454153419, 39.8501684093863, 28.021702914760695, 48.596990266478485, 84.68823351012537, 183.8497784032177, 644.1619587921939, 5072.005458248049, 719.0637233734553, 195.36503550079465, 88.20619864783382, 50.060172522400094, 32.31735615812771, 22.660813028622286, 34.93469876754902, 60.41482559085938, 129.98450142732437, 455.20496618148894, 6423.8053836544, 623.4153219264374, 153.39968911348055, 67.45894135046869, 37.88499856921787, 24.346895425379657, 17.045754641630154, 21.72643849651584, 37.12845553069087, 78.72439183562102, 270.58397276530343, 6909.58114278669, 467.091236333659, 103.7819790856019, 44.54185099746499, 24.814764027961303, 15.921998469237863, 11.16769836607034, 9.037929761758804, 15.013722430477031, 30.91113396729486, 101.9702210791873, 3262.3326888176975, 226.0964220984996, 45.619500322380986, 19.29247267306306, 10.79387236940127, 7.016832413064151, 5.012390332103408, -3.061187202861234, -5.751858887854979, \ -12.758851693072359, -42.62729458678348, -999.7038858596454, \ -124.83804934267619, -22.052734264127707, -8.492856917938184, \ -4.253272330425062, -2.405120063349443, -1.4406838441080367, \ -14.500735394328956, -25.007446687175275, -51.77322526412601, \ -159.53706516454488, -2252.873755455069, -599.1931683098027, \ -100.23411492030448, -39.067236137654874, -20.42620748003378, \ -12.392897148490789, -8.219239971855629, -25.213422624998103, \ -42.61739999598139, -85.82243267449002, -248.82307288892082, \ -2281.6746771158196, -1173.411726807893, -189.87416734495895, \ -72.74089310021529, -37.85278418600245, -23.01015564129183, \ -15.359279988190124, -35.138101646087236, -58.47802262259795, \ -114.79792602285382, -313.04787663472194, -2042.725772575267, \ -1762.9409712210654, -291.7137023328667, -109.88715481882755, \ -56.69401378458309, -34.33760652370107, -22.906368035853674, \ -44.2226715475026, -72.52201721791879, -138.77302249905966, \ -356.01623781182496, -1780.340821113502, -2238.4644221762014, \ -406.0153112876721, -150.9445993066379, -77.14938212269567, \ -46.47587498120036, -30.917155216906792}; and for side b and d the integration over vx:  vx = {-55.67007990547937, -75.14597114885453, -113.57719742504118, \ -208.36341120868562, -126.64314947803405, 107.4544792189494, 79.69580331345534, 59.11407106921598, 46.453865515004296, 38.11339159427955, 32.24990222186154, -54.96258268613943, -74.0036655994076, \ -111.87479935046294, -212.57084955700506, -189.4336160159972, 126.50777170380746, 86.07242066587635, 62.1068605625609, 48.18758390926222, 39.252407294901225, 33.061847489248436, -54.20994350884543, -72.72924561369581, \ -109.61494189786147, -212.35296496166256, -309.4429590888888, 149.43681411788697, 92.79755790085518, 65.16520449320554, 49.94021063654884, 40.39882272480382, 33.87756734943816, -53.38320981813595, -71.27996108245262, \ -106.74182560124207, -207.2822338269145, -550.6567423445471, 177.27032354781733, 99.95506805688883, 68.3337146954808, 51.740318750610456, 41.57223751827236, 34.71121531151899, -52.45686335328409, -69.62131892736366, \ -103.23287770655737, -197.59682310263753, -966.2245119620898, 211.08896975633735, 107.64743849230592, 71.66665456205098, 53.62123222631994, 42.794854285274546, 35.578510996648745, -51.40938475924947, -67.72833356797355, \ -99.10034248662822, -184.12688963365042, -1145.4552426634589, 251.63994734081342, 115.99552098121745, 75.22880313037936, 55.62143134820425, 44.09168987103588, 36.49686357794036, -50.22377290086338, -65.58637717248659, \ -94.38937226407029, -168.05103871973063, -750.3780570837548, 298.4402447186256, 125.13580243113759, 79.0964322900108, 57.78510851896807, 45.49088561303157, 37.4855585164117, -48.887965265983404, -63.1915182613739, \ -89.17299142643907, -150.60613124878205, -405.09590087812785, 348.2009259152962, 135.2134752219103, 83.35838196866278, 60.16291188478557, 47.024140161267134, 38.5660211492725, -47.39511158689412, -60.550290590742534, \ -83.5448332815952, -132.8650709110221, -225.57015008140263, 393.1893276961692, 146.36866783354998, 88.11715423942269, 62.81291255349221, 48.72729114089431, 39.76217281411414, -45.74366415053528, -57.678898459937855, \ -77.61083470156927, -115.62903449707156, -132.18461472301797, 421.9132226897307, 158.7121324392396, 93.48983224950746, 65.80182524037085, 50.641075187404454, 41.100898102966575, -43.93726410404289, -54.6019280586431, \ -71.48106889937198, -99.41759267055859, -79.33261726845735, 424.7090681538802, 172.28586637279076, 99.6084328049799, 69.20649799594959, 52.81209937187389, 42.61264565885176}; I tried to do this integration: In[722]:= fz = Interpolation[vz] a = NIntegrate[fz[z], {z, 0.026, 0.029}] Out[722]= InterpolatingFunction[{{1., 121.}}, <>] Out[723]= -0.860932 In[724]:= c = NIntegrate[fz[z], {z, 0.029, 0.026}] Out[724]= 0.860932 In[725]:= fx = Interpolation[vx] b = NIntegrate[fx[x], {x, 0.076, 0.079}] Out[725]= InterpolatingFunction[{{1., 121.}}, <>] Out[726]= -0.0666142 In[727]:= d = NIntegrate[fx[x], {x, 0.079, 0.076}] Out[727]= 0.0666142 In[728]:= a + b + c + d Out[728]= 0. `I see that the interpolation out of the small grid region, and the result of a + b + c + d should be 6.28319 which equals 2 pi, but the result is 0. Do you have any suggestions to get the result (2 pi).Thanks in advance
2 Replies
Sort By:
Posted 9 months ago
 What is your vector-field? It should be a two-component-function vz[ z, x ] := { c1[ z, x ], c2 [ z, x ] } If this is constant you of course get 0 as result of your line-integral. Note in your calculation above a = -c and b = - d.vz must be different on the different parts of the integration-path