Sqrt In C Without Math Homework
Keyboard shortcuts: Enter math expressions
You can use keyboard shortcuts to enter the following formats, Greek letters, symbols, and special functions for mathematical expressions, whether answering on a computer, tablet, or smartphone. Keyboard shortcuts for engineering
Tablet and smartphone users: Tap the answer box for the toolbar to appear beneath it.
For this math format  Type this from your keyboard  On a tablet or smartphone, open the ... 

y3 (subscript)  _ (underbar) 

102  ^  Numeric keyboard to enter ^ 
 /  Letters keyboard to enter / 
2.56 (decimal point)  .  Numeric keyboard to enter . 
( )  ( and )  Numeric keyboard to enter ( and ) 
[ ]  [ and ]  Numeric keyboard to enter [ and ] 
{ }  { and }  Numeric keyboard to enter { and } 
+  +  Numeric keyboard to enter + 
 (minus sign)   (hyphen)  Numeric keyboard to enter  
(multiplication dot)  * (asterisk)  Numeric keyboard to enter * 
(square root)
 \sqrt  Letters keyboard to enter \sqrt 
(nth root)  \nrt  Letters keyboard to enter \nrt 
x (absolute value)    Numeric keyboard to enter  
(vector)  \vec  Letters keyboard to enter \vec 
(unit vector)  \hat  Letters keyboard to enter \hat 
*To enter an expression with multiplication in the numerator: Choose from the Templates menu for the correct format. (You cannot use /.)
For this letter  Enter this from your keyboard OR on a tablet or smartphone, open the Letters keyboard and enter 

a  \alpha 
b  \beta 
g  \gamma 
D, d  \Delta, \delta 
e  \epsilon 
h  \eta 
q  \theta 
k  \kappa 
l  \lambda 
m  \mu 
n  \nu 
p  \pi 
r  \rho 
S, s  \Sigma, \sigma 
t  \tau 
F, f  \phi 
c  \chi 
Y, y  \Psi, \psi 
W, w  \Omega, \omega 
\EMF  
\hbar 
Use radians for arguments of trigonometric functions, unless asked to answer in degrees.
For this special function  Enter this from your keyboard OR on a tablet or smartphone, open the Letters or Numeric keyboard, as needed 

arccosine  acos(x) or cos^1(x) 
arccotangent  acot(x) or cot^1(x) 
arccosecant  ascs(x) or csc^1(x) 
arcsecant  asec(x) or sec^1(x) 
arcsine  asin(x) or sin^1(x) 
arctangent  atan(x) or tan^1(x) 
cosine  cos(x) 
cotangent  cot(x) 
cosecant  csc(x) 
Euler's number (2.71828...)  e^x or exp(x) 
natural logarithm (base e)  ln(x) 
common logarithm (base 10)  log(x) 
secant  sec(x) 
sine  sin(x) 
tangent  tan(x) 
To move the cursor within your answer: On a computer, use your keyboard arrow keys (, , , ). On a mobile device, use your finger or other input device. For finer cursor control on a phone: Enlarge your view of the answer box before moving the cursor.
To view these keyboard shortcuts as you work
Choose Keyboard shortcuts from the answer box toolbar.
To print this Help topic
Choose Print in the upper right of this Help page.
The topic will print as it appears online. To print the complete topic, choose Expand all before printing.
Copyright © 2018Pearson Education, Inc. All Rights Reserved. Pearson Higher Education  End User License Agreement  Privacy Policy  Permissions  Accessibility
More specifically, one way is binary search. Given a range [low, high] in which your square root lies, you can test if the square of (low + high) / 2 is greater than the value you're square rooting or not. If it's greater, then your new range is [low, (low + high)/2], if less, then your new range is [(low + high)/2, high]. Keep narrowing this range in half until the value (low + high)/2 is either <= low or >= high (which it will be, eventually, because you're using doubles.)
You need to pick appropriate starting values of low and high, of course  one choice is 1 and the number you're taking the square root of.
This algorithm is rather slow, requiring about 52 or 64 iterations for reasonable numbers (if you're using the double datatype), but if if the number you're squarerooting is very, very close to zero, it will have to run thousands of iterations before it terminates (because instead of running into the limits of a double's precision, you'll be descending down to lower and lower exponents). Maybe you'd then want to make 0 a special case, tested for at the beginning.
A faster algorithm to find the square root of x is to compute f(f(...(f(f(f(f(1))))...)), where f(y) = (x/y + y)*0.5, and where f is iterated sufficiently many times.
0 thoughts on “Sqrt In C Without Math Homework”