Don't simplify

285 views
Skip to first unread message

Vincent MAILLE

unread,
Dec 18, 2011, 8:47:50 AM12/18/11
to sympy
Hello,

I'm programming a function whitch give the definition set of an
expression (e.g : ln(x+1) => ]-1;+oo[ ). My problem is sympy
simplifies too quick my expression :

print x/x return 1 before I can extract the 1/x operation (and so
return x<>0). How to say sympy not to symplify ?

Thanks.
Vincent

P.S : Perhaps this function already exists ?

Chris Smith

unread,
Dec 18, 2011, 9:05:27 PM12/18/11
to sy...@googlegroups.com
On Sun, Dec 18, 2011 at 7:32 PM, Vincent MAILLE <htcv...@gmail.com> wrote:
> Hello,
>
> I'm programming a function whitch give the definition set of an
> expression (e.g : ln(x+1) => ]-1;+oo[ ). My problem is sympy
> simplifies too quick my expression :
>
> print x/x return 1 before I can extract the 1/x operation (and so
> return x<>0). How to say sympy not to symplify ?

Maybe this is what you mean?

>>> xx=Mul(x,1/x,evaluate=0)
>>> log(xx+1)
log(1 + x/x)

Aaron Meurer

unread,
Dec 18, 2011, 9:27:12 PM12/18/11
to sy...@googlegroups.com

If http://code.google.com/p/sympy/issues/detail?id=1966 were fixed,
you would be able to just do sympify('x/x', evaluate=False).

By the way, do you know about the Interval class (or more generally,
the Set classes) in SymPy? It doesn't use the same notation as you do
in printing, but this can be easily fixed by modifying the printer if
you dislike it.

Aaron Meurer

Vincent MAILLE

unread,
Dec 22, 2011, 4:52:26 AM12/22/11
to sy...@googlegroups.com
Hello. Thanks for your answer.

Issue 1966 would be fine indeed (I clicked +1). Regarding intervals, I use them afterwards to display the definition domain of the function, but first I have to pick out all the problematical values. I've almost finished the code. I'll add it on this list if you're interested in it

Thanks

Vincent



Christophe BAL

unread,
Dec 22, 2011, 5:59:20 AM12/22/11
to sy...@googlegroups.com
Hello Voncent,
is it possible to use your code ?

Christophe

2011/12/22 Vincent MAILLE <htcv...@gmail.com>


Vincent



--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/byh6uXHRBY8J.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Chris Smith

unread,
Dec 22, 2011, 7:21:21 AM12/22/11
to sy...@googlegroups.com
btw, as far as finding problem values, solve's denoms function might be useful: it sends back all denominators in an expression.

Vincent MAILLE

unread,
Dec 26, 2011, 5:27:16 PM12/26/11
to sy...@googlegroups.com
Hi Christophe,

    Yes of course !  I think my code can be very optimized. I'll send you here when it'll be finished (in January I hope)

Vincent

Christophe BAL

unread,
Dec 26, 2011, 6:04:27 PM12/26/11
to sy...@googlegroups.com
Thanks for this christmas gift !

C.
360.gif
Reply all
Reply to author
Forward
0 new messages