Skip to main content
edited tags
Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
added 317 characters in body
Source Link

From previous threads I have read on the subject, it seems that Mathematica is known to simplify expressions to varying degrees depending on alphabetical order of chosen variable names. But none of the threads reported functionally different answers. In my case, when using a variable name alphabetically before the integration variable "r", the resulting expression is only defined on part of the domain!

Version info: "11.1.1 for Microsoft Windows (64-bit) (April 18, 2017)"

Is this a bug, or am I missing somthing?

Code starts with global assumptions:

$Assumptions = d > 0 && s > 0 && q > 0

Option 1

Integrate[(r^2*Sin[\[Theta]])/(r^2 + q^2 + 2*r*q*Cos[\[Theta]]),
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

ConditionalExpression[(2*q*(d - q*ArcTanh[q/d]) - d^2*Log[-1 + (2*d)/(d + q)])/(2*q), d >= q]

vs Option 2

Integrate[(r^2*Sin[\[Theta]])/(r^2 + s^2 + 2*r*s*Cos[\[Theta]]), 
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

d + ((d^2 - s^2)*Log[(d + s)^2/(d - s)^2])/(4*s)

Edit: Nasser's answer below solves the problem of discrepancy. But I think MMA should provide another answer for the rest of the domain (d<s or d<w). The plot in the attached image can illustrate.

Plot showing function for the left out domain

From previous threads I have read on the subject, it seems that Mathematica is known to simplify expressions to varying degrees depending on alphabetical order of chosen variable names. But none of the threads reported functionally different answers. In my case, when using a variable name alphabetically before the integration variable "r", the resulting expression is only defined on part of the domain!

Version info: "11.1.1 for Microsoft Windows (64-bit) (April 18, 2017)"

Is this a bug, or am I missing somthing?

Code starts with global assumptions:

$Assumptions = d > 0 && s > 0 && q > 0

Option 1

Integrate[(r^2*Sin[\[Theta]])/(r^2 + q^2 + 2*r*q*Cos[\[Theta]]),
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

ConditionalExpression[(2*q*(d - q*ArcTanh[q/d]) - d^2*Log[-1 + (2*d)/(d + q)])/(2*q), d >= q]

vs Option 2

Integrate[(r^2*Sin[\[Theta]])/(r^2 + s^2 + 2*r*s*Cos[\[Theta]]), 
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

d + ((d^2 - s^2)*Log[(d + s)^2/(d - s)^2])/(4*s)

From previous threads I have read on the subject, it seems that Mathematica is known to simplify expressions to varying degrees depending on alphabetical order of chosen variable names. But none of the threads reported functionally different answers. In my case, when using a variable name alphabetically before the integration variable "r", the resulting expression is only defined on part of the domain!

Version info: "11.1.1 for Microsoft Windows (64-bit) (April 18, 2017)"

Is this a bug, or am I missing somthing?

Code starts with global assumptions:

$Assumptions = d > 0 && s > 0 && q > 0

Option 1

Integrate[(r^2*Sin[\[Theta]])/(r^2 + q^2 + 2*r*q*Cos[\[Theta]]),
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

ConditionalExpression[(2*q*(d - q*ArcTanh[q/d]) - d^2*Log[-1 + (2*d)/(d + q)])/(2*q), d >= q]

vs Option 2

Integrate[(r^2*Sin[\[Theta]])/(r^2 + s^2 + 2*r*s*Cos[\[Theta]]), 
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

d + ((d^2 - s^2)*Log[(d + s)^2/(d - s)^2])/(4*s)

Edit: Nasser's answer below solves the problem of discrepancy. But I think MMA should provide another answer for the rest of the domain (d<s or d<w). The plot in the attached image can illustrate.

Plot showing function for the left out domain

added version info
Source Link

From previous threads I have read on the subject, it seems that Mathematica is known to simplify expressions to varying degrees depending on alphabetical order of chosen variable names. But none of the threads reported functionally different answers. In my case, when using a variable name alphabetically before the integration variable "r", the resulting expression is only defined on part of the domain!

Version info: "11.1.1 for Microsoft Windows (64-bit) (April 18, 2017)"

Is this a bug, or am I missing somthing?

Code starts with global assumptions:

$Assumptions = d > 0 && s > 0 && q > 0

** Option 1**Option 1

Integrate[(r^2*Sin[\[Theta]])/(r^2 + q^2 + 2*r*q*Cos[\[Theta]]),
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

ConditionalExpression[(2*q*(d - q*ArcTanh[q/d]) - d^2*Log[-1 + (2*d)/(d + q)])/(2*q), d >= q]

vs ** Option 2 **Option 2

Integrate[(r^2*Sin[\[Theta]])/(r^2 + s^2 + 2*r*s*Cos[\[Theta]]), 
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

d + ((d^2 - s^2)*Log[(d + s)^2/(d - s)^2])/(4*s)

From previous threads I have read on the subject, it seems that Mathematica is known to simplify expressions to varying degrees depending on alphabetical order of chosen variable names. But none of the threads reported functionally different answers. In my case, when using a variable name alphabetically before the integration variable "r", the resulting expression is only defined on part of the domain!

Is this a bug, or am I missing somthing?

Code starts with global assumptions:

$Assumptions = d > 0 && s > 0 && q > 0

** Option 1**

Integrate[(r^2*Sin[\[Theta]])/(r^2 + q^2 + 2*r*q*Cos[\[Theta]]),
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

ConditionalExpression[(2*q*(d - q*ArcTanh[q/d]) - d^2*Log[-1 + (2*d)/(d + q)])/(2*q), d >= q]

vs ** Option 2 **

Integrate[(r^2*Sin[\[Theta]])/(r^2 + s^2 + 2*r*s*Cos[\[Theta]]), 
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

d + ((d^2 - s^2)*Log[(d + s)^2/(d - s)^2])/(4*s)

From previous threads I have read on the subject, it seems that Mathematica is known to simplify expressions to varying degrees depending on alphabetical order of chosen variable names. But none of the threads reported functionally different answers. In my case, when using a variable name alphabetically before the integration variable "r", the resulting expression is only defined on part of the domain!

Version info: "11.1.1 for Microsoft Windows (64-bit) (April 18, 2017)"

Is this a bug, or am I missing somthing?

Code starts with global assumptions:

$Assumptions = d > 0 && s > 0 && q > 0

Option 1

Integrate[(r^2*Sin[\[Theta]])/(r^2 + q^2 + 2*r*q*Cos[\[Theta]]),
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

ConditionalExpression[(2*q*(d - q*ArcTanh[q/d]) - d^2*Log[-1 + (2*d)/(d + q)])/(2*q), d >= q]

vs Option 2

Integrate[(r^2*Sin[\[Theta]])/(r^2 + s^2 + 2*r*s*Cos[\[Theta]]), 
    {r, 0, d}, {\[Theta], 0, Pi}]

giving

d + ((d^2 - s^2)*Log[(d + s)^2/(d - s)^2])/(4*s)
Source Link
Loading