I'm trying some transformations and they are getting complicated. It's common in physics to replace functions by symbols so you term get shorter.
Lets say I have transformation
xr[A_,B_] := K A + L B + KK A^2 + LL B^2,
A = A[x_] and
B = B[x_]
I want to input some random values of
But for the code to be readable I want to substitute the quadratic part as
H = KK A^2 + LL B^2
How do I go about this? I don't want to define H as a function, since that would make me have to write
xr[A,B] = xr[A,B,H] = xr[A,B,H[A,B]] = xr[A[x],B[x],H[A[x],B[x]]]
which just gets unwieldy.
Essentially I just want to be able to write H such that mathematica would understand that when I define
xr[A,B] := K A + L B + H
Output of sending a
x value to it would be
xr[A[x],B[x]] = K A[x] + L B[x] + KK A[x]^2 + LL B[x]^2.
Hopefully you can understand what I'm trying to do. Thank you for your help.
Edit: This is just an example of function. Of course It wouldn't be useful in this case and I also know there are reasons why this specific type substitution wouldn't be a healthy practice but what are the alternatives.