Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbolics and the Creation of General Function Not Working #1211

Open
abrombo opened this issue Aug 11, 2024 · 1 comment
Open

Symbolics and the Creation of General Function Not Working #1211

abrombo opened this issue Aug 11, 2024 · 1 comment

Comments

@abrombo
Copy link

abrombo commented Aug 11, 2024

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)

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:14
in expression starting at /home/brombo/Julia/Algebra/test1.jl:14

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?

@ChrisRackauckas
Copy link
Member

@shashi do you know what's going on here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants