Opened 10 years ago

Closed 10 years ago

#8540 closed defect (fixed)

very simple basic sqrt simplification totally broken

Reported by: was Owned by: burcin
Priority: blocker Milestone: sage-4.3.4
Component: basic arithmetic Keywords:
Cc: robertwb, mhansen Merged in: sage-4.3.4.rc0
Authors: Burcin Erocal Reviewers: Mike Hansen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

sage: a = 3/4
sage: b = a^(-1/2)
sage: b^2
12

But it should be 4/3.

Reported by Paul Nelson, a grad student at Caltech.

Attachments (1)

trac_8540-rational_power.patch (1.3 KB) - added by burcin 10 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by was

This serious bug is present in sage-4.0, but not in 3.4.2, so it was caused in the switch to Pynac.

comment:2 Changed 10 years ago by jason

Even earlier than the square:

sage: (3/4)^(-1/2)
6*sqrt(1/3)
sage: n((.75)^(-1/2))
1.15470053837925
sage: n(6*sqrt(1/3))
3.46410161513775

comment:3 Changed 10 years ago by burcin

  • Cc robertwb mhansen added

During the push for the switch, some code was added to simplify these cases (where the base and exponent are rational, but the result is not exact) further than what ginac can do. See sage.rings.rational.rational_power_parts for example.

I am taking a look at this right now, but I don't have much time, so I can't promise any results.

Changed 10 years ago by burcin

comment:4 Changed 10 years ago by burcin

  • Authors set to Burcin Erocal
  • Component changed from symbolics to basic arithmetic
  • Status changed from new to needs_review
  • Summary changed from ** BLOCKER ** very simple basic sqrt simplification totally broken bad to very simple basic sqrt simplification totally broken

attachment:trac_8540-rational_power.patch fixes the problem, please review.

comment:5 Changed 10 years ago by mhansen

  • Reviewers set to Mike Hansen
  • Status changed from needs_review to positive_review

Looks good.

comment:6 Changed 10 years ago by mvngu

  • Merged in set to sage-4.3.4.rc0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.