Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Term order discrepancy in random test on OS X #9582

Closed
qed777 mannequin opened this issue Jul 23, 2010 · 15 comments
Closed

Term order discrepancy in random test on OS X #9582

qed777 mannequin opened this issue Jul 23, 2010 · 15 comments

Comments

@qed777
Copy link
Mannequin

qed777 mannequin commented Jul 23, 2010

Reported by John Palmieri on sage-release:

a 64 bit Mac OS X 10.6.4 box: one failure:

sage -t -long "devel/sage/sage/symbolic/random_tests.py"
**********************************************************************
File "/Applications/sage_builds/sage-4.5.2.alpha0/devel/sage/sage/
symbolic/random_tests.py", line 236:
    sage: random_expr(50, nvars=3, coeff_generator=CDF.random_element)
Expected:
    factorial(floor((-0.314177274493 + 0.144437996366*I)/cosh(-v1^2*e/
v3) + cos((-0.708874026302 - 0.954135400334*I)*v3) -
zetaderiv(-0.228070288671 + 0.33842966472*I, 0.520184609653 -
0.734276246499*I)))^(-arccoth(-abs(((-0.804514286089 -
0.0293247734576*I)*v1 + (-0.804514286089 - 0.0293247734576*I)*v3 -
1.0)*elliptic_ec((-0.0263902659909 +
0.153261789843*I)*arccot(pi*catalan)))))
Got:
    factorial(floor((-0.314177274493 + 0.144437996366*I)/cosh(-v1^2*e/
v3) - zetaderiv(-0.228070288671 + 0.33842966472*I, 0.520184609653 -
0.734276246499*I) + cos((-0.708874026302 - 0.954135400334*I)*v3)))^(-
arccoth(-abs(((-0.804514286089 - 0.0293247734576*I)*v1 +
(-0.804514286089 - 0.0293247734576*I)*v3 -
1.0)*elliptic_ec((-0.0263902659909 +
0.153261789843*I)*arccot(pi*catalan)))))
**********************************************************************

Looks like a discrepancy in the order terms are printed.

Acccording to Dan Drake:

I'm seeing that on bsd.math too. This is related to #9514, which was
supposed to fix this, but evidently doesn't, on OS X at least.

Related: #9514.

CC: @sagetrac-cwitty @dandrake @jhpalmieri @burcin

Component: doctest coverage

Author: Carl Witty

Reviewer: Mitesh Patel

Merged: sage-4.5.2.rc0

Issue created by migration from https://trac.sagemath.org/ticket/9582

@qed777 qed777 mannequin added this to the sage-4.5.2 milestone Jul 23, 2010
@qed777 qed777 mannequin added t: tests labels Jul 23, 2010
@qed777 qed777 mannequin assigned sagetrac-mvngu Jul 23, 2010
@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Jul 23, 2010

comment:1

Unlikely that this has anything to do with #9514. The symptom of #9514 was getting totally different terms, and the cause was that it made a list of all known symbolic functions [sin, cos, factorial, ...], and randomly picked the third element (say) from the list -- but on different systems, the third element might be factorial, or it might be cos.

If it's producing mathematically equal terms that only print differently, which seems to be the case here, the cause is probably some system dependency in the pynac simplification or printing routines.

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 27, 2010

comment:2

Evaluating cos(x) + zeta(x) in Sage 4.5.2.alpha0 gives

  • zeta(x) + cos(x) on sage.math.
  • cos(x) + zeta(x) on bsd.math.

Is this representative of the underlying problem?

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 28, 2010

comment:3

I compiled GiNaC (and CLN) on bsd and sage.math. Evaluating cos(x) + zeta(x); in GiNaC's ginsh shell gives the same results as in comment 2. I don't know if this is useful information.

@kcrisman
Copy link
Member

comment:4

On Sage 4.4.4 on OS X 10.6:

sage: cos(x)+zeta(x)
cos(x) + zeta(x)
sage: zeta(x)+cos(x)
cos(x) + zeta(x)
sage: version()
'Sage Version 4.4.4, Release Date: 2010-06-23'

So this may have been a problem for a while?

@jhpalmieri
Copy link
Member

comment:5

Maybe so. Maybe it was just exposed with new tests?

@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Jul 28, 2010

@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Jul 28, 2010

comment:6

If we decide that the actual problem (different printing across platforms) is not a regression, and doesn't have to be fixed in this release, then I've attached a patch that works around the problem (by modifying the doctest to produce an output that prints the same on my Linux box and on bsd.math).

If you do apply my patch, then either this ticket should not be closed, or another one should be opened about the printing order issue.

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 29, 2010

Author: Carl Witty

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 29, 2010

Reviewer: Mitesh Patel

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 29, 2010

comment:7

Replying to @sagetrac-cwitty:

If we decide that the actual problem (different printing across platforms) is not a regression, and doesn't have to be fixed in this release, then I've attached a patch that works around the problem (by modifying the doctest to produce an output that prints the same on my Linux box and on bsd.math).

This seems reasonable. Are there any objections? The workaround patch works for me on bsd, sage, and t2.math.

If you do apply my patch, then either this ticket should not be closed, or another one should be opened about the printing order issue.

I'll give this ticket a positive review, merge it in 4.5.2.rc0, close it, and open a new one for the printing order problem.

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 29, 2010

Merged: sage-4.5.2.rc0

@qed777 qed777 mannequin removed the s: positive review label Jul 29, 2010
@qed777 qed777 mannequin closed this as completed Jul 29, 2010
@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 29, 2010

comment:9

Replying to @sagetrac-cwitty:

If you do apply my patch, then either this ticket should not be closed, or another one should be opened about the printing order issue.

I've opened #9632.

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Jul 29, 2010

comment:10

Burcin, since we haven't released 4.5.2.rc0 yet, I'm happy to make changes to it, e.g., merging a different patch. Just let us know within a day or so. I apologize for not giving you more time to examine this ticket.

@qed777
Copy link
Mannequin Author

qed777 mannequin commented Aug 1, 2010

comment:11

I've "qfinished" 4.5.2.rc0, and we will release it soon. Shall we continue at #9632?

@burcin
Copy link

burcin commented Aug 1, 2010

comment:12

Yes, I couldn't see any quick fix which wouldn't effect performance. Ordering of the terms is already a big performance bottleneck in Python. I'd like to fix things properly once instead of adding kludges all around, but I don't have time to do that right now.

I've been sidetracked by other pynac problems since. Sorry for keeping quiet all this time and thanks for your efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants