We should just change all the special polynomial objects to not
evaluate by default. jacobi_normalized actually *is* a class, but it
evaluates whenever the degree is an explicit integer. But there's no
need for this, as we already have *_poly versions of these functions
to do that.

Until this gets fixed (PRs welcome), a workaround would be to use
Symbol('n') for the degree, and replace it with the number you want at
the post-processing stage (how to do this will depend on what your
post-processing stage looks like; for lambdify(), you can just set {n:
2} in the modules dictionary).

Aaron Meurer

On Wed, Feb 5, 2014 at 6:35 PM, Matthew Rocklin <mrock...@gmail.com> wrote:
> I guess I'd like to see code like the following
>
>>>> sy.jacobi_normalized(2, 0, 1, x)
>
> sqrt(6)*(5*x**2/2 - x - 1/2)/2
>
>>>> with evaluation(False):
> ...    sy.jacobi_normalized(2, 0, 1, x)
> sqrt(6)/3*jacobi(2, 0, 1, x)
>
> But yes, I suppose we could just capitalize the jacobi class and add an
> evaluate= keyword.  That will probably resolve Freddie's immediate issue.
> It's good practice in any event.
>
>
>
> On Wed, Feb 5, 2014 at 3:40 PM, Ondřej Čertík <ondrej.cer...@gmail.com>
> wrote:
>>
>> Isn't the solution simply to provide a class Jacobi, that is not
>> evaluated, and a function jacobi(), that does what it does now?
>>
>> Ondrej
>>
>> On Wed, Feb 5, 2014 at 4:38 PM, Matthew Rocklin <mrock...@gmail.com>
>> wrote:
>> > Although, I don't know much about the polynomials module.  It may be
>> > possible to resolve the problem there without tackling the problem at
>> > large.
>> >
>> >
>> > On Wed, Feb 5, 2014 at 3:29 PM, Matthew Rocklin <mrock...@gmail.com>
>> > wrote:
>> >>
>> >> Unwanted automatic evaluation comes up fairly frequently on the
>> >> listhost.
>> >> It's on our radar but there hasn't been much movement on the issue
>> >> lately.
>> >> It requires a concerted effort by someone with some time.
>> >>
>> >>
>> >> > is there wider interest in such a feature?
>> >> Absolutely.
>> >>
>> >>
>> >> On Wed, Feb 5, 2014 at 2:54 PM, Freddie Witherden
>> >> <fred...@witherden.org>
>> >> wrote:
>> >>>
>> >>> Hi all,
>> >>>
>> >>> In SymPy is there any way of stopping orthogonal polynomials from
>> >>> automatically simplifying down to concrete expressions?  So for:
>> >>>
>> >>>   sy.jacobi_normalized(2, 0, 1, x)
>> >>>
>> >>> to give:
>> >>>
>> >>>   sqrt(6)/3*jacobi(2, 0, 1, x)
>> >>>
>> >>> as opposed to:
>> >>>
>> >>>   sqrt(6)*(5*x**2/2 - x - 1/2)/2
>> >>>
>> >>> I have a use-case where it is highly desirable for polynomials to be
>> >>> kept in the above form (as it permits more efficient/numerically
>> >>> stable
>> >>> evaluations later on).  Other than keeping n as a Symbol is this
>> >>> currently possible?  If not---and I suspect, from a quick glance over
>> >>> the source code that it isn't!)---is there wider interest in such a
>> >>> feature?
>> >>>
>> >>> Regards, Freddie.
>> >>>
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to sympy+unsubscr...@googlegroups.com.
>> > To post to this group, send email to sympy@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/sympy.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sympy+unsubscr...@googlegroups.com.
>> To post to this group, send email to sympy@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sympy.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to