Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
YingboMa committed Mar 1, 2021
1 parent 01cbb3a commit d8ec558
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Symbolics"
uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7"
authors = ["Shashi Gowda <[email protected]>"]
version = "0.1.0"
version = "0.1.1"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -10,6 +10,7 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
Expand Down
1 change: 1 addition & 0 deletions src/Symbolics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ include("diff.jl")

include("linear_algebra.jl")

import Libdl
include("build_function.jl")
export build_function

Expand Down
12 changes: 7 additions & 5 deletions src/linear_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,20 @@ end
# return the coefficient matrix `A` and a
# vector of constants (possibly symbolic) `b` such that
# A \ b will solve the equations for the vars
function A_b(eqs::AbstractArray, vars::AbstractArray)
function A_b(eqs::AbstractArray, vars::AbstractArray, check)
exprs = rhss(eqs) .- lhss(eqs)
for ex in exprs
@assert islinear(ex, vars)
if check
for ex in exprs
@assert islinear(ex, vars)
end
end
A = jacobian(exprs, vars)
b = A * vars - exprs
A, b
end
function A_b(eq, var)
function A_b(eq, var, check)
ex = eq.rhs - eq.lhs
@assert islinear(ex, [var])
check && @assert islinear(ex, [var])
a = expand_derivatives(Differential(var)(ex))
b = a * var - ex
a, b
Expand Down

2 comments on commit d8ec558

@YingboMa
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/31047

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" d8ec5580040a60d12aff89ffc7db474eb07851c4
git push origin v0.1.1

Please sign in to comment.