Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I specify a function in terms of an integral and then try to evaluate it with Simplify. However, the answer is not really simplified to what it should be.

assumptions := {l > 0, Element[NN, Integers], NN > 0, b > 0, a > 0, 
    l > b, a > l, α > 0, β > 0};

Φ = Function[x, 
    If[x < l, 
       (NN*π*α*b^2 *(l^2 ArcCos[x/l] - x Sqrt[l^2 - x^2]))/(a^2 * β), 0]
    ];
Px = Function[x, If[0 <= x <= a, 1/a, 0]];
FΦ = Function[φ, Simplify[Integrate[If[Φ[x] <= φ, 1, 0] Px[x], {x, 0, a}], 
    assumptions]];
Simplify[FΦ[0], assumptions]

However, it is easy to see that it should be reduced as first

$\frac{1}{a} \int_0^a \text{If}\left[\text{If}\left[x<l,\frac{\text{NN} \pi \alpha b^2 \left(l^2 \text{ArcCos}\left[\frac{x}{l}\right]-x \sqrt{l^2-x^2}\right)}{a^2 \beta },0\right]\leq 0,1,0\right] \, dx$

and then $\frac{1}{a} \int_0^l \text{If}\left[\frac{\text{NN} \pi \alpha b^2 \left(l^2 \text{ArcCos}\left[\frac{x}{l}\right]-x \sqrt{l^2-x^2}\right)}{a^2 \beta }\leq 0,1,0\right] \, dx + \frac{1}{a} \int_l^a \text{If}\left[ 0 \leq 0,1,0\right] \, dx$

to $ \frac{1}{a} \int_0^l 0 \, dx + \frac{1}{a} \int_l^a 1 \, dx$ $=\frac{a-l}{a}$.

How can I get Mathematica to simplify it correctly?

share|improve this question
    
I am not sure if this helps and if I am right. But I think you are wrong in your second line with the first term. The Integration is done after the If. Without any value for x you (and Mathematica) cannot decide if this term is ≤ 0 or not. E.g. if you use NN = 1; b = 2; α = 1; β = 1; l = 5; a = 6; (this should meet your assumptions), then the term ist only 0 for x=5. –  partial81 Mar 20 '12 at 22:04
    
P.S.: If I am right, then you are also wrong in your first line because of the same mistake (you do not have a x, so you do not know if x<l or not). –  partial81 Mar 20 '12 at 22:10
    
@partial81, In assumptions, we know that $a>l>0$, so the integral from $0$ to $a$ can be broken into $0$ to $l$ and $l$ to $a$. Then, $x<l$ for the first part and $x>l$ for the second part. The values you give don't satisfy $a>l$. –  highBandWidth Mar 20 '12 at 22:24
    
$a=6$; $l=5$; $=>$ $a>l$. What is wrong with my example values? –  partial81 Mar 21 '12 at 17:23
add comment

1 Answer 1

Mathematica obviously cannot decide the sign of l^2*ArcCos[x/l] - x*Sqrt[l^2 - x^2]. The rest of your code is fine. For example, just replace the first function by

Function[x, 
 If[x < l, (NN*Pi*α*b^2*(l^2 ArcCos[x/l]))/(a^2*β), 0]] 

(in other words, just get rid of -x*Sqrt[l^2 - x^2]) and everything will work as expected.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.