Group Abstract Group Abstract

Message Boards Message Boards

0
|
4K Views
|
9 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Integral of an exponent function

Hii all, I'm stuck at a very basic point where an integral of an exponent of a polinomial function is not being calculated. The follwing is how the integral is formulated. It uses shape functions and a field vector. The integral of an exponential function of the field value interpolated in a 2d element using the Shape function

c = {c1, c2, c3, c4};
Y = {y1, y2};
sf = ConstantArray[1, 4];(*shape function as a 1x4 vector*)
sf[[1]] = 0.25*(1 - y1)*(1 - y2);
sf[[2]] = 0.25*(1 + y1)*(1 - y2);
sf[[3]] = 0.25*(1 + y1)*(1 + y2);
sf[[4]] = 0.25*(1 - y1)*(1 + y2);
cGP = sf.c;(*field value at a gauss point interpolated using shapefunction at y1,y2*)
fC = Exp[cGP]
out:=e^(0.25 c1 (1 - y1) (1 - y2) + 0.25 c2 (1 + y1) (1 - y2) + 0.25 c4 (1 - y1) (1 + y2) + 0.25 c3 (1 + y1) (1 + y2))
intfC = Integrate[fC, {y1, -1, 1}, {y2, -1, 1}](*exponent of the field value evaluated and integrated all over the element*)

I don't understand why this doesnt work and would be very grateful for an explanation or any suggestions on remedies or alternate solutions. Thank You!!

Attachments:
9 Replies

I checked right now the Help Center of Matlab. Among the special functions it offers also expint, described as "Exponential integral function". I wonder if it is the same thing as Mathematica's ExpIntegralEi.

POSTED BY: Gianluca Gorni

ExpIntegralEi is a special function. It is as "plain" as you can get, I am afraid. What is your purpose in this calculation?

POSTED BY: Gianluca Gorni

I would try this way:

c = {c1, c2, c3, c4};
sf = 1/4*{(1 - y1)*(1 - y2),
    (1 + y1)*(1 - y2),
    (1 + y1)*(1 + y2),
    (1 - y1)*(1 + y2)};
cGP = sf . c;
fC = Exp[cGP];
firstIteratedIntegral = Integrate[fC, {y1, -1, 1}];
primitiveOfFirstIteratedIntegral[y2_] = 
  Integrate[firstIteratedIntegral, y2];
doubleIntegral[c1_, c2_, c3_, c4_] = 
 primitiveOfFirstIteratedIntegral[1] - 
  primitiveOfFirstIteratedIntegral[-1]
Manipulate[Quiet@Plot3D[doubleIntegral[c1, c2, c3, c4],
   {c1, -2, 2}, {c2, -2, 2}, AxesLabel -> Automatic],
 {{c3, -1}, -2, 2},
 {{c4, 1/2}, -2, 2}]
POSTED BY: Gianluca Gorni
Posted 2 years ago

Does this help?

Assuming[c1>0,
  Integrate[E^(1/4c1(1-y1)(1-y2)),{y1,-1,1},{y2,-1,1}]]
POSTED BY: Bill Nelson
POSTED BY: Gianluca Gorni

I use Matlab to develop a Finite Element model of a mechanical process. This process is governed by a series of PDEs. The whole volume is broken into small elements and these PDEs are kinda converted into a form called weak form which is integrated over the volume of these elements to calculate a residual which is equated to '0', this is basiclly what FEM is. Usually the integral over the element is calculated through Gaussian Quadrature, But I'm trying to do it using Matematica analytical integration as I'm using the concept of reduced integration for certain terms of the PDE as it demands this. So anyway, this Integrated expression goes into the residual formulation in Matlab as a function of the field variables 'c'. SoI'll need an expression that I can write in matlab to compute the value of the residual at each Newton Iteration for every element. Thanks a lot for your help and curiosity, I hope I gave a clear answer.

TL;DR: I need to write this expression in matlab where I give the c values and get the expression value as an output. Thanks!!

Thank you for your answer, Bill. It works for a single variable, but the issue reappears after I do the same for more variables. In any case, the other answer worked. Thank You!

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