# Multiplication of certain terms in a sum within a vector

Is there any way to multiply certain terms within a vector with a constant? e.g. assume that I start with a vector

{f[4] - g[-1] , h[2] , 2 * g[2] + h[-1]}

where f[ i ], g[ i ], h[ i ] are functions that I'd like to keep in their general form. I would like to multiply every function that is evaluated at a negative number with a constant c. The above example would then look like

{f[4] - c * g[-1] , h[2] , 2 * g[2] + c * h[-1]}

• Clear["*"]; {f[4] - g[-1], h[2], 2*g[-2] + h[1]} /. g[x_] -> c*g[x] Sep 28, 2020 at 0:56
• Maybe I should've made clear in my example that any function at a negative position is supposed to get the pre-factor of c, not only the g[]'s. I edited my example. Sep 28, 2020 at 1:01
• {f[4] - g[-1], h[2], 2*g[2] + h[-1]} /. y_[x_ /; x < 0] -> c*y[x] Sep 28, 2020 at 1:08

{f[4] - g[-1], h[2], 2*g[2] + h[-1]} /. y_[x_ /; x < 0] -> c*y[x]

• {f[4] - g[-1], h[2], 2*g[2] + h[-1]} /. y_[x_?(# < 0 &)] :> c*y[x] Sep 29, 2020 at 0:19
{f[4] - g[-1], h[2], 2 g[2] + h[-2], g[2] + h[-z]} /.

 {f[4] - c g[-1], h[2], 2 g[2] + c h[-2], g[2] + c h[-z]}