# Symbolics and the creation of functions

**URL:** <https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038>\
**Category:** General Usage\
**Tags:** question, package, symbolics\
**Created:** [August 11, 2024, 12:17am UTC](https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038 "2024-08-11T00:17:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [August 11, 2024, 12:17am UTC](https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038/1 "2024-08-11T00:17:40Z")

</div>

Here is an example of code using Julia Symbolics to create a general functions -

```julia
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 F_G does not generate an error but f_g does. I do not understand the error message. What am I supposed to do to make this work?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [August 11, 2024, 8:13am UTC](https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038/2 "2024-08-11T08:13:29Z")

</div>

Can you open an issue? I’d like to get @shashi’s input on this.

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [August 11, 2024, 12:41pm UTC](https://discourse.julialang.org/t/symbolics-and-the-creation-of-functions/118038/4 "2024-08-11T12:41:38Z")

</div>

OK, I went to the Symbolics github site and created an issue.
