4
$\begingroup$

I have 2 tables;

table 1:

ctr = {(Exp[Pi*0.5] + 1)/2, 0};
radius = (Exp[Pi*0.5] - 1)/2;
pp = PolarPlot[
  Evaluate@Table[Exp[(t + 2*Pi*i/120)*0.5], {i, 1, 120}], {t, -Pi, 
   Pi}, RegionFunction -> (Norm[{#, #2} - ctr] <= radius &)]
Total[ArcLength /@ Cases[pp, _Line, All]]

spiral

and table 2:

ctr = {(Exp[Pi*0.5] - 1)/2, 0};
radius = (Exp[Pi*0.5] - 1)/2;
pp2 = ParametricPlot[
  Evaluate[Table[{t, t (Tan[2 j Pi / 120])}, {j, 1, 60}]], {t, -5, 5},
   RegionFunction -> (Norm[{#, #2} - ctr] <= radius &), 
  PlotRange -> All]
Total[ArcLength /@ Cases[pp2, _Line, All]]

Line

I want to calculate each area between the curves and show them in histogram so I can evaluate maximum and minimum gaps between the tables. I illustrated what I want as below:

gradient

can you show me how?

$\endgroup$

1 Answer 1

6
$\begingroup$

You could define a ParametricRegion , examplary between curves #10 and #11

reg10 = ParametricRegion[{{Cos[t], Sin[t]} Exp[(t + 2*Pi*ii/120)/2], (Sqrt[#.#] < radius) &[{Cos[t],Sin[t]} Exp[(t + 2*Pi*ii/120)/2] - ctr]}
, {{t, -Pi, Pi}, {ii, 10, 11}}]
DiscretizeRegion[reg10]

enter image description here

Area[DiscretizeRegion[reg10]]
(*0.0592725*)

addendum

Knowing the plot pp a very fast straightforward solution is possible: First get the Line-objects from the plot

linien = Cases[pp, _Line , Infinity];

Two neighboring lines form a polygon from which the area can be calculated

areas=Table[ Area@Polygon[Join[linien[[i]][[1]], Reverse[linien[[i + 1]][[1]]]]], {i,1, Length[linien] - 1}] 
(*{0.0243947, 0.0281509, 0.0318023, 0.0353948, 0.039143, 0.0430014, \
0.0469289, 0.050997, 0.0551564, 0.0594015, 0.0639209, 0.0684968, \
0.0731468, 0.0780328, 0.0830698, 0.0882845, 0.0936695, 0.0992263, \
0.104955, 0.111007, 0.117283, 0.123424, 0.129694, 0.136315, 0.143126, \
0.150108, 0.157259, 0.164582, 0.172953, 0.1806, 0.187462, 0.195366, \
0.203387, 0.21151, 0.22005, 0.228322, 0.23627, 0.24457, 0.252866, \
0.261078, 0.269163, 0.27711, 0.284845, 0.292302, 0.299405, 0.306072, \
0.312203, 0.317686, 0.322383, 0.326143, 0.329235, 0.330515, 0.329747, \
0.327478, 0.322887, 0.315273, 0.304139, 0.288177, 0.265912, 0.234501, \
0.187173}*)

That's it! Hope it helps.

$\endgroup$
4
  • $\begingroup$ Thank you very much! However, how could I store each of the ares into a table so I can show the histogram could you help me with that as well? $\endgroup$
    – Alper91
    Commented Feb 23, 2019 at 15:30
  • $\begingroup$ Put it in a Table[...,{i,1,119}] $\endgroup$ Commented Feb 23, 2019 at 17:57
  • $\begingroup$ @ Alper91 Look at the edit of my answer, I added a solution which only needs to know pp $\endgroup$ Commented Feb 23, 2019 at 19:44
  • $\begingroup$ Thanks. It worked easily. $\endgroup$
    – Alper91
    Commented Feb 24, 2019 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.