On Jan 12, 2013, at 2:28 PM, Andre Holzner <[email protected]> wrote:
Hi, thanks for the prompt reply and the workaround ! On Saturday, 12 January 2013 20:45:40 UTC+1, Aaron Meurer wrote: > > First off, why do you use Lambda. Just use Max(x, 5). > > This is definitely a bug. Should I open a ticket ? Yes, please. > You can work around it by wrapping x in > re(), like plot(Max(re(x), 5)). in fact, doing plot(Max(re(x),5), (x,0,10)) Hmm. This worked for me. Aaron Meurer I get the same exception (originating at the same place) while plot(re(Max(x,5)), (x,0,10)) works. thanks, Andre > Perhaps plot should automatically do > this if x is assumed to be real. Even so, it should not have this > error regardless of assumptions. > > Aaron Meurer > > On Sat, Jan 12, 2013 at 11:53 AM, Andre Holzner > <[email protected]<javascript:>> > wrote: > > Dear sympy experts, > > > > I tried to plot a 'ramp function' as follows (sympy 0.7.2 on OSX): > > > > from sympy import * > > x = Symbol('x',real = True) > > f = Lambda(x, Max(x,5)) > > plot(f(x), (x,0,10)) > > > > but I get the exception shown below on the last line. Should I be doing > this > > differently ? > > When evaluating the function f at some values, it looks like it is > returning > > the correct values. > > > > best regards, > > > > Andre > > > > stack trace: > > > > Traceback (most recent call last): > > File "/tmp/test.py", line 6, in <module> > > plot(f(x), (x,0,10)) > > File > > > "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/plotting/plot.py", > > > line 1165, in plot > > plots.show() > > File > > > "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/plotting/plot.py", > > > line 193, in show > > self._backend.show() > > File > > > "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/plotting/plot.py", > > > line 946, in show > > self.process_series() > > File > > > "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/plotting/plot.py", > > > line 838, in process_series > > collection = LineCollection(s.get_segments()) > > File > > > "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/plotting/plot.py", > > > line 461, in get_segments > > f_start = f(self.start) > > File > > > "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/plotting/experimental_lambdify.py", > > > line 204, in __call__ > > result = self.lambda_func(args) > > File "<string>", line 1, in <lambda> > > TypeError: no ordering relation is defined for complex numbers > > > > -- > > 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/-/QHyOEPCLCt4J. > > To post to this group, send email to [email protected]<javascript:>. > > > To unsubscribe from this group, send email to > > [email protected] <javascript:>. > > For more options, visit this group at > > http://groups.google.com/group/sympy?hl=en. > -- 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/-/WBupi5qgfr8J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
