Here is an example of code using Julia Symbolics to create a general functions -
using SymbolicUtils
using Symbolics
x = Symbolics.variable("x")
y = Symbolics.variable("y")
z = Symbolics.variable("z")
@variables F(x),G(x,y)
f = Symbolics.variable("f", T=Symbolics.FnType)(x)
g = Symbolics.variable("g", T=Symbolics.FnType)(x,y)
println(F*G)
println(f*g)
and here is the output -
G(x, y)*F(x)
ERROR: LoadError: ArgumentError: The function * cannot be applied to g(x, y) which is not a Number-like object.Define islike(::Num, ::Type{Number}) = true
to enable this.
Stacktrace:
[1] assert_like(::Function, ::Type, ::Num)
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/EGhOJ/src/methods.jl:43
[2] assert_like(f::Function, T::Type, a::Num, b::Num)
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/EGhOJ/src/methods.jl:45
[3] *(a::Num, b::Num)
@ Symbolics ~/.julia/packages/SymbolicUtils/EGhOJ/src/methods.jl:72
[4] top-level scope
@ ~/Julia/Algebra/test1.jl:16
in expression starting at /home/brombo/Julia/Algebra/test1.jl:16
So that FG does not generate an error but fg does. I do not understand the error message. What am I supposed to do to make this work?