Advertisement

Math Formula Tutorial?

Started by June 13, 2002 02:51 PM
6 comments, last by pakloong82 22 years, 8 months ago
greetings, I wonder where can i find math tutorial website that actully teach me how to programe math formula in C/C++. Thank You.
:)
Please be more specific. I have no idea what you are talking about.

Proceeding on a brutal rampage is the obvious choice.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
Advertisement
How to put a math formula in C++ code?

Look at all the var''s you need(one for theta/phi and so on), define them and give them a value.

Then look at your formula, if they define a x coordinate(and an y and z) then just put x=formule with the var''s you have defined before. You can put them in a loop so that you change the value..

Have a look at how to draw a simple circle with sin/cos functions and radians.. Maybe that gives you an idea

Mmm.. I don''t think I explained it very well :D I shall practice on my english
C++ functions work the same way as math functions. So, if you wanted to make the equation y=3x+2, you would do the following.
#include <iostream.h>float y(float x);int main(){   float x;   cin >> x;   float Result = y(x);   cout << Result;}float y(x){  return (3*x +2);} 


Proceeding on a brutal rampage is the obvious choice.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
First, thanks a lot guy.....
those are not that difficult math formula.......

i mean how to program formula such as dy, dx....... matrix (advance)......., plus a few difficult math formaula........

thanks.
:)
Look at the formula you are trying to impliment and find a way that you can break it down into pieces that C/C++ can deal with (basic arithmetic, loops, etc).

For example, some simple matrix math:

Matrx A:

|1 2|
|3 4|

3 * A:

|3 * 1 3 * 2|
|3 * 3 3 * 4| yes?

In C++ 3 * A could look like:

B.11 = 3 * A.11;
B.12 = 3 * A.12;
B.21 = 3 * A.21;
B.22 = 3 * A.22;

Break down your algorithm into pieces that you can code



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm
Advertisement
Look at tutorials here and there on implementing different algorithims.
Observe how they break things up into code, then work stuff out on your own.

After while you will get the hang of it.
:-D

Bugle4d
~V'lionBugle4d
There is a good book which explains several mathematical algorithms for scientists and engineers....moreover the implementation of these algos in c/c++ is also provided in the book. You can read reviews about the book and order it through amazon by clicking Here

This topic is closed to new replies.

Advertisement