[sage-support] Re: documentation for implicit_plot

2010-09-14 Thread Jason Grout

On 9/14/10 8:12 PM, kcrisman wrote:



On Sep 14, 3:00 pm, "D.C. Ernst"  wrote:

If I type the following into Sage (which is straight from the
implicit_plot documentation), I get a black square:

x,y=var('x,y')
f(x,y) = x^2 + y^2 - 2
implicit_plot(f, (-3, 3), (-3, 3),fill=True).show(aspect_ratio=1)

Of course, if you remove "fill=True", then everything works as
expected.  The documentation should probably remove the "fill=True",
right?


Well, but it's supposed to demonstrate the fill option, which

* ``fill`` -- boolean (default: ``False``); if ``True``, fill
the
  region f(x,y)<  0.

So perhaps there has been a regression - I get the same thing in both
4.5.3 and 4.3 (though in 4.3 I get a ghostly circle in the middle).
Not for the first time, we wish there were a way to do doctesting on
the image files produced...

sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=(0,0)).show(aspect_ratio=1)

doesn't do what we want either. In fact I'm having trouble getting
what I want with

sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=[0,0]).show(aspect_ratio=1)
sage: contour_plot(f, (-3, 3), (-3, 3),fill=True,contours=[-oo,
0]).show(aspect_ratio=1)
sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=[-1000,0]).show(aspect_ratio=1)

I'm not sure what happened here, because

sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=1).show(aspect_ratio=1)

doesn't give just one contour, either.

I can think of several people whose fault this could be, and I'm one
of them, but I'm not sure what's going on yet (albeit won't have time
to check it in detail now).  Can you file a Trac ticket for this
issue, and cc: kcrisman and jason on it?



Already done:  http://trac.sagemath.org/sage_trac/ticket/9744

I wrote some rough code fixing it about a month ago.  Volunteers to 
finish it and polish it are welcome!


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: continued_fraction returns nothing

2010-09-14 Thread Robert Bradshaw
On Tue, Sep 14, 2010 at 6:44 PM, Robert Bradshaw
 wrote:
> On Tue, Sep 14, 2010 at 10:44 AM, Håkan Granath
>  wrote:
>> On Sep 14, 12:16 am, Robert Bradshaw 
>> wrote:
>>>
>>> Alastair correctly deduced the issue that it can't tell if the number
>>> is less than or greater than 2, what should it do here?
>>
>> I do not know what it should do, but what I would have expected
>> in this case is that continued_fraction would first compute the
>> 53 bit approximation of the input, and then return the continued
>> fraction of that approximation.
>
> If this is what you want, the way to get that is to give it something
> that has 53 bits of precision.

I should add that I think some of the confusion comes in the way
symbolics and numerical approximations interact.

sage: sqrt(2).n() * sqrt(2)
1.41421356237310*sqrt(2)

This is, in general, a hard problem, as one needs to guess what the
user actually wants...

- Robert

-- 
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: continued_fraction returns nothing

2010-09-14 Thread Robert Bradshaw
On Tue, Sep 14, 2010 at 10:44 AM, Håkan Granath
 wrote:
> On Sep 14, 12:16 am, Robert Bradshaw 
> wrote:
>>
>> Alastair correctly deduced the issue that it can't tell if the number
>> is less than or greater than 2, what should it do here?
>
> I do not know what it should do, but what I would have expected
> in this case is that continued_fraction would first compute the
> 53 bit approximation of the input, and then return the continued
> fraction of that approximation.

If this is what you want, the way to get that is to give it something
that has 53 bits of precision.

> Not returning anything is quite unexpected.

Nothing != the empty list. In any case, I think it's better to only
give correct digits than have an arbitrary number of tail terms be
spurious random stuff that may or may not stabilize as the precision
goes up.

- Robert

-- 
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: documentation for implicit_plot

2010-09-14 Thread kcrisman


On Sep 14, 3:00 pm, "D.C. Ernst"  wrote:
> If I type the following into Sage (which is straight from the
> implicit_plot documentation), I get a black square:
>
> x,y=var('x,y')
> f(x,y) = x^2 + y^2 - 2
> implicit_plot(f, (-3, 3), (-3, 3),fill=True).show(aspect_ratio=1)
>
> Of course, if you remove "fill=True", then everything works as
> expected.  The documentation should probably remove the "fill=True",
> right?

Well, but it's supposed to demonstrate the fill option, which

   * ``fill`` -- boolean (default: ``False``); if ``True``, fill
the
 region f(x,y) < 0.

So perhaps there has been a regression - I get the same thing in both
4.5.3 and 4.3 (though in 4.3 I get a ghostly circle in the middle).
Not for the first time, we wish there were a way to do doctesting on
the image files produced...

sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=(0,0)).show(aspect_ratio=1)

doesn't do what we want either. In fact I'm having trouble getting
what I want with

sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=[0,0]).show(aspect_ratio=1)
sage: contour_plot(f, (-3, 3), (-3, 3),fill=True,contours=[-oo,
0]).show(aspect_ratio=1)
sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=[-1000,0]).show(aspect_ratio=1)

I'm not sure what happened here, because

sage: contour_plot(f, (-3, 3), (-3,
3),fill=True,contours=1).show(aspect_ratio=1)

doesn't give just one contour, either.

I can think of several people whose fault this could be, and I'm one
of them, but I'm not sure what's going on yet (albeit won't have time
to check it in detail now).  Can you file a Trac ticket for this
issue, and cc: kcrisman and jason on it?

Thanks,

- kcrisman

-- 
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: PhD student : SAGE help

2010-09-14 Thread John Cremona
I am copying my reply to sage-support@googlegroups.com since it is
better to ask questions there than to (busy!) individuals.

For general plane curves, the answer is "yes" but the general
algorithms are very slow (if the field is large).  For example,

sage: F = GF(4,'a')
sage: A2. = AffineSpace(F,2)
sage: C = Curve(x^3+y^2+y)
sage: C
Affine Curve over Finite Field in a of size 2^2 defined by x^3 + y^2 + y
sage: len(C.rational_points())
8

(here all rational points on C were found, and then counted).

Since your curve is an elliptic curve, however, there are very much
better methods available:

sage: F = GF(4,'a')
sage: E = EllipticCurve(F,[0,0,1,0,0])
sage: E.cardinality()
9

(there is one more point since this counts the points at infinity).

sage: E.cardinality(extension_degree=100)
1606938044258990275541962092338627301321746534979799428890625

(this is the cardinality of the same curve over GF(2^200)!)

J E Cremona

On Tue, Sep 14, 2010 at 7:15 PM, AL-ZUBI J.A.A. (492894)
 wrote:
>
>
> Dear Prof. John,
>
> Hello. I hope this e-mail finds you good. I know you are very busy person
> but I would be grateful if you can spare me few minutes to help me with the
> following:
>
> Is the software SAGE capable of counting and listing the rational points on
> a plane curve over a finite field ?
>
> as of if we have the curve equation:    C(x,y) = x^3+y^2+y   over the
> filed GF(2^2) ??
>
> Is it possible to find the basis of the curve ( linearly independent basis )
> using SAGE?
>
> your help will be highly appreciated.
>
> best regards.
>
> Jafar

-- 
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] documentation for implicit_plot

2010-09-14 Thread D.C. Ernst
If I type the following into Sage (which is straight from the
implicit_plot documentation), I get a black square:

x,y=var('x,y')
f(x,y) = x^2 + y^2 - 2
implicit_plot(f, (-3, 3), (-3, 3),fill=True).show(aspect_ratio=1)

Of course, if you remove "fill=True", then everything works as
expected.  The documentation should probably remove the "fill=True",
right?

Dana

-- 
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: continued_fraction returns nothing

2010-09-14 Thread Håkan Granath
On Sep 14, 12:16 am, Robert Bradshaw 
wrote:
>
> Alastair correctly deduced the issue that it can't tell if the number
> is less than or greater than 2, what should it do here?

I do not know what it should do, but what I would have expected
in this case is that continued_fraction would first compute the
53 bit approximation of the input, and then return the continued
fraction of that approximation.

Not returning anything is quite unexpected.

-- 
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: Test if p(x) is in a ring generated by polynomials

2010-09-14 Thread James Parson
On Sep 8, 2:57 am, Cary Cherng  wrote:
> I am not familiar with algebraic geometry or its terminology and new
> to sage.
>
> p_1,...p_n and q are elements of Z[x_1,...,x_n]. In my context I have
> some evidence that q can be written as something like q = p_1*p_2
> + ... + p_5*p_6. In other words q is a degree 2 polynomial in the
> p_i's. Can Sage find out if q can be written in terms of the p_i's?

Is this the question you are asking?

Let p_1,...,p_r and q be elements of Z[x_1,...,x_n]. How does one (use
Sage to) determine if q is in the subring generated by the p's (and to
represent q in terms of the p's, if this is possible)?

One can solve instances of this kind of problem with Groebner-basis
calculations. For any cases that are not tiny, however, these
calculations may not be feasible. (One could then try the linear-
algebra techniques already discussed.) I am not certain if Sage (via
Singular) is currently equipped to handle cases with Z coefficients,
but here is how things would look, if one were using Q coefficients:

I will show the case where n = r = 2 with p_1 = x_1*x_2, p_2 =
x_1+x_2, and q = x_1^2 + x_2^2.

sage: R. = PolynomialRing(QQ, 4, order = 'lex')
sage: q = x1^2 + x2^2
sage: I = R.ideal(p1 - x1*x2, p2 - (x1 + x2))
sage: q.reduce(I)
-2*p1 + p2^2

It is important to note that when one sets up the polynomial ring, the
variables to be eliminated (x1 and x2) come before the variables
representing the p's (p1 and p2). In order to get the Groebner-basis
algorithm to solve the problem, one must order the variables this way
and include the "order = 'lex'" bit in the definition of the
polynomial ring. When one uses these orders, one finds that if q were
not in the subring generated by the p's, the output after
"q.reduce(I)" would still have some x's in it.


Regards,

James Parson

-- 
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: summation

2010-09-14 Thread kcrisman


On Sep 14, 11:40 am, sps  wrote:
> So you say, I have to digit this:
> maxima_console()

Not exactly.  What I am saying is that Sage uses Maxima, another open
source mathematics program, to do symbolic summation.  I used Sage's
instance of this program to see what happened with the underlying
command which is passed to Maxima - and it turns out that the result
is a hypergeometric function; since you like Wikipedia, here is their
site about this http://en.wikipedia.org/wiki/Hypergeometric_function

> What's the meaning of the previous texts? Maxima hypergeometric? Can
> you post a clear sequence of command to give sage to have result?

This is the best Sage can currently do, probably because it lacks
native support for hypergeometric functions (?).  It looks like Maxima
can do this, though, using the syntax I describe.  You can always use
a Maxima session from inside Sage by doing maxima_console(), or in the
notebook with %maxima at the beginning of a cell.


> > > Can I find radius of convergence of series? How?
>
> > Can you give a more explicit example of what you'd like to calculate?
>
> Fromhttp://en.wikipedia.org/wiki/Radius_of_convergenceyou can see
> what I want to calculate: for example the series 2^n/n^2+(z-3+I)^n,
> what is its radius of convergence?

I see.  I don't know how easy this might be in general, except of
course by using the usual tests.   The thread
http://www.mail-archive.com/sage-support@googlegroups.com/msg06784.html
seems to have something related, though I think it focuses on
inequalities.

Someone else might know more; I don't think this is built in
functionality.

- kcrisman

-- 
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: summation

2010-09-14 Thread sps
So you say, I have to digit this:
maxima_console()
?

What are these other expressions? Can you explain better?
> 
> (%i1) load(simplify_sum);
> (%o1) /Users/.../sage-4.4.4/local/share/maxima/5.20.1/s\
> hare/contrib/solve_rec/simplify_sum.mac
> (%i2) simplify_sum(sum(((2*%i)^n/(n^3+1)*(1/4)^n),n,0,inf));
>
>                       sqrt(3) %i + 1  sqrt(3) %i - 1
> (%o2) %f    ([1, 1, - --, --],
>         4, 3                2               2
>                                            sqrt(3) %i - 1  sqrt(3) %i
> + 1   %i
>                                      [2, - --,
> --], --)
>                                                  2
> 2          2
>
> So looks like we need support for turning Maxima hypergeometric
> functions into Sage ones!  Burcin, does Pynac/Ginac support these?

What's the meaning of the previous texts? Maxima hypergeometric? Can
you post a clear sequence of command to give sage to have result?


> > Can I find radius of convergence of series? How?
>
> Can you give a more explicit example of what you'd like to calculate?

>From http://en.wikipedia.org/wiki/Radius_of_convergence you can see
what I want to calculate: for example the series 2^n/n^2+(z-3+I)^n,
what is its radius of convergence?

Thank you
sps
>
> - kcrisman

-- 
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: summation

2010-09-14 Thread kcrisman


On Sep 14, 11:08 am, sps  wrote:
> How can I calculate this summation:
>
> summation(from:0,to:+oo,((2*I)^n/(n^3+1)*(1/4)^n))
>
> in sage?
>

First I tried this:

--
| Sage Version 4.4.4, Release Date: 2010-06-23   |
| Type notebook() for the GUI, and license() for information.|
--
Loading Sage library. Current Mercurial branch is: hackbranch
sage: var('n')
n
sage: sum(((2*I)^n/(n^3+1)*(1/4)^n),n,0,oo)
---
TypeError Traceback (most recent call
last)

TypeError: unable to make sense of Maxima expression 'f[4,3]([1,1,-
(sqrt(3)*I+1)/2,(sqrt(3)*I-1)/2],[2,-(sqrt(3)*I-1)/2,(sqrt(3)*I+1)/
2],I/2)' in Sage

which made me want to know what Maxima was generating:

sage: maxima_console()

(%i1) load(simplify_sum);
(%o1) /Users/.../sage-4.4.4/local/share/maxima/5.20.1/s\
hare/contrib/solve_rec/simplify_sum.mac
(%i2) simplify_sum(sum(((2*%i)^n/(n^3+1)*(1/4)^n),n,0,inf));

  sqrt(3) %i + 1  sqrt(3) %i - 1
(%o2) %f([1, 1, - --, --],
4, 32   2
   sqrt(3) %i - 1  sqrt(3) %i
+ 1   %i
 [2, - --,
--], --)
 2
2  2


So looks like we need support for turning Maxima hypergeometric
functions into Sage ones!  Burcin, does Pynac/Ginac support these?

> Can I find radius of convergence of series? How?

Can you give a more explicit example of what you'd like to calculate?

- kcrisman

-- 
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: summation

2010-09-14 Thread Simon King
Hi!

On Sep 14, 4:08 pm, sps  wrote:
> How can I calculate this summation:
>
> summation(from:0,to:+oo,((2*I)^n/(n^3+1)*(1/4)^n))
>
> in sage?

Disclaimer: I am not an expert in symbolics (I am more into algebra).

I thought the following should work:
  sage: var('n')
  n
  sage: f = (2*I)^n/(n^3+1)*(1/4)^n
  sage: sum(f,0,infinity)

However, an error occurs.

The "sum" command uses Maxima to do the summation. Maxima apparently
gives an answer, but Sage does not understand it:
  TypeError: unable to make sense of Maxima expression 'f[4,3]([1,1,-
(sqrt(3)*I+1)/2,(sqrt(3)*I-1)/2],[2,-(sqrt(3)*I-1)/2,(sqrt(3)*I+1)/
2],I/2)' in Sage

So, there might be a bug here, or I made a mistake.

Best regards,
Simon

-- 
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] summation

2010-09-14 Thread sps
How can I calculate this summation:

summation(from:0,to:+oo,((2*I)^n/(n^3+1)*(1/4)^n))

in sage?

Can I find radius of convergence of series? How?

Thank you

-- 
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] error in latex()

2010-09-14 Thread Stan Schymanski
Dear all,

I think that I found an annoying bug in latex. In a notebook cell,

automatic_names(True)
latex(exp((298*S_j - H_j)/(298*R_m)))

gives

e^{\left(\frac{-H_{j} - 298 \, S_{j}}{298 \, R_{m}}\right)}

The sign of 298 S_j is reversed!!

Actually, is there a way to latexify an expression before it is
evaluated by sage? I find that the ordering of expressions that sage
applies not very convenient for display at times.

Thanks for your help!

Cheers
Stan

-- 
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: Obtaining data from a computation in process

2010-09-14 Thread Simon King
Hi Nick!

On Sep 13, 9:36 pm, Nick  wrote:
> Sorry, I just needed to be a little patient.  I eventually returned to
> the Sage command prompt.  Typed S and got back an empty set (I know it
> wouldn't have been completely empty).

OK, but ctrl-c will only interrupt the computation, but it will not
remove the content of S.

So, if you did not get a name error then S *was* empty at that time.
If you know that S will eventually be non-empty then (assuming that
your program works correctly) you will have to wait longer than your
first attempt.

Cheers,
Simon

-- 
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