Original Post
Hi guys, I'm making some tennis game. x-y+sqrt(x^2-2)-sqrt(y^2-2)=0 Can anyone solve above equation for x like "x=..."? [Edited by - tion80 on November 6, 2004 7:58:10 PM]
Quote:
x-y+sqrt(x^2-2)-sqrt(y^2-2)=0
Quote:
x-y+sqrt(x^2-a)-sqrt(y^2-b)=0
Quote:
Original post by _Vlad
Here's the method :
x-y+sqrt(x^2-2)-sqrt(y^2-2)=0
x^2-2 = ( sqrt(y^2-2)-x+y )^2
Developping the right-hand term we find a simple 2nd order equation in x .......
double a=7,b=5,y=16;double z=y+sqrt(y*y-b);//1 sqrt, 3 mult, 1 div, 2 add, 1subdouble x_my=(a+z*z)/(2*z);double x_mat=(a*y+b*y-a*sqrt(y*y-b)+b*sqrt(y*y-b))/(2*b);// 1 sqrt (with compiler optimizations), 6 multiplies , 1 division , 2 add, 2 subcout<<"my="<<x_my<<" mathematica="<<x_mat<<endl; //same results on all testscout<<x_my-y+sqrt(x_my*x_my-a)-sqrt(y*y-b)<<endl; //testThis topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more