0
$\begingroup$

I am using Mathematica's ability to integrate over regions to find the mean aerodynamic cord of a wing planform. As an example, here is a simple wing, and its bounds.

points = {{0, 0}, {3, 300}, {120, 310}, {200, 0}}

wing = Polygon[points]

{{xmin, xmax}, {ymin, ymax}} = RegionBounds[wing]

I can use the normal Integrate to find its area A. But the mean aerodynamic cord is:

$c_m=\frac{1}{A} \int_{R}^{ } c^2(y) \,dy$

where R is the region, and c(y) is the cord at any y. In the past, I did this by defining c(y) as:

c[R_,y_]:=ArcLength[RegionIntersection[R, InfiniteLine[{0, y}, {1, 0}]]]

and doing the integral like this:

cm = 1/A NIntegrate[c[wing, y]^2, {y, ymin, ymax}]

This has always worked, until I upgraded to Mathematica 14. Now it says the integrand is Undefined. Which is odd, because you can still plot:

Plot[c[wing, y]^2, {y, ymin, ymax}]

and it works.

$\endgroup$

1 Answer 1

3
$\begingroup$
$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"]

points = {{0, 0}, {3, 300}, {120, 310}, {200, 0}};

wing = Polygon[points];

A = Area[wing]

(* 48535 *)

A === Integrate[1, {x, y} ∈ wing]

(* True *)

{{xmin, xmax}, {ymin, ymax}} = RegionBounds[wing];

c[R_, y_] := ArcLength[RegionIntersection[R, InfiniteLine[{0, y}, {1, 0}]]]

Note that c cannot evaluate with symbolic arguments.

c[r, y]

(* ArcLength::reg: RegionIntersection[r,InfiniteLine[{0,y},{1,0}]] is not a correctly specified region.

ArcLength[RegionIntersection[r, InfiniteLine[{0, y}, {1, 0}]]] *)

Consequently, restrict it to non-symbolic arguments

Clear[c];
c[R_?RegionQ, y_?NumericQ] := ArcLength[
  RegionIntersection[R, InfiniteLine[{0, y}, {1, 0}]]]

cm = 1/A  NIntegrate[c[wing, y]^2, {y, ymin, ymax}]

(* 162.135 *)
$\endgroup$

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.