[ANN] Symbolics.jl: A Modern Computer Algebra System for a Modern Language

Hi, thanks for this great comment!

Your first example is possible with the kind of symbolic arrays we are working on: https://github.com/JuliaSymbolics/SymbolicUtils.jl/pull/123

It does a best-effort shape propagation, but you can leave out the shape if you don’t have it.

So your example could be simply encoded by something like

@variables x::Vector

maximize(sum(1//2 .* log.(x)), st=sum(x) == I)

Where log.(x) just returns a symbolic broadcasted term.

The second one:

differentiate(1//2 .* log.(x), x)

This would require adding rules for differentiating broadcast. This is tricky but possible!

Also we could easily make

@variables n::Int x[1:n]

Work so that you can have arrays that share dimension and match them when possible…

10 Likes