1
$\begingroup$

I need code that creates a d-dimensional regions - where "d" varies. This simple example fails -

 d = 2
 aq = Array[q, d]
 dq = Sum[q[i]^2, {i, d}] < 7;
 Rq = ImplicitRegion[dq, aq];
 RegionMeasure[Rq]

but it works if the 4th line is

 Rq = ImplicitRegion[dq, {q[1], q[2]}];

Is there any way to avoid listing the variables?

$\endgroup$
5
$\begingroup$

I am not certain this is going to work for your real problem.

d = 2;
dq = Sum[q[i]^2, {i, d}] < 7;
Rq = ImplicitRegion[dq, {q[1], q[2]}];
RegionMeasure[Rq]

returns 7 Pi

d = 2;
aq = Array[q, d];
dq = Sum[q[i]^2, {i, d}] < 7;
Rq = ImplicitRegion[dq, Evaluate[aq]];
RegionMeasure[Rq]

returns 7 Pi

$\endgroup$
  • 1
    $\begingroup$ Look at Attributes[ImplicitRegion] which shows the attribute HoldAll $\endgroup$ – Bob Hanlon Jul 5 at 12:49
  • $\begingroup$ Thanks Bill and Bob. Great suggestions. $\endgroup$ – L Pagnucco Jul 5 at 19:34

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.