Message Boards Message Boards

0
|
2864 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Why "value False" result in 11.01 by Integrate over an ImplicitRegion?

Posted 6 years ago

Hi, I have a normal vector in 3D in the xz-plane:

In[53]:= mHi3ret[[4, 50]]
Out[53]= {-0.762672, 0., 0.646786}

and I have an ImplicitRegion:

In[54]:= impreg[[50]]
Out[54]= ImplicitRegion[-0.0075 <= y <= 0.0075 && 
  0.0478621 <= x <= 0.0607978 && 0.0564377 <= z <= 0.0716912 && 
  z == 1.07283*10^-17 + 1.17917 x, {x, y, z}]

and I have a simple vector function:

f[x_, y_, z_] := {x + y - z, x - y + z, -x + y + z};

I am trying to compute the flux of this vector function over the given ImplicitRegion, like:

In[58]:= Integrate[
 Dot[mHi3ret[[4, 50]], f[x, y, z]], {x, y, z} \[Element] impreg[[50]] ]
Out[58]= 0.00241392 False

Why I am getting this False at the end? When I do the same in 11.2 I am not getting it, but unfortunately I am not at the machine where I have 11.2. If I try to do it "manually", that is, without the ImplicitRegion I get errors:

In[59]:= Integrate[
 Dot[mHi3ret[[4, 50]], f[x, y, z] ], {x, 0.0478621, 
  0.0607978}, {y, -0.0075, 0.0075}, {z, 0.056437722840267275`, 
  0.07169116144574492`}, 
 Assumptions -> (z = 1.072827*10^(-17) + 1.179178* x)] 

During evaluation of In[59]:= Integrate::ilim

Out[59]= Integrate[0.00241392, {0.013, 0.0478621, 
  0.0607978}, {0.0075, -0.0075, 0.0075}, {0.0153293, 0.0564377, 
  0.0716912}, Assumptions -> 0.0153293]

So, my question is what is the right way to get the good result? Thanks ahead, János

POSTED BY: Janos Lobb
Posted 6 years ago

As I am trying to verify if the given result / 0.00241392 / before the False is good or not, I use a numerical path , that is I divide the ImplicitRegion into smaller rectangular areas, multiply the area with the inner product of the normal vector and the given f[x,y,z] vector field value at the corners of the small rectangular areas and add them together. Because the Implicit Region is vertical to the xz-plane, I determine the small rectangular areas' corner points by their x- and y-valuse and calculate the z-value from the condition that the {x,y.z} values have to be in the plane of the Implicit region. Let's say the y-directional side of this small rectangular area is dd, then the x-side value will be dd*Cos[alpha] if the ImplicitRegion has an alpha angle with the xy-plane, and the z-valus will calculated from the x-values.

Clear[x, y, z]
zz = Table[
  Reduce[Dot[{x, y, z} - mHi3ret[[3, i, 1, 1]], 
     mHi3ret[[4, i]] ] == {0., 0.} , {x, y, z}] , {i, 1, 
   Length[mHi3ret[[3]] ]}]

where mHi3ret[[3]] contain the polygons describing the i-eth ImplicitRegion, so mHi3ret[[3, i, 1, 1]] is the starting corner point of the i-eth ImplicitRegion, mHi3ret[[4, i]] is the normal vector of the i-eth ImplicitRegion and Reduce is giving the linear connection of the z-value corresponding to a given x-value of the i-eth ImplicitRegion. So later on I refer to this zz Table to calculate the right z-velue if the x-value is given.

cosalpha = 
  Table[Cos[
    ArcTan[mHi3ret[[3, i, 1, 1, 1]], 
     mHi3ret[[3, i, 1, 1, 3]] ] ] , {i, 1, Length[mHi3ret[[3]] ]}];

is giving me the Cos[alpha] values. With dd=0.008, I calculate the corner points of the small rectangular regions this way:

impoints = ParallelTable[
    Flatten[Table[{x, y, zz[[i, 2]]}, {x,
       If[(mHi3ret[[3, i, 1, 2, 1]] - mHi3ret[[3, i, 1, 1, 1]]) >= 
         0 , mHi3ret[[3, i, 1, 1, 1]], mHi3ret[[3, i, 1, 2, 1]] ], 
       If[(mHi3ret[[3, i, 1, 2, 1]] - mHi3ret[[3, i, 1, 1, 1]]) >= 0, 
        mHi3ret[[3, i, 1, 2, 1]], mHi3ret[[3, i, 1, 1, 1]] ], 
       dd*cosalpha[[i]]}, {y, -0.0075, 0.0075, dd}], 1], {i, 1, 
     Length[mHi3ret[[3]] ]}]; // AbsoluteTiming
I

t takes more than an hour to calculate, on my laptop with OSX 10.13.3 and Mathematica 11.0.1 it takes 3695.71 second, that is more than an hour to get these points, although we are speaking here 6 points per ImpliciteRegion multiplied by 440, the total numbers of ImplicitRegions. So all together it is 2640 points. Telling otherwise Mathematica is using more than a second to create a Point from pre-computed numerical values on a machine that is capable almost a trillion floating point calculations in a second, with plenty of free memory, so the disk is not touched during the calculation. Why? Given the impoints, I calculate the flux for all the ImplicitRegions this way:

In[350]:= 
fluximpreg008 = 
   ParallelTable[
    Total[dd^2 *
      Map[Dot[mHi3ret[[4, i]], #] &, 
       Map[f[x, y, z] /. {x -> #[[1]], y -> #[[2]], z -> #[[3]]} &, 
        impoints[[i]] ] ] ], {i, 1, 
     Length[impoints]}]; // AbsoluteTiming
Out[350]= {2154.58, Null}

Again it takes "forever" to calculate it for such a simple vector field of :

f[x_, y_, z_] := {x + y - z, x - y + z, -x + y + z};

Any good ideas what can be done to speed up this computation? Of course I have to do it for smaller and smaller dds to see if the definite integral was good or not. Thanks ahead, János

POSTED BY: Janos Lobb
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract