# Hey julians. I found this one a little tricky to fix. I have a rosenbrock function

**URL:** <https://discourse.julialang.org/t/hey-julians-i-found-this-one-a-little-tricky-to-fix-i-have-a-rosenbrock-function/57110>\
**Category:** General Usage\
**Created:** [March 14, 2021, 4:20am UTC](https://discourse.julialang.org/t/hey-julians-i-found-this-one-a-little-tricky-to-fix-i-have-a-rosenbrock-function/57110 "2021-03-14T04:20:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [March 14, 2021, 4:20am UTC](https://discourse.julialang.org/t/hey-julians-i-found-this-one-a-little-tricky-to-fix-i-have-a-rosenbrock-function/57110/1 "2021-03-14T04:20:29Z")

</div>

Hey julians. I found this one a little tricky to fix. I have a rosenbrock function that takes 2 values and returns 1 value. So I was trying to run this as a comprehension, but I am getting out a (401,401) array, instead of a (401,1) array. Here is the code.

```julia
x = -2:0.01:2
y = -2:0.01:2
rosenbrock(x,p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
z = [rosenbrock([i, j], p) for i=x, j=y]

```

But I keep getting out a (401,401) array instead of a 401,1 array. Now it makes sense that the comprehension is iterating over the `i` and `j` dimensions, so there are probably repeated entries. But still I was not clear on how to fix this. I tried parenthesis `(i=x, j=y)`.

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1615695597104900?thread_ts=1615695597.104900&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [March 14, 2021, 7:26am UTC](https://discourse.julialang.org/t/hey-julians-i-found-this-one-a-little-tricky-to-fix-i-have-a-rosenbrock-function/57110/2 "2021-03-14T07:26:01Z")

</div>

Is it what you want ?

```julia
z = [rosenbrock([ij...], p) for ij ∈ zip(x,y)]

```
