3
$\begingroup$

I'm facing some trouble with finding the area of a region which is described by x-y coordinates (or line equations) and a curved line represented by logspiral. I tried my best in coming up with the following illustration below to show what I mean:

enter image description here

  • B = Angle between Horizontal (at x2,y2) and the line described by r
  • r = Equation of the curve region, described by: r = a*exp(B)
  • a = Value of r when B = 0
  • (x,y) = Coordinates of the vertices

I understand that I could find the intersection of the 2 half-spaces using 2 equations describing the 2 straight line portions (say using RegionIntersection), but I'm not too sure how I could incorporate the logspiral equation to get the bounding area using RegionMeasure.

I'm inclined to convert the logspiral equation to parametric form for this purpose, but I have no idea how to move on from there.

I would really appreciate any help or advice regarding this problem, I have been losing some sleep thinking about this question.

$\endgroup$
1
  • $\begingroup$ You can construct a ParametricRegion of two parameters, one the angle B, and other a multiplier of r from 0 (which is (x2, y2) to 1, which is the spiral. The problem with this construction is that Mathematica is still unlikely to be able to compute analytic area for this region, although ParametricRegion allows it to be defined... $\endgroup$
    – kirma
    Oct 13, 2014 at 20:42

2 Answers 2

3
$\begingroup$

I don't really understand what is known and what is not, but assuming that you know x1, y1, x2, y2 and a you can do (with v8, I assume v10 makes it much easier):

{x1, y1} = {0, 0}; {x2, y2} = {2, 3};
angle[v1_, v2_] := N@ArcCos[(First@v1*First@v2 + Last@v1*Last@v2)/(Norm@v1*Norm@v2)]
eqn[k_, l_, a_, x_, α_] := k + l*a*Exp[x*α]

kk[l_, a_] := k /. Solve[eqn[k, l, a, x1, angle[{x2 - x1, y2 - y1}, {a, 0}]] == y1, {k}]
ll[a_] := l /. Solve[eqn[kk[l, a], l, a, x2 + a, angle[{x2 - x1, y2 - y1}, {a, 0}]] == y2, {l}];
pts[a_] := Join[First@
   Cases[Plot[kk[ll[a], a] + ll[a]*a*Exp[x*angle[{x2 - x1, y2 - y1}, {a, 0}]], {x, x1, x2 + a}], Line[x_] :> x, ∞], 
   {{x1, y1}, {x2, y2}, {x2 + a, y2}}]

Here I'm using this and this to make sure the Polygon will have the right shape:

SignedArea[p1_, p2_, p3_] := 
  0.5 (#1[[2]] #2[[1]] - #1[[1]] #2[[2]]) &[p2 - p1, p3 - p1];
IntersectionQ[p1_, p2_, p3_, p4_] := 
  SignedArea[p1, p2, p3] SignedArea[p1, p2, p4] < 0 && 
   SignedArea[p3, p4, p1] SignedArea[p3, p4, p2] < 0;
Deintersect[p_] := Append[p, p[[1]]] //. {s1___, p1_, p2_, s2___, p3_, p4_, s3___} /; 
      IntersectionQ[p1, p2, p3, p4] :> ({s1, p1, p3, 
       Sequence @@ Reverse@{s2}, p2, p4, s3}) // Most;
fpts[a_] := Deintersect[pts[a]];
Graphics`Mesh`MeshInit[];
Abs@PolygonArea[fpts[2]]
6.18614
Block[{a = 2}, 
 Graphics[Polygon@fpts[a], Axes -> True, 
  Epilog -> {Red, Point[{{x1, y1}, {x2, y2}, {x2 + a, y2}}], 
    Line@pts@2, Green, Dashed, Line@fpts@2}]]

Mathematica graphics

$\endgroup$
20
  • $\begingroup$ thank you for your advice. May I ask what does the term 'k' represent? $\endgroup$
    – Corse
    Oct 14, 2014 at 12:41
  • $\begingroup$ @Corse I just defined your curve as k + a*Exp[l*angle]. So k and l are defined in terms of xi and yi. $\endgroup$
    – Öskå
    Oct 14, 2014 at 12:55
  • $\begingroup$ pardon me for my ignorance, in which part of the code do you define the parameter 'a'? Is it in ll[a_]? Also, v1 and v2 are unit vectors of the sloping line? $\endgroup$
    – Corse
    Oct 14, 2014 at 13:10
  • $\begingroup$ I let a be unknown so I can change it at anytime. And v1 and v2 are just random vectors for the angle calculation. $\endgroup$
    – Öskå
    Oct 14, 2014 at 13:51
  • $\begingroup$ i see, how do you change the value of α? i assume α is the angle B in my original illustration? $\endgroup$
    – Corse
    Oct 14, 2014 at 14:19
3
$\begingroup$

In this I have made $(x_2,y_2)$ the origin:

f[a_, t_] := a Exp[t]
Manipulate[
 Column[{
   ParametricPlot[{s f[a, t] Cos[t], s f[a, t] Sin[t]}, {t, angle, 
     0}, {s, 0, 1}, PlotRange -> {{-1, 2}, {-1, 0.1}}, 
    ImageSize -> 400, BoundaryStyle -> {Red, Thick}],
   Row[{"Area: ", Integrate[0.5 f[a, u]^2, {u, angle, 0}]}]
   }, Alignment -> Center]
 , {angle, -Pi/4, -Pi}, {a, 1, 2}]

enter image description here

UPDATE

Manipulate[Column[{ParametricPlot[s {f[a, t] Cos[t],
      -f[a, t] Sin[t]}, {t, 0, angle}, {s, 0, 1}, 
    PlotRange -> {{-10, 4}, {-10, 1}}, ImageSize -> 600, 
    BoundaryStyle -> {Red, Thick}, 
    Epilog -> {Circle[{0, 0}, 1/2, {0, -angle}], 
      Text[Style[
        "(\!\(\*SubscriptBox[\(x\), \
\(2\)]\),\!\(\*SubscriptBox[\(y\), \(2\)]\))", 16], {0, 
        0}, {0, -1.5}], 
      Text[Style[
        "(\!\(\*SubscriptBox[\(x\), \(2\)]\)+a,\!\(\*SubscriptBox[\(y\
\), \(2\)]\))", 16], {1.4 a, 0}, {0, -1.5}], 
      Text[Style[
        "(\!\(\*SubscriptBox[\(x\), \
\(1\)]\),\!\(\*SubscriptBox[\(y\), \(1\)]\))", 
        16], {a Exp[angle] Cos[angle], -a Exp[angle] Sin[angle]}, {0, 
        1.5}], Text[Style["B", 16], 
       0.8 {Cos[angle/2], -Sin[angle/2]}, {0, 0}]}], 
   Row[{"Area: ", Integrate[0.5 f[a, u]^2, {u, 0, angle}]}]}, 
  Alignment -> Center], {angle, Pi/4, Pi}, {a, 1, 2}]

enter image description here

$\endgroup$
3
  • $\begingroup$ thanks for your reply! how did you define the coordinates of (x1,y1)? $\endgroup$
    – Corse
    Oct 14, 2014 at 12:47
  • $\begingroup$ @Corse I accept this may not be what you desired. (x1,y1) in the above (a exp(t)cos(t), a exp(t)sin(t)) where at t=0 is the horizontal point from origin $\endgroup$
    – ubpdqn
    Oct 14, 2014 at 14:02
  • $\begingroup$ ah, but i believe this yields the same result as the proposed solution above. Let me try to understand the parametric manner of defining the area from your code $\endgroup$
    – Corse
    Oct 14, 2014 at 14:22

Your Answer

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

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