0
$\begingroup$

In my opinion Mathematica should be able to further calculate and simplify the output of G1[...].

g[z_, A_, e_, b_] := 
 Assuming[A > b/2 && z \[Element] Reals && A \[Element] Reals && 
   b > 0 && e >= 0 && b \[Element] Reals && e \[Element] Reals && 
   z > A - b/2 + e && z < A + b/2 + e, 
  PDF[UniformDistribution[{A + e - b/2, A + e + b/2}], z]]
G[z_, A_, e_, b_] := 
 Assuming[A > b/2 && z \[Element] Reals && A \[Element] Reals && 
   b > 0 && e >= 0 && b \[Element] Reals && e \[Element] Reals && 
   z > A - b/2 + e && z < A + b/2 + e, 
  CDF[UniformDistribution[{A + e - b/2, A + e + b/2}], z]]

  H10[A_, b_, y_, s_] := 
     Assuming[A > b/2 && y ∈ Reals && A ∈ Reals && 
        b > 0 && b ∈ Reals && y < A + 1 + b/2 && 
        y > A - b/2 + 1 && s > A - b/2 && s < A + b/2,
       G[s, A, 0, b]/G[y, A, 1, b]] // FullSimplify

  H11[A_, b_, y_, s_] := 
     Assuming[A > b/2 && y ∈ Reals && A ∈ Reals && 
        b > 0 && b ∈ Reals && y > A + 1 - b/2 && 
        y < A + 1 + b/2 && s > A + 1 - b/2 && s < A + 1 + b/2,
       G[s, A, 1, b]/G[y, A, 1, b]] // FullSimplify

  G1[A_, b_, y_, p0h_, p0l_, c1_] = 
     Assuming[A > b/2 && y ∈ Reals && A ∈ Reals && 
        b > 0 && f ∈ Reals && e ∈ Reals && 
        b ∈ Reals && y > A + 1 - b/2 && y < A + 1 + b/2, 
       Integrate[g[y, A, 1, b]*1/2 (
           p0h*
             Integrate[H10[A, b, y, s], {s, A + 0 - b/2, y}] + (1 - p0h)*
             Integrate[H11[A, b, y, s], {s, A + 1 - b/2, y}] +
            p0l*
             Integrate[H10[A, b, y, s], {s, A + 0 - b/2, y}] + (1 - p0l)*
             Integrate[H11[A, b, y, s], {s, A + 1 - b/2, y}]), {y, 
          A + 1 - b/2, A + 1 + b/2}] - c1] // FullSimplify

enter image description here

I think I clearly told Mathematica in G1[...] that A<b/2 && b>0, but somehow it did not use it in FullSimplify.

In my opinion Mathematica should give me a closed form expression without any cases inside.

Did I misuse Assuming or am I missing something else?

$\endgroup$
  • 3
    $\begingroup$ Take a look at what you are trying to simplify: G[s, A, 0, b]/G[y, A, 1, b]. This term is a ratio of two piecewise functions, one is a function of s and one a function of y. What possible simplification is there? $\endgroup$ – bill s Jul 7 at 21:17
  • 3
    $\begingroup$ Note that Assuming[a, e] affects only the evaluation of e if e contains a function that applies $Assumptions. However, H10, H11, and G1 are of the form Assuming[a, e] // FullSimplify, so the assumptions a will not be applied by FullSimplify; the assumptions in H10 and H11 will be applied in G1 by Integrate and FullSimplify (although the assumptions in G1 will be applied by Integrate only. It's not clear just from reading the question if this is what you want or not -- that is, which assumptions you think are being ignored. PiecewiseExpand might help. $\endgroup$ – Michael E2 Jul 7 at 21:54
  • 1
    $\begingroup$ @bills The first piecewise function should reduce to simply 1/b. PiecewiseExpand will do this, if given the appropriate assumptions. $\endgroup$ – Michael E2 Jul 8 at 0:32
  • $\begingroup$ Thx, Michael. I updated my question and I hope it is more clear, now. $\endgroup$ – user34047 Jul 8 at 13:33
  • $\begingroup$ Welcome! To make the most of Mma.SE start by taking the tour now. It always help us to help you when you write an excellent question. Edit if improvable, show due diligence, pay attention to the comments, you still have FullSimplify outside Assuming! Doesn't that solves your problem? As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. Why not choosing a meaningful username? $\endgroup$ – rhermans Jul 8 at 14:06
3
$\begingroup$

As pointed out by @Michael E2, you must use Assuming[a, FullSimplify[b]] and not FullSimplify[Assuming[a, b]] if you want FullSimplify to use the assumptions.

g[z_, A_, e_, b_] := 
 PDF[UniformDistribution[{A + e - b/2, A + e + b/2}], z];
G[z_, A_, e_, b_] := 
 CDF[UniformDistribution[{A + e - b/2, A + e + b/2}], z];

H10[A_, b_, y_, s_] := Assuming[
  A > b/2 && y ∈ Reals && A ∈ Reals && b > 0 && b ∈ Reals && y < A + 1 + b/2 && y > A - b/2 + 1 && s > A - b/2 && s < A + b/2,
  FullSimplify[G[s, A, 0, b]/G[y, A, 1, b]]
  ]

H11[A_, b_, y_, s_] := Assuming[
 A > b/2 && y ∈ Reals && A ∈ Reals && b > 0 && b ∈ Reals && y > A + 1 - b/2 && y < A + 1 + b/2 && s > A + 1 - b/2 && s < A + 1 + b/2,
  FullSimplify[
   G[s, A, 1, b]/G[y, A, 1, b]]
  ]

Assuming[A > b/2 && y ∈ Reals && A ∈ Reals && b > 0 && f ∈ Reals && e ∈ Reals && b ∈ Reals && y > A + 1 - b/2 && y < A + 1 + b/2,
  FullSimplify[
   Integrate[
     g[y, A, 1, b]*1/
       2 (p0h*
         Integrate[H10[A, b, y, s], {s, A + 0 - b/2, y}] + (1 - p0h)*
         Integrate[H11[A, b, y, s], {s, A + 1 - b/2, y}] + 
        p0l*Integrate[
          H10[A, b, y, s], {s, A + 0 - b/2, y}] + (1 - p0l)*
         Integrate[H11[A, b, y, s], {s, A + 1 - b/2, y}]), {y, 
      A + 1 - b/2, A + 1 + b/2}] - c1]
  ]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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