Skip to content

Conversation

@GarkGarcia
Copy link
Contributor

Fixed a bug concerning the behaviour of the Sum and Product builtins.

Before the patch

In[1]:= Sum[f[i], {i, 1, 7}]
Out[1]= 7 f[i]

After the patch

In[1]:= Sum[f[i], {i, 1, 7}]
Out[1]= f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7]

@GarkGarcia GarkGarcia added the bug label Sep 12, 2020
@GarkGarcia
Copy link
Contributor Author

After the patch

In[1]:= Sum[f[i], {i, 1, 7}]
Out[1]= f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7]

Note that this is the behaviour exhibited by WolframAlpha.

@GarkGarcia
Copy link
Contributor Author

Apparently https://travis-ci.org/github/mathics/Mathics/jobs/726583048 failed because https://files.pythonhosted.org/ reset the connection while setup.py was downloading something. I'm merging the PR since there aren't any failing tests.

@GarkGarcia GarkGarcia merged commit c1c38ad into mathics:master Sep 12, 2020
Copy link
Member

@rocky rocky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have this fix added to the tests if

>>> Sum[f[i], {i, 1, 7}]
= Out[1]= f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7]

were added to the Sum builtin.

@GarkGarcia
Copy link
Contributor Author

We could have this fix added to the tests if

>>> Sum[f[i], {i, 1, 7}]
= Out[1]= f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7]

were added to the Sum builtin.

Good idea! Check #873 for updates.

@GarkGarcia GarkGarcia changed the title Sum product fix Sum/Product fix Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants