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.

Math formats: subscript, exponent, fraction, square root, vector, absolute value, etc.
For this math formatType this from your keyboardOn a tablet or smartphone, open the ...

y3

(subscript)

_
(underbar)


Numeric keyboard to enter _

102
(exponent)

^
Numeric keyboard to enter ^


(fraction)*

/


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 /.)

 

Greek letter symbols, EMF, and hbar
For this letterEnter 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

 

Special functions (acos, acot, ascs, ...)

Use radians for arguments of trigonometric functions, unless asked to answer in degrees.

For this special functionEnter this from your keyboard
OR
on a tablet or smartphone, open the Letters or Numeric keyboard, as needed
arccosineacos(x) or cos^-1(x)
arccotangentacot(x) or cot^-1(x)
arccosecantascs(x) or csc^-1(x)
arcsecantasec(x) or sec^-1(x)
arcsineasin(x) or sin^-1(x)
arctangentatan(x) or tan^-1(x)
cosinecos(x)
cotangentcot(x)
cosecantcsc(x)
Euler's number (2.71828...) e^x or exp(x)
natural logarithm (base e)ln(x)
common logarithm (base 10) log(x)
secantsec(x)
sinesin(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 square-rooting 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

Leave a Reply

Your email address will not be published. Required fields are marked *