Opened 8 years ago

Closed 8 years ago

#8259 closed enhancement (fixed)

Conversion from symmetric polynomials to basis of monomial symmetric functions

Reported by: aschilling Owned by: sage-combinat
Priority: major Milestone: sage-4.3.4
Component: combinatorics Keywords: symmetric functions
Cc: jbandlow, sage-combinat Merged in: sage-4.3.4.alpha0
Authors: Anne Schilling Reviewers: Jason Bandlow
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by aschilling)

Currently a function that converts a symmetric polynomial into a symmetric function is missing in sage.

-Added method to convert symmetric polynomial to a symmetric function in monomial basis

-Added shortcut to symmetric functions

-Small fix in crystals

Attachments (2)

trac_8259-from_poly_to_sym-as.patch (5.9 KB) - added by aschilling 8 years ago.
trac_8259-from_poly_to_sym-review-as.patch (5.2 KB) - added by aschilling 8 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 8 years ago by jbandlow

  • Cc jbandlow added

comment:2 Changed 8 years ago by aschilling

  • Authors set to Anne Schilling
  • Description modified (diff)
  • Reviewers set to Jason Bandlow
  • Status changed from new to needs_review

comment:3 Changed 8 years ago by aschilling

  • Description modified (diff)

comment:4 follow-up: Changed 8 years ago by drkirkby

Has this been checked on Solaris?

There's general information about building on Solaris at

http://wiki.sagemath.org/solaris

Information specifically for 't2' at

http://wiki.sagemath.org/devel/Building-Sage-on-the-T5240-t2

Both the source (4.3.0.1 is the latest to build on Solaris) and a binary which will run on any SPARC can be found at http://www.sagemath.org/download-source.html

Dave

comment:5 in reply to: ↑ 4 Changed 8 years ago by aschilling

Dave,

Are you sure you posted this comment to the correct ticket?

If so, could you please comment on the relevance of Solaris to the code?

Thanks,

Anne

Replying to drkirkby:

Has this been checked on Solaris?

There's general information about building on Solaris at

http://wiki.sagemath.org/solaris

Information specifically for 't2' at

http://wiki.sagemath.org/devel/Building-Sage-on-the-T5240-t2

Both the source (4.3.0.1 is the latest to build on Solaris) and a binary which will run on any SPARC can be found at http://www.sagemath.org/download-source.html

Dave

comment:6 Changed 8 years ago by jbandlow

  • Milestone set to sage-4.3.4

Hi Anne,

The fix to crystals.py doesn't apply to either sage 4.3.2 or sage 4.3.3. Can it be removed from this patch?

Thanks, Jason

comment:7 follow-up: Changed 8 years ago by jbandlow

One more thing. I would really like to have an option to verify that the input actually is a symmetric function. In fact I think this should be true by default. So the key function would look something like this:

def from_polynomial(self, f, check=True):        
    assert(self.base_ring() == f.base_ring()
    d = dict([(e,c) for e,c in f.dict().iteritems() if tuple(sorted(e)) == tuple(reversed(e))]) 
    if not check:
        return self.sum(d[la]*self(Partition(la)) for la in d.keys())
    out = self.sum(d[la]*self(Partition(la)) for la in d.keys())
    assert( out.expand(f.parent().ngens(),f.parent().gens()) == f )
    return out

comment:8 in reply to: ↑ 7 ; follow-up: Changed 8 years ago by aschilling

Hi Jason,

I attached a revised patch which includes your suggestion to add the option to test whether the polynomial is symmetric.

For me the patch applied to sage-4.3.3. It depends on trac tickets #7978 and #8154 which have been merged in sage-4.3.3. Hence it might not apply cleanly to sage-4.3.2.

Anne

Changed 8 years ago by aschilling

comment:9 in reply to: ↑ 8 Changed 8 years ago by aschilling

Hi Jason,

As we just discussed on the phone, I did revert the indentation of class Element in /combinat/sf/monomial.py back to the same level as class SymmetricFunctionAlgebra_monomial

However, I did change the indentation to be multiples of 4 rather than multiples of 3. I sent an e-mail to sage-combinat-devel to ask about the indentation issues in sf.

Anne

comment:10 Changed 8 years ago by jbandlow

  • Status changed from needs_review to positive_review

Thanks Anne! This looks good to me. Positive review.

-Jason

comment:11 follow-up: Changed 8 years ago by nthiery

Just two tiny remarks:

  • One can write assert a==b instead of assert(a==b)
  • One could be a bit more specific: `assert a==b, "not a symmetric polynomial"
  • Assertion are not *always* checked (see http://docs.python.org/reference/simple_stmts.html). So I am not sure it is the appropriate idiom here.

That's minor, so I let you see if you want to add a quick review patch, or just leave things as is.

Thanks!

Changed 8 years ago by aschilling

comment:12 in reply to: ↑ 11 ; follow-up: Changed 8 years ago by aschilling

Replying to nthiery:

Just two tiny remarks:

  • One can write assert a==b instead of assert(a==b)
  • One could be a bit more specific: `assert a==b, "not a symmetric polynomial"
  • Assertion are not *always* checked (see http://docs.python.org/reference/simple_stmts.html). So I am not sure it is the appropriate idiom here.

That's minor, so I let you see if you want to add a quick review patch, or just leave things as is.

Thanks!

Done! Please review the review of the review of the review ... oops! Infinite loop!

comment:13 in reply to: ↑ 12 Changed 8 years ago by nthiery

Replying to aschilling:

Replying to nthiery:

Just two tiny remarks:

  • One can write assert a==b instead of assert(a==b)
  • One could be a bit more specific: `assert a==b, "not a symmetric polynomial"
  • Assertion are not *always* checked (see http://docs.python.org/reference/simple_stmts.html). So I am not sure it is the appropriate idiom here.

That's minor, so I let you see if you want to add a quick review patch, or just leave things as is.

Thanks!

Done! Please review the review of the review of the review ... oops! Infinite loop!

Thanks! I haven't rerun the tests, but the review patch looks good to me.

comment:14 Changed 8 years ago by mvngu

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