I have to make 2 programs... for now i'll just give you one... we have to program a way to find the square root without using math.sqrt(0); i've found out ways to do it manually with pen and paper... but the way i see it, programming it that way is impossible. anyone know of a way? or a program already? my lecture teacher hasn't showed up in 2 weeks... so my lab teacher just keeps giving us all the hw and expects us to teach ourselves, but the book is pfft

http://www.geocities.com/cnowlen/Cathy/Emat4680/Squareroot.htm If you can't turn that into code you need more practice.

I would suggest NOT copying the Q3 algorithm for this project, because I doubt you will be able to explain it if your professor asks.

Has to do with the way floating point numbers are represented as sign bit, a mantissa, and a significand. That is why it appears to be such a large number anyway.

isn't it Math.pow(i,2) and the 2 means what power the i is raised to? its bee awhile since i squared something

thats the one i found earlier.. and i have no idea where to even begin. i do need practice but like i said our teacher hasn't even been there to teach. pffft this is a class for CONSTRUCTION MANAGEMENT and is 6 hours but only counts as 2 credits. its a BS class and this is a BS assignment i thought about just submitting math.pow(i,1/2) lol

You would get no points, because calling pow with a float as the second parameter would fail. *edit* nvm, that would work, I keep thinking this is C. You would still fail the assignment though lol.

Can you just not use the sqrt() function? but others are ok? you could do exp( log(i) / 2 ) but im guessing the assignment want you to do it without using the math library

Ill walk you through it later, don't have time now but tomorrow afternoon probably. Basically, the first thing I look for is a potential loop, you should be able to find it in the algorithm described in the link I gave.

no one submitted the homework lol. our teacher gave us this algorithm and we did it in class... If A > 0 is a guess of the square root of the positive number Q, then a better approximation to √Q is given by B = (A + Q/A)/2. Now you use B as an approximation and compute C = (B + Q/B)/2, and so on to get as close as you want to the value of √Q. which is MUCH easier than the long division one

Now, see if you can relate that to the D3 algorithm... because it is exactly the same using a clever initial guess.

that's newton's approximation of roots. a.k.a the method i posted in the second post carmack's magic number is the guess and then it does one or two more iterations. (the second is commented out in the q3 code)