I am having trouble with Integrating functions that involve If statements.
For example, I can integrate
If [Cos[-y] Sin Sin < 0, -1, 1]
with x over the range -pi to pi and y over the range 0 to pi
However, trying to integrate
If[(Cos[-y] Sin Sin + Cos) < 0, -1, 1]
over the same ranges fails with Mathematica just returning the entered integration command.
Is there any way to have Mathematica integrate functions containing If statements of this nature?
Thanks in anticipation.
If statements are meant for control flow in a program and aren’t meant to be symbolicaly manipulatable parts of the definition of a Mathematical function.
Could you please expand on this:
“If statements” “aren’t meant to be symbolicaly manipulatable parts of the definition of a Mathematical function.”
I think I get into problems with this quite a lot so it would help me to understand better, distinctions with respect to “symbolicaly manipulatable parts”.
I’m not sure I am able to clarify this with words very effectively beyond that statement.
If statements are meant for programming. They are meant to help define a program.
They aren’t meant to be used as a mathematical formalism in the definition of a function. The symbolic mathematical functions in Mathematica don’t handle if statements because If statements aren’t meant to be used in the definition of a mathematica formula. If statements are meant to be used in the definition of a program.