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$

1 Answer 1

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$
1
  • $\begingroup$ Terrific, thanks! $\endgroup$
    – Hedgehog
    Commented Nov 10, 2017 at 18:31

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.