C
CoreyWhite
I asked the question, "how do you define arithmetic?", and when I came
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.
If you wanted to define mathematics I would first define addition. The
simplest way to define addition is to create a function for every
number and say f_n(x)=x+n , where n is the number you are preforming
addition on and x is the modifying value. The problem with this is it
uses addition to define itself, so I decided to write it longhand:
f_1(x) = if x==1 then y=2 , if x==2 then y=3, if x==3 then y=4...
f_2(x) = if x==1 then y=3 , if x==2 then y=4, if x==3 then y=5...
f_3(x) = if x==1 then y=4 , if x==2 then y=5, if x==3 then y=6...
....
You could do this for every number you wished to use and define the
scope of the numers you wished to work with. I of course have not
created a table that goes up to infinity or one that can use infinite
decimal places. If I need to I will just create new functions that
work with larger numbers and more decimal places.
What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.
This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.
Do you think we could optimize computer architecture to take advantage
of this?
Any feedback on this theory is welcome
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char *argv[])
{
time_t t1, t0;
double elapsed;
time(&t0); /* start time */
for(int cnt=0; cnt<1000000000; cnt++){
int x=0;
int y=577;
x=x+y;
y=x+y;
//if(x==0 && y==577) x=577;
//if(x==577 && y==577) y=1154;
}
time(&t1);
elapsed = difftime(t1, t0);
cout<<elapsed;
system("PAUSE");
return EXIT_SUCCESS;
}
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.
If you wanted to define mathematics I would first define addition. The
simplest way to define addition is to create a function for every
number and say f_n(x)=x+n , where n is the number you are preforming
addition on and x is the modifying value. The problem with this is it
uses addition to define itself, so I decided to write it longhand:
f_1(x) = if x==1 then y=2 , if x==2 then y=3, if x==3 then y=4...
f_2(x) = if x==1 then y=3 , if x==2 then y=4, if x==3 then y=5...
f_3(x) = if x==1 then y=4 , if x==2 then y=5, if x==3 then y=6...
....
You could do this for every number you wished to use and define the
scope of the numers you wished to work with. I of course have not
created a table that goes up to infinity or one that can use infinite
decimal places. If I need to I will just create new functions that
work with larger numbers and more decimal places.
What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.
This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.
Do you think we could optimize computer architecture to take advantage
of this?
Any feedback on this theory is welcome
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char *argv[])
{
time_t t1, t0;
double elapsed;
time(&t0); /* start time */
for(int cnt=0; cnt<1000000000; cnt++){
int x=0;
int y=577;
x=x+y;
y=x+y;
//if(x==0 && y==577) x=577;
//if(x==577 && y==577) y=1154;
}
time(&t1);
elapsed = difftime(t1, t0);
cout<<elapsed;
system("PAUSE");
return EXIT_SUCCESS;
}