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$ Commented Nov 10, 2017 at 18:31

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.