# UFL index notation

**URL:** https://fenicsproject.discourse.group/t/ufl-index-notation/5006
**Category:** Uncategorized
**Created:** [January 29, 2021, 9:51pm UTC](https://fenicsproject.discourse.group/t/ufl-index-notation/5006 "2021-01-29T21:51:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![VKTR](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/vktr/32/2119_2.png) [@VKTR](https://fenicsproject.discourse.group/u/VKTR)
#### Post date: [January 29, 2021, 9:51pm UTC](https://fenicsproject.discourse.group/t/ufl-index-notation/5006/1 "2021-01-29T21:51:11Z")

</div>

Hi,  
I think I’m understanding something wrong here. The following code doesn’t work.

```
from dolfin import *
from ufl import indices

mesh = UnitSquareMesh(5,5)
V = VectorFunctionSpace(mesh, 'CG',1)

A = Constant(((1,2), (3,4)))
x = Constant((5,6))

i,j = indices(2)

u = A[i,j]*x[i]
v = project(u, V)

```

It says that the shape of u is (). I would expect the shape to be (2,).

---

<div class="post-metadata">

### Author: ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)
#### Post date: [January 29, 2021, 10:30pm UTC](https://fenicsproject.discourse.group/t/ufl-index-notation/5006/2 "2021-01-29T22:30:36Z")

</div>

Try the following:

```auto
from dolfin import *
from ufl import indices

mesh = UnitSquareMesh(5,5)
V = VectorFunctionSpace(mesh, 'CG',1)

A = Constant(((1,2), (3,4)))
x = Constant((5,6))

i,j = indices(2)

u = as_vector(A[i,j]*x[i], (j))
v = project(u, V)

```
