On Mon, Jun 17, 2013 at 12:39 AM, Ben Lucato <ben.luc...@gmail.com> wrote:
> Ok cool I thought it might be a case of just having to modify how I print.
>
> I'm not using any special printer - just doing print sympy.latex(y)

Sure, that means that you're using the latex printer (as opposed to
the string printer or the pretty printer).

In this case, it's even easier for you, because this behavior has been
fixed already to do it the way that you want in the git master. So you
just need to work off the SymPy development version until the next
release. See https://github.com/sympy/sympy/wiki/Getting-the-bleeding-edge.

Aaron Meurer

>
> Thanks for your quick response!!! :- )
>
>
> On Monday, 17 June 2013 14:45:19 UTC+10, Aaron Meurer wrote:
>>
>> Internally, there is no difference between 1/(x + 1)**2 and (x +
>> 1)**-2.  There is no class in SymPy that represents division.  1/x is
>> represented internally as just Pow(x, -1).
>>
>> If all you care about is printing, then I recommend you modify the
>> printer.
>>
>> Which printer are you using? What you need to do is subclass the
>> appropriate printer and override the _print_Pow method.
>>
>> Aaron Meurer
>>
>> On Sun, Jun 16, 2013 at 11:40 PM, Ben Lucato <ben.l...@gmail.com> wrote:
>> > If I have code like so:
>> >
>> > x = sympy.Symbol('x')
>> > y = 1 / (x + 1)**2
>> >
>> > it evaluates to
>> > y = (x + 1)**(-2)
>> >
>> >
>> > is there a way to prevent that happening and have it remain as 1 / (x +
>> > 1)**2.
>> >
>> > **** OR: alternatively, is there a way to retrieve 1 / (x + 1)**2 from
>> > the
>> > canonical form? I've looked at the docs and searched in this google
>> > group
>> > but haven't found relevant discussions. The reason I want to do this is
>> > for
>> > printing purposes
>> >
>> > --
>> > 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+un...@googlegroups.com.
>> > To post to this group, send email to sy...@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