Hi , I want to use Symbolics.jl to solve bo
and b1
from 2 equations
b0 + b1 * x1 = y1
b0 + b1 * x2 = y2
I know in SymPy.jl it would be
using SymPy
@syms x[1:2] y[1:2] b[0:1]
eqns = [one.(x) x] * b .~ y
solve(eqns, b)
now i can build this
using Symbolics, Groebner, Nemo, LinearAlgebra
@variables x[1:2] y[1:2] b b0
eqs = [b0 + b * x[1] ~ y[1]
b0 + b * x[2] ~ y[2] ]
symbolic_solve(eqs, [b, b0])
Is it possible to build it with only 1 equation eqns = [one.(x) x] * b .~ y
as in SymPy.jl ?
I tried
@variables x[1:2] y[1:2] b[0:1]
eqs = [b[0] + b[1] * x[1] ~ y[1]
b[0] + b[1] * x[2] ~ y[2] ]
symbolic_solve(eqs, b)
Warning: Solve can not solve this input currently
@variables x[1:2] y[1:2] b[0:1]
eqs = [ones(length(x)) x] * b .~ y
ERROR: DimensionMismatch: expected axes(b, 1) = Base.OneTo(2)
b = Symbolics.variables(:b, 0:1)
x = Symbolics.variables(:x, 1:2)
y = Symbolics.variables(:y, 1:2)
eqs = [[ones(length(x)) x] * b .~ y]
symbolic_solve(eqs, b)
ERROR: AssertionError: Invalid input
@variables x, y, b
p = [ones(length(x)) x] * b .~ y
f = build_function(eqs, [x, y, b], expression = Val{false})
symbolic_solve(f, b)
ERROR: AssertionError: Invalid input
How could I do it?