You last visited: Today at 23:55
Advertisement
Absolutely Mind Blasting
Discussion on Absolutely Mind Blasting within the CO2 Private Server forum part of the Conquer Online 2 category.
10/28/2010, 06:59
#1
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Absolutely Mind Blasting
Code:
static double f(double x, int klimit)
{
double result = Double.NaN;
double numerator, denominator;
int k;
if (Math.Abs(x) < 1)
{
result = 0;
for (k = 0; k <= klimit; k++)
{
numerator = Math.Pow(-1, k) * Math.Pow(x, 1 + (2 * k));
denominator = 1 + (2 * k);
result += (numerator / denominator);
}
}
else if (Math.Abs(x) > 1)
{
result = 0;
for (k = 0; k <= klimit; k++)
{
numerator = Math.Pow(-1, k) * Math.Pow(x, (-1) - (2 * k));
denominator = 1 + (2 * k);
result += (numerator / denominator);
}
numerator = Math.PI * Math.Sqrt(x * x);
denominator = x * 2;
result = (numerator / denominator) - result;
}
else // x == 1
{
return 0.25 * Math.PI;
}
return result;
}
Code:
static double finv(double x, int klimit)
{
Func<int, int> factorial = (n) =>
{
int num = 1;
for (int j = n; j > 0; j--)
num *= j;
return num;
};
Func<double, int, double> g = (gx, gklimit) =>
{
double gres = 0;
double gnum, gdenom;
for (int gk = 0; gk <= gklimit; gk++)
{
gnum = Math.Pow(-1, gk) * Math.Pow(gx, (2 * gk));
gdenom = factorial(2 * gk);
gres += (gnum / gdenom);
}
return gres;
};
Func<double, int, double> h = (hx, hklimit) =>
{
double hres = 0;
double hnum, hdenom;
for (int hk = 0; hk <= hklimit; hk++)
{
hnum = Math.Pow(-1, hk) * Math.Pow(hx, (2 * hk) + 1);
hdenom = factorial((2 * hk) + 1);
hres += (hnum / hdenom);
}
return hres;
};
return (h(2 * x, klimit) / (g(2 * x, klimit) + 1));
}
Code:
finv( f ( x , k ) , k )
Will give you the same result as the
x parameter
Well, not the exact result, but as
k (klimit) increases, accuracy increases.
How's this relevant to CO?
Well, if we build on the f() function a bit we can do this...
Code:
static double f2(double y, double x, int klimit)
{
if (x > 0)
return f(y / x, klimit);
else if (y >= 0 && x < 0)
return Math.PI + f(y / x, klimit);
else if (y < 0 && x < 0)
return (-Math.PI) + f(y / x, klimit);
else if (y > 0 && x == 0)
return Math.PI / 2;
else if (y < 0 && x == 0)
return (-Math.PI) / 2;
return Double.NaN;
}
Code:
static int GetAngle(int X1, int Y1, int X2, int Y2)
{
return (int)Math.Round(f2(Y2 - Y1, X2 - X1, 5) * 180 / Math.PI);
}
10/28/2010, 07:06
#2
elite*gold: 0
Join Date: Oct 2009
Posts: 8,784
Received Thanks: 5,304
Easy geometry homework ftw.
10/28/2010, 07:07
#3
elite*gold: 0
Join Date: Aug 2010
Posts: 50
Received Thanks: 3
Umm wtf does this do lol?
10/28/2010, 07:09
#4
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Nothing -- well, that's not true but it's not worth explaining. I just found it highly fascinating.
10/28/2010, 07:29
#5
elite*gold: 20
Join Date: Oct 2010
Posts: 451
Received Thanks: 259
Thank you for sharing that. I found it interesting because I didn't know much about the math class until now.
10/28/2010, 10:00
#6
elite*gold: 28
Join Date: Jun 2010
Posts: 2,226
Received Thanks: 868
Absoultely fantastic on how that works(Never done anything with maths(Well, not much)) May come in handy. #Bookmarked
10/28/2010, 10:21
#7
elite*gold: 0
Join Date: May 2009
Posts: 480
Received Thanks: 112
nice and pretty fascinating
10/28/2010, 13:29
#8
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
WHAT IS THIS I DONT EVEN ---
10/28/2010, 22:13
#9
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
I warned you that bricks would be shat.
10/29/2010, 05:11
#10
elite*gold: 20
Join Date: Oct 2010
Posts: 451
Received Thanks: 259
Quote:
Originally Posted by
copz1337
"Oh Absolutely" nerds these days.
Lol, srry that the math confuses you.
Noobs these days
EDIT: xP i'm sorry, that was a bit harsh. Try and understand it. The result is interesting.
10/29/2010, 13:25
#11
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
10 dollars says nobody that has posted in this thread understands it
10/29/2010, 13:32
#12
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by
_tao4229_
10 dollars says nobody that has posted in this thread understands it
Agree.
10/29/2010, 13:42
#13
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
I don't understand it.
10/29/2010, 13:53
#14
elite*gold: 0
Join Date: Sep 2008
Posts: 694
Received Thanks: 207
I got lost, sigh. Should get more into coding.
10/29/2010, 14:01
#15
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
This doesnt have very much to do with programming, you need to be good at maths to understand this.
Similar Threads
CABAL PH Try My new Bot Absolutely FREE!!!!!!!
08/27/2008 - Cabal Hacks, Bots, Cheats, Exploits & Macros - 8 Replies
all Pinoyz!!!! try my self made bot!! heres the link trust me scan it if you want
-
got an update my new version
-
dont forget to give me -!!!!!!
All times are GMT +2. The time now is 23:55 .