If the subscripts are just a naming convention for your arguments, then you’re better off just using x1 and x2:
V[x1_, x2_] := 5 x1^2 + 2 x1 x2 + x2^2
If you’re using subscripts to index into an array/matrix structure or for some other semantic, then we need more information about your context to be able to provide guidance.
Thank you for your answer. Actually, this is just a naming convention for the arguments of the function and it is to mimic equations given in textbooks. It should be interesting to get to it though.
Well, you won’t get it to work, unless I’m entirely misunderstanding your question. If you want to use Pattern to name the arguments to your function definition, then you need to use symbols for the name. Thus you can’t name your patterns with things like Subscript[x,1].
I am back to the problem I submitted 8 months ago.
I think I found a solution. Please, take a look at the file attached.
By the way I am using Mathematica 13.3.
x\[UnderBracket]Subscript\[UnderBracket]1 and Subscript[x, 1] are different objects but look exaclty the same in the FronEnd. You must be careful when composing your formulas.