# 2D IntervalRootFinding with parameters

**URL:** https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997
**Category:** New to Julia
**Tags:** roots
**Created:** [November 29, 2022, 2:20pm UTC](https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997 "2022-11-29T14:20:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rodek](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@rodek](https://discourse.julialang.org/u/rodek)
#### Post date: [November 29, 2022, 2:20pm UTC](https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997/1 "2022-11-29T14:20:36Z")

</div>

Hi all, possibly a simple/silly question: how do I pass parameters to the function for which I want to find the set of roots in two (or more dimensions) using IntervalRootFinding? In 1D I can use an anonymous function `roots(x -> f(x,p), X)` where p is a struct I’ve previously defined, and X the interval. In 2D I’ve tried `roots( (x,y) -> f2d( (x,y), p), X×X)`, but get a "MethodError: No method matching.  
Thanks in advance

---

<div class="post-metadata">

### Author: ![josuagrw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josuagrw/32/1015_2.png) [@josuagrw](https://discourse.julialang.org/u/josuagrw)
#### Post date: [November 29, 2022, 2:30pm UTC](https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997/2 "2022-11-29T14:30:35Z")

</div>

Hi, the problem here isnt the parameter its the signature of the anonymous function. Basically, your function gets called with a single argument, not 2 arguments (x and y)

this should work `roots( x -> f2d( (x[1],x[2]), p), X×X)`

see also [Home · IntervalRootFinding.jl](https://juliaintervals.github.io/IntervalRootFinding.jl/latest/#Basic-multi-dimensional-example)

---

<div class="post-metadata">

### Author: ![rodek](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@rodek](https://discourse.julialang.org/u/rodek)
#### Post date: [November 29, 2022, 2:32pm UTC](https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997/3 "2022-11-29T14:32:37Z")

</div>

Answering my own question (writing it out helped thinking). This works: `roots( ((x,y), ) -> f2d( (x,y), p), X×X)`. I would think the extra comma is there so that `(x,y)` is interpreted as a tuple in a tuple with one element. Hope this helps somebody else.  
Thanks again
