-
Notifications
You must be signed in to change notification settings - Fork 179
Description
It would be helpful if the assertions in functions like
check_expr_validity said what type of expr they don't like.
[0, 0, 0] ~ Any[(-ifelse(((0//1) <= p2) & (p2 < (1//8)), d1 + c1*p2 + b1*(p2^2) + a1*(p2^3), ifelse(((1//8) <= p2) & (p2 < (1//4)), d2 + c2*p2 + b2*(p2^2) + a2*(p2^3), ifelse(((1//4) <= p2) & (p2 < (3//8)), d3 + c3*p2 + b3*(p2^2) + a3*(p2^3), ifelse(((3//8) <= p2) & (p2 < (1//2)), d4 + c4*p2 + b4*(p2^2) + a4*(p2^3), ifelse(((1//2) <= p2) & (p2 < (5//8)), d5 + c5*p2 + b5*(p2^2) + a5*(p2^3), ifelse(((5//8) <= p2) & (p2 < (3//4)), d6 + c6*p2 + b6*(p2^2) + a6*(p2^3), ifelse(((3//4) <= p2) & (p2 < (7//8)), d7 + c7*p2 + b7*(p2^2) + a7*(p2^3), d8 + c8*p2 + b8*(p2^2) + a8*(p2^3)))))))) + ifelse(((0//1) <= p1) & (p1 < (1//8)), d1 + c1*p1 + b1*(p1^2) + a1*(p1^3), ifelse(((1//8) <= p1) & (p1 < (1//4)), d2 + c2*p1 + b2*(p1^2) + a2*(p1^3), ifelse(((1//4) <= p1) & (p1 < (3//8)), d3 + c3*p1 + b3*(p1^2) + a3*(p1^3), ifelse(((3//8) <= p1) & (p1 < (1//2)), d4 + c4*p1 + b4*(p1^2) + a4*(p1^3), ifelse(((1//2) <= p1) & (p1 < (5//8)), d5 + c5*p1 + b5*(p1^2) + a5*(p1^3), ifelse(((5//8) <= p1) & (p1 < (3//4)), d6 + c6*p1 + b6*(p1^2) + a6*(p1^3), ifelse(((3//4) <= p1) & (p1 < (7//8)), d7 + c7*p1 + b7*(p1^2) + a7*(p1^3), d8 + c8*p1 + b8*(p1^2) + a8*(p1^3))))))))) / (p1 - p2), (-ifelse(((0//1) <= p2) & (p2 < (1//8)), d1 + c1*p2 + b1*(p2^2) + a1*(p2^3), ifelse(((1//8) <= p2) & (p2 < (1//4)), d2 + c2*p2 + b2*(p2^2) + a2*(p2^3), ifelse(((1//4) <= p2) & (p2 < (3//8)), d3 + c3*p2 + b3*(p2^2) + a3*(p2^3), ifelse(((3//8) <= p2) & (p2 < (1//2)), d4 + c4*p2 + b4*(p2^2) + a4*(p2^3), ifelse(((1//2) <= p2) & (p2 < (5//8)), d5 + c5*p2 + b5*(p2^2) + a5*(p2^3), ifelse(((5//8) <= p2) & (p2 < (3//4)), d6 + c6*p2 + b6*(p2^2) + a6*(p2^3), ifelse(((3//4) <= p2) & (p2 < (7//8)), d7 + c7*p2 + b7*(p2^2) + a7*(p2^3), d8 + c8*p2 + b8*(p2^2) + a8*(p2^3)))))))) + ifelse(((0//1) <= p1) & (p1 < (1//8)), d1 + c1*p1 + b1*(p1^2) + a1*(p1^3), ifelse(((1//8) <= p1) & (p1 < (1//4)), d2 + c2*p1 + b2*(p1^2) + a2*(p1^3), ifelse(((1//4) <= p1) & (p1 < (3//8)), d3 + c3*p1 + b3*(p1^2) + a3*(p1^3), ifelse(((3//8) <= p1) & (p1 < (1//2)), d4 + c4*p1 + b4*(p1^2) + a4*(p1^3), ifelse(((1//2) <= p1) & (p1 < (5//8)), d5 + c5*p1 + b5*(p1^2) + a5*(p1^3), ifelse(((5//8) <= p1) & (p1 < (3//4)), d6 + c6*p1 + b6*(p1^2) + a6*(p1^3), ifelse(((3//4) <= p1) & (p1 < (7//8)), d7 + c7*p1 + b7*(p1^2) + a7*(p1^3), d8 + c8*p1 + b8*(p1^2) + a8*(p1^3))))))))) / (p1 - p2), 0]
Equation
ERROR: AssertionError: Invalid input
Stacktrace:
[1] check_expr_validity(expr::Vector{Any})
@ Symbolics ~/.julia/packages/Symbolics/T2Tbs/src/solver/solve_helpers.jl:94
[2] symbolic_solve(expr::Equation, x::Vector{Num}; dropmultiplicity::Bool, warns::Bool)
@ Symbolics ~/.julia/packages/Symbolics/T2Tbs/src/solver/main.jl:161
[3] symbolic_solve(expr::Equation, x::Vector{Num})
@ Symbolics ~/.julia/packages/Symbolics/T2Tbs/src/solver/main.jl:145
[4] find_crossings(projection::Symbolics.Arr{Num, 1})
@ Main ~/.julia/dev/Tangle/src/symbolic_cubic_splines.jl:235
[5] top-level scope
@ none:1
What I'm passing to symbolic_solve is an Equation.
check_expr_validityis called fromSymbolics/T2Tbs/src/solver/main.jl:161in the case whereexpris aVector`.
Is there a way that expr can be a subtype of both Vector and
Equation? If not, I don't see what the consequent of this
conditional is meant to accomplish:
if !(expr isa Vector)
expr_univar = true
expr = expr isa Equation ? expr.lhs - expr.rhs : expr
check_expr_validity(expr)
isequal(expr, 0) && return []
else
My equation is quite complicated. I'm trying to find the
"crossings" of a knot. The knot is represented by a parametric
function in 3-space. The x, y and z components of the function
have nested ifelse expressions, one for each "segment" of the
knot. Each "segment" is a cubic spline defined by two control
points and the constraints imposed by neighboring splines.
To find the "crossings", the function is
projected onto a place. I get the error while trying to find
two values which give the same result for the projection.
My code is in https://github.com/MarkNahabedian/Tangle.jl.git.
In Tangle/src/symbolic_cubic_splines.jl, the function
find_crossings is getting the error.
find_crossings(one_crossing_projection)
That said, Symbolics is pretty cool. I'm amazed I got this far.