Cody

# Problem 549. root?

Solution 1978251

Submitted on 16 Oct 2019 by Chul Min Yeum
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)

root = 3.1425 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416 root = 3.1416

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

root = 1.5709 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708 root = 1.5708

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

root = 8.3542e-05 root = 1.3651e-12 root = 4.5503e-21 root = 1.5168e-29 root = 5.0559e-38 root = 1.6853e-46 root = 5.6177e-55 root = 1.8726e-63 root = 6.2419e-72 root = 2.0806e-80 root = 6.9354e-89 root = 2.3118e-97 root = 7.7060e-106 root = 2.5687e-114 root = 8.5622e-123 root = 2.8541e-131 root = 9.5136e-140 root = 3.1712e-148 root = 1.0571e-156 root = 3.5236e-165