# Registering functions with several arguments in Symbolics

**URL:** <https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359>\
**Category:** General Usage\
**Tags:** symbolics, symbolic-utils, register\
**Created:** [March 20, 2023, 7:01pm UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359 "2023-03-20T19:01:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PABLO\_ESTEBAN\_MONTES](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablo_esteban_montes/32/47666_2.png) [@PABLO\_ESTEBAN\_MONTES](https://discourse.julialang.org/u/PABLO_ESTEBAN_MONTES)\
**Post date:** [March 20, 2023, 7:01pm UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359/1 "2023-03-20T19:01:01Z")

</div>

Hello  
I have an issue of scalability with registering functions in Julia. I need to register a function of several variables in order to be able to define derivatives of that function, so that Symbolics can stop tracing when arriving at that function. My issue is that registering a function creates a lot of methods for the function whose purpose I don’t really understand. As an example, imagine I register the following function

```julia
using Symbolics

@register_symbolics f(x::Num, y::Num)

```

If I now run `methods(f)`, it will return something like

```julia
f(arg1::SymbolicUtils.Symbolic{<:Num}, arg2::SymbolicUtils.Symbolic{<:Num}) 
f(arg1::Num, arg2::SymbolicUtils.Symbolic{<:Num}) 
f(arg1::SymbolicUtils.Symbolic{<:Num}, arg2::Num)
f(arg1::Num, arg2::Num)

```

So, `f` has 2^2=4 methods, because it needs to cover all the possible combinations of arguments of type `Num` and of type `SymbolicUtils.Symbolic{<:Num}`. I don’t really understand what those methods are for, or what `SymbolicUtils.Symbolic{<:Num}` means. My biggest issue however is that I need to work with a function that receives at least 13 arguments, and I want to define 13 partial derivatives, and this becomes impossible because when registering the function, SymbolicUtils tries (and obviously fails) at defining 2^13 = 8192 methods.

My question then is, is there a way of registering functions with several numbers of arguments?, or does it just become exponentially more expensive?. I’ve tried with vectors (which would be ideal for me), but differentiation with respect to expressions involving arrays is apparently not yet supported. My only chance seems to be to just registering a function with several arguments, but as I’ve shown that is impossible in my case.

---

<div class="post-metadata">

**Author:** ![ehintz3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ehintz3/32/207755_2.png) [@ehintz3](https://discourse.julialang.org/u/ehintz3)\
**Post date:** [May 10, 2024, 5:27am UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359/2 "2024-05-10T05:27:03Z")

</div>

I am experiencing the same issue with a function I am trying to register with 14 arguments. Have you found a solution?

---

<div class="post-metadata">

**Author:** ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Post date:** [December 12, 2024, 9:43pm UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359/3 "2024-12-12T21:43:28Z")

</div>

Has this ever got answered? Thx.

---

<div class="post-metadata">

**Author:** ![anguille](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@anguille](https://discourse.julialang.org/u/anguille)\
**Post date:** [February 27, 2025, 1:43pm UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359/4 "2025-02-27T13:43:48Z")

</div>

My tentative to overcome this limitation: [Feature: give the opportunity to explicitly pass the list of arguments to register by pitx-perf · Pull Request #1455 · JuliaSymbolics/Symbolics.jl · GitHub](https://github.com/JuliaSymbolics/Symbolics.jl/pull/1455)

---

<div class="post-metadata">

**Author:** ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Post date:** [February 27, 2025, 10:34pm UTC](https://discourse.julialang.org/t/registering-functions-with-several-arguments-in-symbolics/96359/5 "2025-02-27T22:34:13Z")

</div>

for a workaround, you could define something like this:

```julia
function f_impl(x1,x2,x3,x4,y5,y6,y7,y8,y9)
  return sum(x1,x2,x3,x4,y5,y6,y7,y8,y9)
end

function f(x1,x2,x3,x4,y)
  return f_impl(x1,x2,x3,x4,y[1],y[2],y[3],y[4],y[5])
end

@register_symbolic f(x1,x2,x3,x4,y::Tuple)

```
