<div dir="ltr">I think the `x` is just noise there, especially if it's ignored (that is, `T[0](x*2)` doesn't do anything reasonable).<br><br><span style="color:rgb(33,33,33);font-size:small">    Chebyshev.literal(lambda T: 1*T[0] + 2*T[1] + 3*T[2])</span>  <br><div><br></div><div>Would work, but honestly I don't think that provides much clarity. I think the value here is mainly for "simple" polynomials.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, 1 Jul 2018 at 23:42 Maxwell Aifer <<a href="mailto:maifer@haverford.edu">maifer@haverford.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">

<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Say we add a constructor to the polynomial base class that looks something like this: </div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">-------------------------------------------------------------------------------------------</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">   @classmethod</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">    def literal(cls, f):</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">        def basis_function_getter(self, deg):</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">            coefs = [0]*deg + [1]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">            return lambda _: cls(coefs)</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">        basis = type('',(object,),{'__getitem__': basis_function_getter})()</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">        return f(basis, None)</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">-------------------------------------------------------------------------------------------</span></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Then the repr for, say, a Chebyshev polynomial could look like this:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">>>> Chebyshev.literal(lambda T,x: 1*T[0](x) + 2*T[1](x) + 3*T[2](x))</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Does this sound like a good idea to anyone?</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Max</div>

<br></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 30, 2018 at 6:47 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sat, Jun 30, 2018 at 4:42 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="m_6654329277916588521m_3584633286259566860gmail-">On Sat, Jun 30, 2018 at 3:41 PM, Eric Wieser <span dir="ltr"><<a href="mailto:wieser.eric+numpy@gmail.com" target="_blank">wieser.eric+numpy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="m_6654329277916588521m_3584633286259566860gmail-m_-5907420799282146058m_305130354793058807markdown-here-wrapper" style="font-size:1em;font-family:Helvetica,arial,freesans,clean,sans-serif;color:rgb(34,34,34);background-color:rgb(255,255,255);border:none;line-height:1.2"><p style="margin:1em 0px">Since the one of the arguments for the decreasing order seems to just be textual representation - do we want to tweak the repr to something like</p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;overflow:auto;margin:1em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;border-radius:3px;border:1px solid rgb(204,204,204);display:block;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,255)">Polynomial(lambda x: 2*x**3 + 3*x**2 + x + 0)
</code></pre><p style="margin:1em 0px">(And add a constructor that calls the lambda with <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">Polynomial(1)</code>)</p>
<p style="margin:1em 0px">Eric</p></div></div></blockquote><div><br></div></span><div>IIRC there was a proposal for that. There is the possibility of adding renderers for latex and html that could be used by Jupyter, and I think the ordering was an option. </div></div></div></div></blockquote><div><br></div></span><div>See <a href="https://github.com/numpy/numpy/issues/8893" target="_blank">https://github.com/numpy/numpy/issues/8893</a> for the proposal. BTW, if someone would like to work on this, go for it.</div><div><br></div><div>Chuck </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="m_6654329277916588521m_3584633286259566860gmail-m_-5907420799282146058m_305130354793058807markdown-here-wrapper" style="font-size:1em;font-family:Helvetica,arial,freesans,clean,sans-serif;color:rgb(34,34,34);background-color:rgb(255,255,255);border:none;line-height:1.2">
<div title="MDH:U2luY2UgdGhlIHByaW1hcnkgYXJndW1lbnQgZm9yIHRoZSBkZWNyZWFzaW5nIG9yZGVyIHNlZW1z
IHRvIGp1c3QgYmUgdGV4dHVhbCByZXByZXNlbnRhdGlvbiAtIGRvIHdlIHdhbnQgdG8gdHdlYWsg
dGhlIHJlcHIgdG8gc29tZXRoaW5nIGxpa2U8YnI+PGJyPmBgYDxicj5Qb2x5bm9taWFsKGxhbWJk
YSB4OiAyKngqKjPCoCsgMyp4KioywqArIHjCoCsgMCk8ZGl2PmBgYDwvZGl2PjxkaXY+KEFuZCBh
ZGQgYSBjb25zdHJ1Y3RvciB0aGF0IGNhbGxzIHRoZSBsYW1iZGEgd2l0aCBgUG9seW5vbWlhbCgx
KWApPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5FcmljPC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></blockquote></div></div></div>
</blockquote></div><br></div></div>
<br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>