Skip to main content
2 of 2
deleted 33 characters in body
Mam Mam
  • 1.9k
  • 3
  • 9

How to correctly specify variables in a function?

There is an expression

(Sqrt[\[Pi]] (a b^2 d^3 + a (b^2 d^3 + 2 a (b + b d^3))) r[1, 1] r[1, 4])/(2 c^2 (b + b d^3)^(3/2)) - ( Sqrt[\[Pi]] (a b^2 d^4 + a (b^2 d^4 + 2 c (b d + b d^3))) r[5, 2] r[ 1, 4])/(2 a^2 (b d + b c^3)^(3/2))

where a, b, c, d, r[1, 1], r[1, 4], r[5, 2] are variables.

I would like to write this expression as a function f where a, b, c, d, r[1, 1], r[1, 4], r[5, 2] are variables. It can be indicated that a, b, c and d are variables as follows f[a_,b_,c_,d_]:= the expression, but how can I specify that r[1, 1], r[1, 4] and r[5, 2] are also variables f[a_,b_,c_,d_,...]:= the expression?

Mam Mam
  • 1.9k
  • 3
  • 9