Simulation of Electromagnet Force

Click For Summary

Discussion Overview

The discussion revolves around simulating electromagnetic forces alongside gravitational forces in a computational model. Participants explore the equations governing these forces, particularly focusing on the application of Newton's laws in the context of electromagnetism and the challenges of implementing these concepts in a simulation.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning
  • Experimental/applied

Main Points Raised

  • One participant describes their attempt to simulate gravitational forces using established equations and seeks to apply similar methods to electromagnetism.
  • Another participant points out that the formula for electromagnetic force resembles Coulomb's Law and emphasizes the need to use vector quantities for accurate modeling.
  • There is a question about whether the same formula for converting force to acceleration can be used for both gravitational and electromagnetic forces, with some participants suggesting that mass and charge are fundamentally different.
  • Concerns are raised about the need to recalculate forces based on changing positions during simulation iterations to avoid using constant force assumptions.
  • Participants discuss the importance of updating velocity and momentum in simulations to reflect accurate physical behavior.
  • Suggestions are made regarding programming languages and tools, such as VPython, that could facilitate the simulation process.

Areas of Agreement / Disagreement

Participants express differing views on the applicability of gravitational equations to electromagnetic forces, with no consensus reached on whether mass can be equated to charge in this context. The discussion also highlights varying levels of understanding regarding vector versus scalar quantities in simulations.

Contextual Notes

There are unresolved questions regarding the correct application of Newton's laws in the context of electromagnetic forces, particularly in relation to the definitions of mass and charge. The discussion also indicates potential limitations in the participants' understanding of vector calculations and simulation dynamics.

Who May Find This Useful

This discussion may be of interest to individuals involved in computational physics, simulation programming, or those seeking to understand the interplay between gravitational and electromagnetic forces in a modeling context.

ComputerPsi
Messages
24
Reaction score
0
Hello,
This sounds like a silly idea, but I am trying to simulate all forces of in the universe on my computer, putting in the correct physics equations for each force, one by one.
I was already able to simulate the force of gravity with the following formulas/equations:

G = 6.674205043E-11 'The Universal Constant of Gravitation
initialspeed = 0 'No additional force added.

mass1 = 70 'Average Person

'Earth
mass2 = 5.98E+24 'Planet's Mass
distances = 6378000 'On surface

force = (G * mass1 * mass2) / distances ^ 2
acceleration = force / mass1
'Or
acceleration = (G * mass2) / distances ^ 2

'loop through time
newposition=initialspeed * Time + (1 / 2) * acceleration * Time ^ 2)
'Stop looping when crashed into planet


Now, I am trying to simulate electromagnetisem. I found one formula that is probably the correct its:
K = 8987550000 'Coulomb's Constant
force = (K * q1 * q2) / distance

My question is, can I use the same equation "acceleration = force / mass1" to convert this force into acceleration? If so, is mass1 equal to q1?

If both are true, This seems to become an interesting equation as a result:
(G * mass) / distance ^ 2 = (K * mass) / distance

...supposedly meaning that gravity is produced by an electromagnetic force...

Please correct me if I am wrong.

Edit:
I just did the calculations.
As an example, I made mass equal 70 and distance equal to .2

As a result I got:
(G*mass)/distance^2 = 1.167985883E-7
(K*mass)/distance = 3.1456425E+12

So.. something is wrong.



Also, its possible that I posted in the wrong section, I am not sure where to post this since I am new to this website.. Moderators, please redirect it to the correct position if it is in the wrong section. Thanks.
 
Last edited:
Physics news on Phys.org
ComputerPsi said:
Now, I am trying to simulate electromagnetisem. I found one formula that is probably the correct its:
K = 8987550000 'Coulomb's Constant
force = (K * q1 * q2) / distance

What you wrote is almost Coulomb's Law of Electrostatics.
In your notation, it should be
force = (K * q1 * q2) / distance2[/color]

ComputerPsi said:
My question is, can I use the same equation "acceleration = force / mass1" to convert this force into acceleration? If so, is mass1 equal to q1?

If both are true, This seems to become an interesting equation as a result:
(G * mass) / distance ^ 2 = (K * mass) / distance

...supposedly meaning that gravity is produced by an electromagnetic force...

Please correct me if I am wrong.

The correct application of Newton's Law of Motion requires you to
write "acceleration = net[/color] force / mass1"

mass1 is not equal to q1. q1 is an electric charge, measured in coulombs.
(Note that G and K have units associated with the numbers you quoted.)


Looking over what you wrote, you need to work with vector--not merely scalar--quantities if you wish to, say, model the orbit of a planet.

You might wish to look over a text on simulations in physics, e.g.,
http://sip.clarku.edu/ .
 
Last edited by a moderator:
Thanks for the response.
Some how, I didn't notice the "2" in:
force = (K * q1 * q2) / distance2

robphy said:
Looking over what you wrote, you need to work with vector--not merely scalar--quantities if you wish to, say, model the orbit of a planet.

A vector, not merely a scalar? I don't seem to understand what you are talking about... Can you elaborate? On the simulation, I am trying to make a visual of the actual objects, reacting to different forces. So, I would need both direction and speed. Also, as additional properties, it would have mass, length, and others... So, I suppose it would need both a vector and a scalar.. Is it possible to use both? Sorry if this is an elementary question.. I am relatively new to some math calculations in physics, and I am teaching all the information to myself, with many of the resources on the internet.
 
But right now, the main question is, can I use the same formula as used in gravity to change force into acceleration, to use in electromagnetism too?

In the rewritten form:
acceleration = force / q1

Can I use this formula to change electromagnetism force into acceleration? Or is a different formula needed?
 
ComputerPsi said:
But right now, the main question is, can I use the same formula as used in gravity to change force into acceleration, to use in electromagnetism too?

In the rewritten form:
acceleration = force / q1

Can I use this formula to change electromagnetism force into acceleration? Or is a different formula needed?

You are referring to Newtons second law. This tells you, given a force, what the accelleration will be, independent of the source of the force. So even when you're delaing with electromagnetism you use acceleration = force / mass (note that this only applies when the mass of the object is constant).
 
robphy, I finally understand what you ment about working with a vector.. So, right now, I'm trying to my the 1-deminsional calculation into a 2d visual of the objects moving.
 
I don't know what language you are programming in... but from what i have read vpython might be good for you... it already has a vector "type" so to speak that's easy to manipulate and it will draw simple 3d scenes with little programming at all... there are also a lot of basic physics sims already available that you could look at and modify or what ever... note: the language is indent specific.

with the following...
'loop through time
newposition=initialspeed * Time + (1 / 2) * acceleration * Time ^ 2)
'Stop looping when crashed into planet

as your position is changing... you should be recalculating the force based on the new position in each iteration or you are using constant force...

i am not sure how you are using Time... i am assume you are using it as a dt? like a really small increment of time, in which case the following is what i think:

also i don't see initalspeed being updated in each iteration... so i don't think you are really conserving momentum of the object... but are actually calculating on each loop what the displacement would be if the object was stationary and now feeling an acceleration for the first time at this location.

otherwise if Time is total time elapsed... you don't seem to be updating it in your loop. also v0 + (1/2)at gives average velocity as t gets bigger I am sure that will start adding significant error.

i like to look at it as

dp/dt = fnet, so the rate of change of momentum is force (fnet should be the vector addition of all forces acting on the object... electric, gravity etc...

so

dp = fnet*dt this would tell you how much momentum changed for when a force fnet was applied for a time dt... the smaller dt the more accurate the calculation...

then update total momentum

p = p+dp

now you can get the velocity from p=mv so the current velocity is now
p/m or p*(1/m)

so updating position

newpos=oldpos+(p/m)*dt

(note fnet, p and dp should be vectors)
 
In the VPython installation (see http://vpython.org ), there is a demo program called orbit.py. You might like to look at the source. It's under 30 lines of code.
 
Well, programming is actually one of my strongest points, so, I would continue writing the program instead. Anyway, my program works a bit differently.. I'm coding it to have the most posible simplicty, to be able to handle all the forces simitaniusly, with correct timing.
Anyway, I tried running VPython, but it just freezes, when I try to run it...
 
Last edited:

Similar threads

  • · Replies 42 ·
2
Replies
42
Views
8K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K