Skip to content

Examples for error: Should only be one path from root... #108

@thorek1

Description

@thorek1

Hi,

I appreciate the speed of your package but sometimes the package does not provide derivatives (jacobian in my case) while other packages do. This unfortunately prevents me from using it in my work.

Here are two MWEs representative of the issues I encounter:

using FastDifferentiation

𝐗 = make_variables(:𝐗, 31)
𝐘 = make_variables(:𝐘, 9)

eqs = FastDifferentiation.Node[ (((((-((exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30])))) * -(𝐘[1]))) * (1 / 𝐗[11])) * 𝐘[8]) * (𝐗[24] ^ -(𝐘[1]))) * (𝐗[27] ^ 𝐘[1])) * (𝐗[8] * (1 - 𝐘[1])))
            (-(𝐘[8]) * (((exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30])))) * -(𝐘[1])) * ((𝐗[24] ^ (1 - 𝐘[1])) * (𝐗[27] ^ 𝐘[1]))) + (𝐗[27] * -(((1 - 𝐘[7]) * exp(-((𝐘[3] + (𝐘[8] * 𝐗[30])))))))))
            0
            ((-((exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30])))) * -(𝐘[1]))) * 𝐘[8]) * ((𝐗[27] ^ 𝐘[1]) * (𝐗[24] ^ (1 - 𝐘[1])))) ]

jacobian(eqs,𝐘)

sparse_jacobian(eqs,𝐘)

eqs = Node[ (((((-((exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30])))) * -(𝐘[1]))) * (1 / 𝐗[11])) * 𝐘[8]) * (𝐗[24] ^ -(𝐘[1]))) * (𝐗[27] ^ 𝐘[1])) * (𝐗[8] * (1 - 𝐘[1])))
        ((((((-(exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30]))))) * -(𝐘[1])) * (1 / (((𝐗[23] * 𝐗[20]) * 𝐗[3]) * 𝐗[1]))) * 𝐘[8]) * (𝐗[24] ^ (1 - 𝐘[1]))) * (𝐗[27] ^ 𝐘[1])) * ((𝐘[2] * 𝐗[8]) * (1 - 𝐘[1])))
        (-(𝐘[8]) * (((exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30])))) * -(𝐘[1])) * ((𝐗[24] ^ (1 - 𝐘[1])) * (𝐗[27] ^ 𝐘[1]))) + (𝐗[27] * -(((1 - 𝐘[7]) * exp(-((𝐘[3] + (𝐘[8] * 𝐗[30])))))))))
        ((-((exp((-(𝐘[1]) * (𝐘[3] + (𝐘[8] * 𝐗[30])))) * -(𝐘[1]))) * 𝐘[8]) * ((𝐗[27] ^ 𝐘[1]) * (𝐗[24] ^ (1 - 𝐘[1]))))]

jacobian(eqs,𝐘)

sparse_jacobian(eqs,𝐘)

They error with variations of: ERROR: AssertionError: Should only be one path from root ... using FastDifferentiation v0.4.4

I understand you can go equation by equation but that undoes the speed gains from collecting subexpressions.

Any help would be much appreciated.

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