I want to create a function in Mathematica which accomplishes the following:
$$[f(a,b,c)]^+_- = f(a^+,b^+,c^+)-f(a^-,b^-,c^-)$$
where $f$ is any function (has 3 arguments above but this need not be the case) and $a,b,c$ are arguments (though there may be more). I am dealing with some boundary conditions across interfaces which require me to evaluate "jumps" in discontinuous quantities.
What I would like to do is something that accomplishes the following, returning symbolic variables which can be used later:
- $[\mu]^+_-=\mu^+-\mu^-$
- $\left[\frac{1}{\mu}\right]^+_-=\frac{1}{\mu^+}-\frac{1}{\mu_-}$
- $\left[\frac{ab^2}{\sqrt{c}}\right]^+_-=\frac{a^+{b^+}^2}{\sqrt{c^+}}-\frac{a^-{b^-}^2}{\sqrt{c^-}}$
I want to be able to input any expression inside the brackets (although in this case the expression will be called as an argument to a function) and this expression needs to have an arbitrary number of variables. It would also be highly desirable this could be done entry-wise to a vector whose entries are expressions (themselves each of an arbitrary number of variables).
A bit of research tells me that the Map function might do what I want, but I'm not yet skilled enough in Mathematica to implement it properly. Could somebody point me into the right direction?
I have found something which does what I want but I am having trouble converting it into a function. Think of the subscript $v^+$ and $l$ as taking place of the $+$ and $-$ as above.
Two more things I want to accomplish:
- How can I write this as a function which takes any algebraic expression and returns an analogous result?
- How can I make sure that it is the variable that is subscripted rather than the expression in each case (e.g. I want $\frac{1}{\sqrt{c_{v^+}}}$ not $\frac{1}{\sqrt{c}}_{v^+}$).