Skip to content

Newton iteration may fail to converge, producing wrong results in curve.project() #93

Open
@hfutrell

Description

@hfutrell

this is a longstanding issue, here is a unit test demonstrating it:

    func testDegree5RealWorldIssue() {
        // this case may return a non-root because Newton iteration
        // does not converge
        let polynomial = BernsteinPolynomial5(b0: -68686.64586343056,
                                              b1: 102389.02112160496,
                                              b2: -163207.59913132348,
                                              b3: 177077.4933777841,
                                              b4: -108411.70135107233,
                                              b5: 57838.81668210728)
        let roots = findDistinctRootsInUnitInterval(of: polynomial)
        XCTAssertEqual(roots.count, 1)
        XCTAssertEqual(roots[0], 0.44454, accuracy: 1.0e-5)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions