# What is the code for an arbitrary vector p in a vector function space W_h?

What is the code for an arbitrary vector p in a vector function space W_h?

Given that I have:
all (p,v)∈𝑊_ℎ×𝑉_ℎ
(𝑤_ℎ,𝑢_ℎ)∈𝑊_ℎ×𝑉_ℎ

I need dolfinx code (not dolfin).

As a beginner in FEM, I want to apologize in advance if my question is not clear or if I have left out any necessary information. I deeply appreciate any help or guidance you can provide to help me better understand the subject. If there is any additional information you need from me, please do not hesitate to let me know. Thank you very much.

The detail of the function space:   I have just tried some methods. Is the following code reasonable?

``````# Define the arbitrary vector p (eta)
p = fem.Function(W)
p.vector.setValueLocal(np.random.rand(), np.random.rand())

``````

What do you mean when you say an arbitrary vector?
Do you mean that you have a function in W_h where one (random) degree of freedom has a random value?
Or do you mean a function in W_h where all dofs have random values.

If it’s a function in W_h where all dofs have random values, is the code I posted above correct for getting this vector function?