Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,192 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,375 people online right now. Registration is fast and FREE... Join Now!




Mathematical line for code

 
Reply to this topicStart new topic

Mathematical line for code, I need a mathematical line for code

pesadilla143
21 May, 2008 - 12:32 AM
Post #1

New D.I.C Head
*

Joined: 21 May, 2008
Posts: 3

Thank you very much smile.gif

This post has been edited by pesadilla143: 21 May, 2008 - 08:09 AM
User is offlineProfile CardPM
+Quote Post

joske
RE: Mathematical Line For Code
21 May, 2008 - 03:56 AM
Post #2

D.I.C Head
**

Joined: 4 Sep, 2007
Posts: 158



Thanked: 12 times
My Contributions
Check this page:
http://en.wikipedia.org/wiki/Newton's_...sal_gravitation

The formula for gravitational force between two masses is:
F = G * m1 * m2 / r^2
where F in (N), m1 and m2 in (kg), r in (m), and

G = 6.647428 * 10^-11 (m^3/kg/s^2)

If you want to give the measures in CM and GRAMS, and want the output in DYNE (=10 micro newton) you have to multiply with a certain power of ten. The 10^-8 in your formula compensates for that. (so your formula is correct).

If you want to give inputs in KG and M, and outputs in N, your formula has to be:
CODE
force = (((6.673 * pow(10.0, -11.0)) * m1 * m2) / pow(d,2));


This post has been edited by joske: 21 May, 2008 - 04:02 AM
User is offlineProfile CardPM
+Quote Post

pesadilla143
RE: Mathematical Line For Code
21 May, 2008 - 08:09 AM
Post #3

New D.I.C Head
*

Joined: 21 May, 2008
Posts: 3

Thank You Very Much smile.gif

This post has been edited by pesadilla143: 21 May, 2008 - 08:18 AM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 12:01PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month