Cody

# Problem 549. root?

Solution 926313

Submitted on 22 Jul 2016 by Stephanie O'Neil
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(abs(rootof(@sin,3)-pi)<100*eps)

x = 4.1000 y = 2.8000 y = 2.7000 y = 2.6000 y = 2.5000 y = 2.4000 y = 2.3000 y = 2.2000 y = 2.1000 y = 2.0000 y = 1.9000 y = 1.8000 y = 1.7000 y = 1.6000 y = 1.5000 y = 1.4000 y = 1.3000 y = 1.2000 y = 1.1000 y = 1.0000 y = 0.9000 y = 0.8000 y = 0.7000 y = 0.6000 y = 0.5000 y = 0.4000 y = 0.3000 y = 0.2000 y = 0.1000 y = -1.5266e-15 ma = 3 mi = 4.1000 root = 3.1416

2   Pass
assert(abs(rootof(@cos,1.5)-pi/2)<100*eps)

y = 1.3000 y = 1.2000 y = 1.1000 y = 1.0000 y = 0.9000 y = 0.8000 y = 0.7000 y = 0.6000 y = 0.5000 y = 0.4000 y = 0.3000 y = 0.2000 y = 0.1000 y = -1.9429e-16 y = -0.1000 y = -0.2000 y = -0.3000 y = -0.4000 y = -0.5000 y = -0.6000 y = -0.7000 y = -0.8000 y = -0.9000 y = -1.0000 y = -1.1000 y = -1.2000 y = -1.3000 y = -1.4000 y = -1.5000 y = -1.6000 ma = 1.5000 mi = 1.6000 root = 1.5708

3   Pass
assert(abs(rootof(@tan,0.05)-0)<100*eps)

x = 1.1500 x = 2.1500 x = -0.0500 ma = 0.0500 mi = -0.0500 root = 0