[sage-support] Re: Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread Jason Grout

On 12/31/11 8:19 AM, Christophe BAL wrote:

Hello Jason.

Where is the function that is called for cartesian plots ?


In $SAGE_ROOT/devel/sage/sage/plot/plot.py, where $SAGE_ROOT is the 
directory where sage is installed.


The example seems like it would fit well in the examples at the top of 
the file, or in part right under the "def plot" line that looks like this:


@rename_keyword(color='rgbcolor')
@options(alpha=1, thickness=1, fill=False, fillcolor='automatic', 
fillalpha=0.5, rgbcolor=(0,0,1), plot_points=200,
 adaptive_tolerance=0.01, adaptive_recursion=5, detect_poles = 
False, exclude = None, legend_label=None,

 __original_opts=True, aspect_ratio='automatic')
def plot(funcs, *args, **kwds):


There are some examples of the exclude option at the bottom of the plot 
documentation.  Maybe right there would be good?


A example with excluded values::

sage: plot(floor(x), (x, 1, 10), exclude = [1..10])

We exclude all points where prime_pi makes a jump::

sage: jumps = [n for n in [1..100] if prime_pi(n) != prime_pi(n-1)]
sage: plot(lambda x: prime_pi(x), (x, 1, 100), exclude = jumps)

Excluded points can also be given by an equation::

sage: g(x) = x^2-2*x-2
sage: plot(1/g(x), (x, -3, 4), exclude = g(x) == 0, ymin = -5, 
ymax = 5)


``exclude`` and ``detect_poles`` can be used together::
sage: f(x) = (floor(x)+0.5) / (1-(x-0.5)^2)
sage: plot(f, (x, -3.5, 3.5), detect_poles = 'show', exclude = 
[-3..3], ymin = -5, ymax = 5)



Thanks,

Jason


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread Christophe BAL
Hello Jason.

Where is the function that is called for cartesian plots ?


2011/12/31 Jason Grout 

> On 12/31/11 6:55 AM, Christophe BAL wrote:
>
>> Thanks for this.
>>
>> This kind of example should appear in the tutorial of the documentation.
>>
>>
> That would be great.  Patches are welcome.
>
> Thanks,
>
> Jason
>
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to sage-support+unsubscribe@**
> googlegroups.com 
> For more options, visit this group at http://groups.google.com/**
> group/sage-support 
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread Jason Grout

On 12/31/11 6:55 AM, Christophe BAL wrote:

Thanks for this.

This kind of example should appear in the tutorial of the documentation.



That would be great.  Patches are welcome.

Thanks,

Jason

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread Christophe BAL
Thanks for this.

This kind of example should appear in the tutorial of the documentation.

Best regards.
Christophe.


2011/12/31 achrzesz 

>
>
> On Dec 31, 11:21 am, Christophe BAL  wrote:
> > Hello,
> > the following command has a very bad output.
> >
> > plot(sqrt((x - 2)*(x - 1)), (-4, 5)) + plot(-sqrt((x - 2)*(x - 1)), (-4,
> 5))
> >
> > How can I ameliorate this ?
> >
> > Best regards.
> > Christophe
>
> Your function is comlex-valued on the interval (1,2)
> so the interval should be excluded
>
> sage: plot(sqrt((x - 2)*(x - 1)), (-4,
> 5),exclude=[1..2],plot_points=1000) + plot(-sqrt((x - 2)*(x - 1)),
> (-4, 5),exclude=[1..2],plot_points=3000)
>
> (other option - construct the graph from 4 pieces)
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread achrzesz


On Dec 31, 11:21 am, Christophe BAL  wrote:
> Hello,
> the following command has a very bad output.
>
> plot(sqrt((x - 2)*(x - 1)), (-4, 5)) + plot(-sqrt((x - 2)*(x - 1)), (-4, 5))
>
> How can I ameliorate this ?
>
> Best regards.
> Christophe

Your function is comlex-valued on the interval (1,2)
so the interval should be excluded

sage: plot(sqrt((x - 2)*(x - 1)), (-4,
5),exclude=[1..2],plot_points=1000) + plot(-sqrt((x - 2)*(x - 1)),
(-4, 5),exclude=[1..2],plot_points=3000)

(other option - construct the graph from 4 pieces)

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Problem for plotting sqrt((x - 2)*(x - 1))

2011-12-31 Thread Christophe BAL
Hello,
the following command has a very bad output.

plot(sqrt((x - 2)*(x - 1)), (-4, 5)) + plot(-sqrt((x - 2)*(x - 1)), (-4, 5))

How can I ameliorate this ?

Best regards.
Christophe

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: sage graph -- why is c_graph so slow??

2011-12-31 Thread Nathann Cohen
Hello !!!

> I'll try to test it asap. Having some patch application issues. :-|
> Just in case you're familiar with this, I'll throw it out there. But
> this is probably a job for google:

Oh, not really. This problem comes from the fact that I am using a more
recent version of Sage than you do :

~$ sage
--
| Sage Version 4.8.alpha4, Release Date: 2011-12-13


This one is the developper's version, and our patches should be applied on
this one in case of doubt :-)

Here is where you can find it : http://www.sagemath.org/download-latest.html

By the way, I think some of the recent optimizations in the Graph code that
are included in this version may not be available in the one you are
currently using :-)

Have fuun !

Nathann

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org