Skip to main content
deleted 10 characters in body
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/\[Sqrt](2 \[Pi]π Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!

Note: The behavior seems to depend on the Mathematica version. The code above works in 10.1, but behaves differently in 9.x and 8.x (see comments).

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/\[Sqrt](2 \[Pi] Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!

Note: The behavior seems to depend on the Mathematica version. The code above works in 10.1, but behaves differently in 9.x and 8.x (see comments).

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/(2 π Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!

Note: The behavior seems to depend on the Mathematica version. The code above works in 10.1, but behaves differently in 9.x and 8.x (see comments).

Update.
Source Link
Jinxed
  • 3.8k
  • 10
  • 24

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/\[Sqrt](2 \[Pi] Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!

Note: The behavior seems to depend on the Mathematica version. The code above works in 10.1, but behaves differently in 9.x and 8.x (see comments).

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/\[Sqrt](2 \[Pi] Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/\[Sqrt](2 \[Pi] Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!

Note: The behavior seems to depend on the Mathematica version. The code above works in 10.1, but behaves differently in 9.x and 8.x (see comments).

Source Link
Jinxed
  • 3.8k
  • 10
  • 24

Patterned assumptions seem to need to match the ConditionalExpression's condition exactly to work out for some cases.

The ∈ Reals-assumptions do work as you gave them, while the inequality Subscript[s,_]>0 does not, but observe the different behavior of Subscript[s,_]>=0:

Evaluating without any assumptions first:

f = 1/\[Sqrt](2 \[Pi] Subscript[s, 
   i]) Exp[-((x - Subscript[m, i])^2/(2 Subscript[s, i]))]
expr=Integrate[f, {x, -∞, ∞}]
(* ConditionalExpression[1, Re[Subscript[s, i]] >= 0] *) 

(Note, that the assumptions about h, k and m have no effect and are therefore superfluous.)

Now, bringing in the patterned assumptions in two versions:

greaterOnly = And @@ {Subscript[s, _] > 0, Element[Subscript[s, _], Reals]}
greaterEqual = And @@ {Subscript[s, _] >= 0, Element[Subscript[s, _], Reals]}

Refine[expr,greaterOnly]
(* ConditionalExpression[1, Subscript[s, i] >= 0] *) 
Refine[expr,greaterEqual]
(* 1 *)

So, the Element-part of assumptions is used in any case, while the inequality requires a "perfect" match.

Hope this helped!