Calculating Multiple Integrals on Mathematica (Electric fields)

Click For Summary
SUMMARY

This discussion focuses on calculating electric fields generated by two plates using Mathematica. The user experiences significant delays when attempting to compute the median electric field across the plates, specifically when using the function Eymedio[y]. The calculations for Ey[0, 0, 0] are efficient, yielding a result of 16267.2, while Eymedio[0] takes considerably longer due to its complexity involving integrals of integrals. The user seeks advice on optimizing their Mathematica code for faster computations.

PREREQUISITES
  • Familiarity with Mathematica version 12.0 or later
  • Understanding of electric field calculations and integrals
  • Knowledge of symbolic computation and optimization techniques
  • Basic grasp of numerical methods for evaluating integrals
NEXT STEPS
  • Explore Mathematica's optimization functions to improve integration speed
  • Learn about parallel computing in Mathematica to handle complex calculations
  • Investigate the use of NIntegrate for numerical integration in Mathematica
  • Research techniques for simplifying integrals before computation
USEFUL FOR

Physicists, electrical engineers, and Mathematica users involved in computational electromagnetism or those seeking to optimize integral calculations in their projects.

GriffinHeart
Messages
3
Reaction score
0
I'm trying to calculate several stuff about the electric field generated by 2 "plaques"

My main problem being that in mathematica it calculates fast for a point of the electric field generated in the Y component, but if i try to make the median of all the points in the plaque it takes way to much time.

And after that i'll have to plot for all the points.


PHP:
ax := 0.09
az := 0.03
d := 0.052
V := 3000
E0 := 8.85 * 10^(-12)
Ke := 8.9 * 10^9


Ey1[x_, y_, 0] := 
 Ke * E0 * (V/d) * 
  Integrate[((y + d/2) / (((x - x0)^2 + (y + d/2)^2 + z0^2)^(3/2))), 
{x0, -ax/2, ax/2}, {z0, -az/2, az/2}]

Ey2[x_, y_, 0] := 
 Ke * E0 * (V/d) * 
  Integrate[-((y - d/2) / (((x - x0)^2 + (y - d/2)^2 + z0^2)^(3/2))), 
{x0, -ax/2, ax/2}, {z0, -az/2, az/2}]

Ey[x_, y_, 0] := Ey1[x, y, 0] + Ey2[x, y, 0]

Eymedio[y_] := (1/ax) * Integrate[Ey[x, y, 0], {x, -ax/2, ax/2}]

Ey1[0, 0, 0]
Ey2[0, 0, 0]
Ey[0, 0, 0]
Eymedio[0]

And the output, without Eymedio[0]

PHP:
8133.58

8133.58

16267.2

so calculating Ey[0,0,0] is fast, but when i try to calculate the "median" it takes like huge time.

Anything obvious I'm doing wrong with mathematica? i think the formulas are all correct.

Thanks for help
 
Physics news on Phys.org
That's probably because Ey[0, 0, 0] involves calculating a couple of integrals, while Eymedio[0] involves calculating integrals of integrals.
 

Similar threads

Replies
19
Views
3K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
6K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
Replies
44
Views
6K