0
$\begingroup$

Please help me to figure out the issue with my code.

What I need is to use variables $AA$ and $TT$. First code samples works and does what I need:

XX = 3*t + 1;
YY = a^3*Sin[t];
ZZ = a^3*Cos[t];
R = ParametricRegion[{XX, YY, ZZ}, {{a, 1/2, 1}, {t, Pi/6, Pi/4}}];
NIntegrate[x, {x, y, z} \[Element] R]

but second code sample does not work, and I can not understand why. It looks it must work, and we do not have any issues with $XX$,$YY$,$ZZ$.

XX = 3*t + 1;
YY = a^3*Sin[t];
ZZ = a^3*Cos[t];
AA = {a, 1/2, 1};
TT = {t, Pi/6, Pi/4};
R = ParametricRegion[{XX, YY, ZZ}, {AA, TT}];
NIntegrate[x, {x, y, z} \[Element] R]

Thanks a lot for your help!

$\endgroup$
3
$\begingroup$
Attributes[ParametricRegion]

(* {HoldAll, Protected} *)

Because of the attribute HoldAll your iterators are not expanded to the proper form for iterators. You need to use Evaluate to have the iterators expanded.

XX = 3*t + 1;
YY = a^3*Sin[t];
ZZ = a^3*Cos[t];
AA = {a, 1/2, 1};
TT = {t, Pi/6, Pi/4};
R = ParametricRegion[{XX, YY, ZZ}, Evaluate@{AA, TT}];
NIntegrate[x, {x, y, z} ∈ R]

(* 2.0789 *)
$\endgroup$
  • $\begingroup$ Terrific, thanks! $\endgroup$ – Hedgehog Nov 10 '17 at 18:31

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.