# How to limit processing demand simulating electromagnetic trajectory

• DivergentSpectrum
In summary, the conversation discusses the calculation of the B field due to a wire with a given parametric equation and a current running through it. It is mentioned that the B field at a point can be calculated by summing up the contributions of the wire over its length, with the help of an integral. However, the individual performing the calculation realizes that it is inefficient to calculate the integral at every time step and is looking for a way to calculate it only once. The conversation also delves into a more complex mathematical equation involving three integrals, and the possibility of using Bezier curves to approximate the wire and reduce the number of integrals needed to be calculated. Finally, there is a discussion on whether the thickness of the wire affects the
DivergentSpectrum
so suppose i have a wire given parametrically by C(t)=x(t),y(t),z(t), and i run a current of I amps through it. to find the total B field i would sum up the contributions over the length of the wire, and (please tell me if I am wrong) the total B field due to the wire at point p=xp,yp,zp would be

B=$\frac{mI}{4\pi}$$\int$$\frac{\hat{C}'(t)χ(p-C(t))}{|p-C(t)|^{3}}dt$

where $\hat{C}'(t)$ is the unit vector tangeant to C and m is the permeability of free space, and the bounds of the integral would be t0 and t1 where the curve begins and ends.

So here's the problem:
while i was programming to find the trajectory of a charged particle due to a current through the wire, i realized that i need to calculate the integral(numerically) on every time step to find the B field at that point in space. this is very inefficient and, with my computer, impossible. I was wondering if there is any way i can calculate the integral only once and be able to use that to find the magnetic field at all points in space?
thanks.

edit: i just noticed i posted this in the wrong forum can mods please move this?

Last edited:
Why every time step? Does your wire move?

Depending on the shape of the wire, you might be able to exploit some symmetry or be able to neglect some parts. If that does not work, in general it is very tricky to save some time on those integrals. Do you really need the magnetic field everywhere?

The wire is stationary, its kind of hard to explain why i have to do the integral at every time step, but ill try

warning really messy math.
Im basically doing 3 integrals here:
$B_{x}=\frac{mI}{4\pi}\int\frac{y'*(z_{p}-z)-z'*(y_{p}-y )}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt$

$B_{y}=\frac{mI}{4\pi}\int\frac{z'*(x_{p}-x)-x'*(z_{p}-z )}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt$

$B_{z}=\frac{mI}{4\pi}\int\frac{x'*(y_{p}-y)-y'*(x_{p}-x )}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt$

now, basically x,y,z and x',y',z' are functions of t, while xp, yp,zp are constants as far as the integration goes, and i want a general numerical solution to the integral for all xp, yp,zp
so, seperating even further, i get
$B_{x}=\frac{mI(a*z_{p}-b-c*y_{p}+d)}{4\pi}$
$B_{y}=\frac{mI(c*x_{p}-i-e*z_{p}+f)}{4\pi}$
$B_{z}=\frac{mI(e*y_{p}-g-a*x_{p}+h)}{4\pi}$

where
$a=\int\frac{y'}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$b=\int\frac{y'*z}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$c=\int\frac{z'}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$d=\int\frac{z'*y}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$e=\int\frac{x'}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt$

$f=\int\frac{x'*z}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$g=\int\frac{x'*y}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$h=\int\frac{y'*x}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

$i=\int\frac{z'*x}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt$

these are definite integrals (im still getting the hang of this latex thing lol)
the idea is i could sum all of these up, multiply some of them by xp or yp or zp, and get the field at all points, but unfortunately, i have those pesky p's on the bottom of the fraction, so i can't figure out a way to separate them. if i knew a general way to deal with this i could simply do several integrals only once which isn't so bad.

Damn physics for making force a function of distance! :P

Last edited:
note: I am beginning to think the sqrt(x'2+y'2+z'2) term doesn't belong there. i really wish there were more people here to help me :(

I don't see where that sqrt term comes from either. Your integral is (or should be) the Biot-Savart law.

If (!) you need to know the field at "all" points in space, then yes, you'll have to calculate many integrals. How many, depends on the required precision for the fields. You can pre-calculate x', y', z'(t) because it is the same in every integration.
And I don't see any time-dependence here.

damn. i wonder if i could approximate the curve over small intervals with a polynomial, then (provided the B field due to the approximation of the wire is an elementary integral), i could add up the field due to the approximating segments.
it seems like the best choice.

ive been looking around and found this thing called "bezier curves", I've never heard of them before, so I am trying to figure out how they work, and if theyll work with this problem

the sqrt term shouldn't be there (my mistake), but i still have the same problem. really i only need to find the field at the locations where a particle will be at some time, but that still requires doing an integral at each time step

Last edited:
Bump

Also, noticed another possible problem. does the force depend upon the thickness of the wire?

## 1. How can I reduce processing demand when simulating electromagnetic trajectories?

There are a few ways to limit processing demand when simulating electromagnetic trajectories. One option is to use simplified models or approximations instead of detailed simulations. Another option is to reduce the number of particles or objects being simulated. Additionally, optimizing the code and using parallel processing techniques can also help reduce processing demand.

## 2. What is the impact of limiting processing demand on the accuracy of the simulation?

Limiting processing demand can potentially decrease the accuracy of the simulation. This is because simplifying the models or reducing the number of particles may result in less precise results. However, this trade-off may be necessary in order to run the simulation within a reasonable amount of time.

## 3. Are there any software tools or programs that can help with limiting processing demand in electromagnetic trajectory simulations?

Yes, there are software tools and programs that can assist with reducing processing demand in electromagnetic trajectory simulations. These include specialized simulation software with built-in optimization features, as well as general-purpose parallel processing tools that can be applied to simulations.

## 4. How can I determine the optimal level of processing demand for my simulation?

The optimal level of processing demand for a simulation will depend on various factors, such as the desired accuracy of the results and the available computing resources. It is important to strike a balance between processing demand and accuracy, and this may require some experimentation and adjustments.

## 5. Will limiting processing demand affect the speed of the simulation?

In most cases, limiting processing demand will result in a faster simulation, as less computing power is required to run it. However, as mentioned earlier, this may come at the cost of decreased accuracy. It is important to carefully consider the trade-offs and find the best balance for your specific simulation needs.

• Calculus
Replies
16
Views
3K
• Calculus
Replies
11
Views
3K
• Calculus
Replies
2
Views
801
• Classical Physics
Replies
6
Views
1K
• Introductory Physics Homework Help
Replies
3
Views
906
• Biology and Chemistry Homework Help
Replies
2
Views
284
• Classical Physics
Replies
3
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
1
Views
616