Skip to main content
Added bug banner.
Source Link
user31159
user31159

Bug introduced in 10.2.0 or earlier and fixed in 10.4.0


Consider the following code.

ClearAll["Global`*"]
InactSum = Inactive[Sum]
InactInt = Inactive[Integrate]
A = InactInt[
    Subscript[\[Phi], j][x] InactSum[
    Subscript[a, i] Subscript[\[Phi], i][x], {i, 1, n}] , {x, a, b}]
B = InactInt[
    InactSum[Subscript[a, i]
    Subscript[\[Phi], i][x] Subscript[\[Phi], j][x], {i, 1, n}] , {x,
    a, b}]
Interchange = InactInt[InactSum[p_, q_], r_] -> InactSum[InactInt[p, r], q];
A /. Interchange
B /. Interchange

I have introduced two expressions

$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \right] dx \\ B &= \int_{a}^{b} \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right] dx \end{align}$$

where in $A$, $\phi_{j}$ is outside the summation while in $B$ it is inside the summation. Technically, these are both the same. But when I was trying to write a transformation rule that interchanges the integration and summation, then I noticed that it just applies to $B$ and not to $A$. So, I understood that Mathematica understands the little difference between these two but

The Standard Output for Both is the Same!

enter image description here

This prevents user from understanding the difference and it just shows itself when you want to apply the transformation rule.

I think this is a bug. In my opinion, the standard output for these two should be different. I would be happy to see what you think.

Consider the following code.

ClearAll["Global`*"]
InactSum = Inactive[Sum]
InactInt = Inactive[Integrate]
A = InactInt[
    Subscript[\[Phi], j][x] InactSum[
    Subscript[a, i] Subscript[\[Phi], i][x], {i, 1, n}] , {x, a, b}]
B = InactInt[
    InactSum[Subscript[a, i]
    Subscript[\[Phi], i][x] Subscript[\[Phi], j][x], {i, 1, n}] , {x,
    a, b}]
Interchange = InactInt[InactSum[p_, q_], r_] -> InactSum[InactInt[p, r], q];
A /. Interchange
B /. Interchange

I have introduced two expressions

$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \right] dx \\ B &= \int_{a}^{b} \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right] dx \end{align}$$

where in $A$, $\phi_{j}$ is outside the summation while in $B$ it is inside the summation. Technically, these are both the same. But when I was trying to write a transformation rule that interchanges the integration and summation, then I noticed that it just applies to $B$ and not to $A$. So, I understood that Mathematica understands the little difference between these two but

The Standard Output for Both is the Same!

enter image description here

This prevents user from understanding the difference and it just shows itself when you want to apply the transformation rule.

I think this is a bug. In my opinion, the standard output for these two should be different. I would be happy to see what you think.

Bug introduced in 10.2.0 or earlier and fixed in 10.4.0


Consider the following code.

ClearAll["Global`*"]
InactSum = Inactive[Sum]
InactInt = Inactive[Integrate]
A = InactInt[
    Subscript[\[Phi], j][x] InactSum[
    Subscript[a, i] Subscript[\[Phi], i][x], {i, 1, n}] , {x, a, b}]
B = InactInt[
    InactSum[Subscript[a, i]
    Subscript[\[Phi], i][x] Subscript[\[Phi], j][x], {i, 1, n}] , {x,
    a, b}]
Interchange = InactInt[InactSum[p_, q_], r_] -> InactSum[InactInt[p, r], q];
A /. Interchange
B /. Interchange

I have introduced two expressions

$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \right] dx \\ B &= \int_{a}^{b} \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right] dx \end{align}$$

where in $A$, $\phi_{j}$ is outside the summation while in $B$ it is inside the summation. Technically, these are both the same. But when I was trying to write a transformation rule that interchanges the integration and summation, then I noticed that it just applies to $B$ and not to $A$. So, I understood that Mathematica understands the little difference between these two but

The Standard Output for Both is the Same!

enter image description here

This prevents user from understanding the difference and it just shows itself when you want to apply the transformation rule.

I think this is a bug. In my opinion, the standard output for these two should be different. I would be happy to see what you think.

Tweeted twitter.com/StackMma/status/711154265692250112
edited body
Source Link
Hosein Rahnama
  • 1.7k
  • 1
  • 17
  • 31

Consider the following code.

ClearAll["Global`*"]
InactSum = Inactive[Sum]
InactInt = Inactive[Integrate]
A = InactInt[
    Subscript[\[Phi], j][x] InactSum[
    Subscript[a, i] Subscript[\[Phi], i][x], {i, 1, n}] , {x, a, b}]
B = InactInt[
    InactSum[Subscript[a, i]
    Subscript[\[Phi], i][x] Subscript[\[Phi], j][x], {i, 1, n}] , {x,
    a, b}]
Interchange = InactInt[InactSum[p_, q_], r_] -> InactSum[InactInt[p, r], q];
A /. Interchange
B /. Interchange

I have introduced two expressions

$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left( \sum_{i=1}^{n} a_i \phi_{i}(x) \right) dx \\ B &= \int_{a}^{b} \left( \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right) dx \end{align}$$$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \right] dx \\ B &= \int_{a}^{b} \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right] dx \end{align}$$

where in $A$, $\phi_{j}$ is outside the summation while in $B$ it is inside the summation. Technically, these are both the same. But when I was trying to write a transformation rule that interchanges the integration and summation, then I noticed that it just applies to $B$ and not to $A$. So, I understood that Mathematica understands the little difference between these two but

The Standard Output for Both is the Same!

enter image description here

This prevents user from understanding the difference and it just shows itself when you want to apply the transformation rule.

I think this is a bug. In my opinion, the standard output for these two should be different. I would be happy to see what you think.

Consider the following code.

ClearAll["Global`*"]
InactSum = Inactive[Sum]
InactInt = Inactive[Integrate]
A = InactInt[
    Subscript[\[Phi], j][x] InactSum[
    Subscript[a, i] Subscript[\[Phi], i][x], {i, 1, n}] , {x, a, b}]
B = InactInt[
    InactSum[Subscript[a, i]
    Subscript[\[Phi], i][x] Subscript[\[Phi], j][x], {i, 1, n}] , {x,
    a, b}]
Interchange = InactInt[InactSum[p_, q_], r_] -> InactSum[InactInt[p, r], q];
A /. Interchange
B /. Interchange

I have introduced two expressions

$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left( \sum_{i=1}^{n} a_i \phi_{i}(x) \right) dx \\ B &= \int_{a}^{b} \left( \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right) dx \end{align}$$

where in $A$, $\phi_{j}$ is outside the summation while in $B$ it is inside the summation. Technically, these are both the same. But when I was trying to write a transformation rule that interchanges the integration and summation, then I noticed that it just applies to $B$ and not to $A$. So, I understood that Mathematica understands the little difference between these two but

The Standard Output for Both is the Same!

enter image description here

This prevents user from understanding the difference and it just shows itself when you want to apply the transformation rule.

I think this is a bug. In my opinion, the standard output for these two should be different. I would be happy to see what you think.

Consider the following code.

ClearAll["Global`*"]
InactSum = Inactive[Sum]
InactInt = Inactive[Integrate]
A = InactInt[
    Subscript[\[Phi], j][x] InactSum[
    Subscript[a, i] Subscript[\[Phi], i][x], {i, 1, n}] , {x, a, b}]
B = InactInt[
    InactSum[Subscript[a, i]
    Subscript[\[Phi], i][x] Subscript[\[Phi], j][x], {i, 1, n}] , {x,
    a, b}]
Interchange = InactInt[InactSum[p_, q_], r_] -> InactSum[InactInt[p, r], q];
A /. Interchange
B /. Interchange

I have introduced two expressions

$$\begin{align} A &= \int_{a}^{b} \phi_{j}(x) \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \right] dx \\ B &= \int_{a}^{b} \left[ \sum_{i=1}^{n} a_i \phi_{i}(x) \phi_{j}(x)\right] dx \end{align}$$

where in $A$, $\phi_{j}$ is outside the summation while in $B$ it is inside the summation. Technically, these are both the same. But when I was trying to write a transformation rule that interchanges the integration and summation, then I noticed that it just applies to $B$ and not to $A$. So, I understood that Mathematica understands the little difference between these two but

The Standard Output for Both is the Same!

enter image description here

This prevents user from understanding the difference and it just shows itself when you want to apply the transformation rule.

I think this is a bug. In my opinion, the standard output for these two should be different. I would be happy to see what you think.

edited tags
Link
Hosein Rahnama
  • 1.7k
  • 1
  • 17
  • 31
Source Link
Hosein Rahnama
  • 1.7k
  • 1
  • 17
  • 31
Loading