I am looking for the area of a parametric plot defined by two solutions (defined as: VVLt & PVLt) of Numerically solved differential equations. The problem is when i'm trying to integrate the two, the integration just gives the interpolating functions.

ParametricPlot[{VVLt, PVLt}, {t, 7, 10}] With[{x = VVLt, y = PVLt}, Integrate[y D[x, t], {t, 7, 10}]]

Which gives me enter image description here Because the module for solving the differential equations is quite long I've not included these lines. Is there another way to determine the Area of the parametric plot? Thank you!

  • $\begingroup$ Use NIntegrate instead of Integrate and integrate over one period. $\endgroup$ – Michael E2 May 29 '19 at 10:58

Using a different example that produces a closed curve:

sol = NDSolve[{y'[t] == y[t] (x[t] - 1), x'[t] == x[t] (2 - y[t]), 
       x[0] == 1, y[0] == 2.7}, {x, y}, {t, 0, 10}];

enter image description here

pp = ParametricPlot[Evaluate[{x[t], y[t]} /. First[sol]], {t, 0, 10}]

enter image description here

You can extract the closed curve from pp and get the Area of the enclosed polygon:

Area @ Cases[pp , Line[x_] :> Polygon[x[[First@FindCurvePath[x]]]], All][[1]]


  • $\begingroup$ This seems to work perfectly! I do have one more question I would like to ask you. Can you explain the line of code to calculate the Area? I know it's uncommon to ask and I would understand it if you don't want to do it. Anyway thanks a lot for the answer! $\endgroup$ – David May 29 '19 at 10:38
  • $\begingroup$ @David, you can see inside pp using its first part pp[[1]] . Cases[pp, Line[coords_], All] extracts the objects of the form Line[...] from pp, and Cases[pp, Line[coords_]:> foo[coords], All] modifies those line objects to the form foo[coords]. Since the line coordinates (coords) are not necessarily ordered to form a closed polygon we order them using the function FindCurvePath[coords]. The result is a polygon and we can apply Area or RegionMeasure to it to get its area. $\endgroup$ – kglr May 29 '19 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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