Mathematica Returning Conditional Expression

In summary, the conversation is about attempting to do a simple volume integral using Mathematica. However, the output is in the form of a conditional expression and the question is how to specify that only real numbers are of concern. The solution is to use the "Assumptions" option in the Integrate function.
  • #1
davidallen353
1
0
I am attempting to do a simple volume integral over a particular shape. However Mathematica will not simply return an answer. For my input

Code:
Volume = Integrate[
   Integrate[Integrate[1, {z, 0, c}], {y, 0, b}], {x, 0, a}] + 
  Integrate[
   Integrate[Integrate[1, {z, c, c + a}], {y, b/2, b - \[Rho]}], {x, 
    0, a}] + 
  Integrate[
   Integrate[
    Integrate[
     1, {z, c, a + c - Sqrt[-b^2 + 2 b*y - y^2 + \[Rho]^2]}], {y, 
     b - \[Rho], b}], {x, 0, a}]

It returns

Code:
ConditionalExpression[
 a b c + a^2 (b/2 - \[Rho]) + 
  a (a \[Rho] - 
     1/4 \[Pi] \[Rho] Sqrt[\[Rho]^2]), ((Im[\[Rho]] >= 0 && 
      Im[b] Re[\[Rho]] <= Im[\[Rho]] Re[b]) || (Im[b] Re[\[Rho]] >= 
       Im[\[Rho]] Re[b] && Im[\[Rho]] <= 0)) && 
  Re[\[Rho] Im[b] - b Im[\[Rho]]]^2/Re[\[Rho]]^2 <= 1]

The answer it actually returns is correct, so my question is how do I tell Mathematica that I am only concerned with Real numbers. I am using Mathematica 8
 
Physics news on Phys.org
  • #2
Assumptions is an option you can supply to Integrate
 

1. What is a conditional expression in Mathematica?

A conditional expression in Mathematica is a mathematical statement that is evaluated based on certain conditions or criteria. It can take the form of an if-then statement, where a certain action is performed if a condition is met, or a piecewise function, which evaluates different expressions depending on the value of the input. These expressions are useful for representing mathematical relationships and making decisions in programming.

2. How do I create a conditional expression in Mathematica?

To create a conditional expression in Mathematica, you can use the If[condition, value1, value2] function for a simple if-then statement, or the Piecewise[{{value1, condition1}, {value2, condition2}, ...}] function for a piecewise function with multiple conditions and corresponding values. You can also use logical operators like And and Or to combine conditions.

3. Can I use conditional expressions in mathematical operations in Mathematica?

Yes, conditional expressions can be used in mathematical operations in Mathematica. For example, you can add two conditional expressions together using the Plus function, and the resulting expression will also be conditional. This allows for more complex mathematical calculations based on different conditions.

4. How do I simplify a conditional expression in Mathematica?

To simplify a conditional expression in Mathematica, you can use the Simplify or FullSimplify functions. These will automatically simplify the expression by applying mathematical rules and simplifying each condition separately. You can also use the Assuming function to specify assumptions about variables in the expression, which can lead to further simplification.

5. Can I use conditional expressions in plotting functions in Mathematica?

Yes, conditional expressions can be used in plotting functions in Mathematica. For example, you can use a conditional expression as the PlotRange option in the Plot function to specify different ranges for different conditions. You can also use conditional expressions to define the ColorFunction or OpacityFunction in a plot, which will change the color or opacity of points based on their values.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Replies
3
Views
315
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
117
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • Advanced Physics Homework Help
Replies
6
Views
612
  • Special and General Relativity
Replies
19
Views
283
Back
Top