Opened 14 years ago

Closed 14 years ago

#2743 closed enhancement (fixed)

[with patch, positive review] make symbolic equalities and inequalities callable

Reported by: jason Owned by: was
Priority: major Milestone: sage-3.0
Component: calculus Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

It would be nice if the following worked:

sage: f = x>3
sage: f(2)
False
sage: f(4)
True

Attachments (1)

trac-2743-sym-eq-call.patch (1.6 KB) - added by jason 14 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 14 years ago by jason

  • Component changed from Cygwin to calculus
  • Owner changed from mabshoff to was

comment:2 Changed 14 years ago by mabshoff

  • Milestone set to sage-3.0

comment:3 Changed 14 years ago by jason

original

sage: var('x y')
(x, y)
sage: eq=x<y
sage: %timeit eq(x=2, y=3)
10 loops, best of 3: 54.6 µs per loop

After

sage: var('x y')
(x, y)
sage: eq=x<y
sage: %timeit eq(x=2, y=3)
10 loops, best of 3: 78.9 ms per loop

Changed 14 years ago by jason

comment:4 Changed 14 years ago by jason

While there currently is callable functionality, it is broken. See the doctests in the patch for several breakages of the current functionality.

This patch hands all the work off to symbolic matrices. That makes it really slow, but it works. The next thing to do would be to write the functionality directly into this class.

comment:5 Changed 14 years ago by jason

  • Summary changed from make symbolic equalities and inequalities callable to [with patch, needs review] make symbolic equalities and inequalities callable

comment:6 Changed 14 years ago by robertwb

  • Summary changed from [with patch, needs review] make symbolic equalities and inequalities callable to [with patch, positive review] make symbolic equalities and inequalities callable

Yep, this works well for me. It looks like the matrix is used to ensure that substitutions are to the correct variables, and that works well.

comment:7 Changed 14 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Merged in Sage 3.0.alpha2

Note: See TracTickets for help on using tickets.