[sage-support] var() function behavior changes when calculus.py is imported

2011-01-18 Thread Jean-Pierre Flori
When from sage.calculus.calculus import * is executed, the default
var() function from sage.calculus.var (L4) gets replaced by another
one from sage.symbolic.ring (L506).

There is indeed an import made in sage.calculus.calculus (L370).

However, the behavior of var() changes afterward because when var('n')
is called, the symbolic variable n is not automatically created.

So the following lines are valid before, but not after calling from
sage.calculus.calculus import *:

sage: var('n')
sage: n

Is this normal or should a ticket be opened ?

Cheers,
JP

-- 
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: any python plot3d ?

2011-01-18 Thread Marshall Hampton
Its not well documented, unfortunately.  I learned about from another
developer (Jason Grout, I think).  The patch creating it went in a
while ago:
http://trac.sagemath.org/sage_trac/ticket/6447

and I think they intended to add better documentation but no one did.

In the next year or so hopefully there will be more work on using
html5 and other recent browser improvements to do better 3d graphics
(webgl for instance).

-Marshall

On Jan 17, 6:33 pm, kkwweett joel.d...@gmail.com wrote:
 thanks Marshall,
 I tried viewer option but this is not working for me (firefox,ubuntu)
 even if it is already better than a yellow warning.
 I used example from video3 ofhttp://www.sagemath.org/help-video.html

 def f(x,y): return sin(x-y)*y*cos(x)
 plot3d(f(x,y),(x-3,3),(y,-3,3))

 but all I see is a blue flat grid (I can move it with the mouse
 though)

 How did you know about the viewer option ? I can't see it in the
 manual.

-- 
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: var() function behavior changes when calculus.py is imported

2011-01-18 Thread kcrisman
More explicitly:

sage: var('y')
y
sage: type(y)
type 'sage.symbolic.expression.Expression'
sage: from sage.calculus.calculus import *
sage: var('z')
z
sage: type(z)
---
snip
NameError: name 'z' is not defined

Huh.  Can I ask where one would import * from sage.calculus.calculus?
Though I also don't think this is good.

Also, one sees various imports of this.  I feel like messing with this
is asking for trouble, but there are a lot of different things done
here.

calculus/all.py:16:from var import (var, function, clear_vars)
functions/piecewise.py:83:from sage.calculus.all import var
symbolic/ring.pyx:766:sage: from sage.symbolic.ring import var
tensor/coordinate_patch.py:46:from sage.symbolic.ring import SR, var
tensor/differential_forms.py:46:from sage.symbolic.ring import SR, var
calculus/calculus.py:370:from sage.symbolic.ring import var, SR,
is_SymbolicVariable
calculus/desolvers.py:1187:from sage.calculus.var import var
calculus/desolvers.py:1493:from sage.symbolic.ring import
var
calculus/predefined.py:1:from sage.symbolic.ring import var as _var


On Jan 18, 4:59 am, Jean-Pierre Flori jpfl...@gmail.com wrote:
 When from sage.calculus.calculus import * is executed, the default
 var() function from sage.calculus.var (L4) gets replaced by another
 one from sage.symbolic.ring (L506).

 There is indeed an import made in sage.calculus.calculus (L370).

 However, the behavior of var() changes afterward because when var('n')
 is called, the symbolic variable n is not automatically created.

 So the following lines are valid before, but not after calling from
 sage.calculus.calculus import *:

 sage: var('n')
 sage: n

 Is this normal or should a ticket be opened ?

 Cheers,
 JP

-- 
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: Errors When Starting Sage-4.6.1

2011-01-18 Thread Marshall Hampton
I have no real idea what is going wrong there - I've never used Gentoo
and I suspect it must be something to do with its infrastructure.  But
one idea would be to retry with gcc 4.5.2; my impression is that there
are some significant improvements between the 4.4 and 4.5 series.

You might also want to repost this on sage-devel, since there might be
some Gentoo users who read that and not sage-support.

-M. Hampton

On Jan 17, 8:36 pm, Richard richj...@pacbell.net wrote:
 After compiling sage-4.6.1 (again), without errors in install.log, I try
 to start up sage and get the following:

  /usr/local/sage-4.6.1]$ ./sage
 --
 | Sage Version 4.6.1, Release Date: 2011-01-11                       |
 | Type notebook() for the GUI, and license() for information.        |
 --
 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1097, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1102, 0))

 ---
 TypeError                                 Traceback (most recent call last)

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/IPython/ipmaker.pyc
 in force_import(modname)
      64         reload(sys.modules[modname])
      65     else:
 --- 66         __import__(modname)
      67
      68

 /usr/local/sage-4.6.1/local/bin/ipy_profile_sage.py in module()
       5     preparser(True)
       6
  7     import sage.all_cmdline
       8     sage.all_cmdline._init_cmdline(globals())
       9

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/all_cmdline.py
 in module()
      12 try:
      13
 --- 14     from sage.all import *
      15     from sage.calculus.predefined import x
      16     preparser(on=True)

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/all.py in
 module()
      70 get_sigs()
      71
 --- 72 from sage.rings.all      import *
      73 from sage.matrix.all     import *
      74

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/all.py in
 module()
      91
      92 # Algebraic numbers

 --- 93 from qqbar import (AlgebraicRealField, is_AlgebraicRealField, AA,
      94                    AlgebraicReal, is_AlgebraicReal,
      95                    AlgebraicField, is_AlgebraicField, QQbar,

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/qqbar.py
 in module()
    4220     return isinstance(x, AlgebraicNumber)
    4221
 - 4222 QQbarPoly = PolynomialRing(QQbar, 'x')
    4223 AAPoly = PolynomialRing(AA, 'x')
    4224

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc
 in PolynomialRing(base_ring, arg1, arg2, sparse, order, names, name,
 implementation)
     341                 raise TypeError, if second arguments is a
 string with no commas, then there must be no other non-optional arguments
     342             name = arg1
 -- 343             R = _single_variate(base_ring, name, sparse,
 implementation)
     344         else:
     345             # 2-4. PolynomialRing(base_ring, names,
 order='degrevlex'):

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc
 in _single_variate(base_ring, name, sparse, implementation)
     421
     422         elif base_ring.is_field(proof = False):
 -- 423             R = m.PolynomialRing_field(base_ring, name, sparse,
 implementation=implementation)
     424
     425         elif base_ring.is_integral_domain(proof = False):

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.pyc
 in __init__(self, base_ring, name, sparse, element_class, implementation)
    1252                 element_class =
 polynomial_element_generic.Polynomial_generic_dense_field
    1253
 - 1254         PolynomialRing_integral_domain.__init__(self, base_ring,
 name=name, sparse=sparse, element_class=element_class)
    1255
    1256         self._has_singular = can_convert_to_singular(self)

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.pyc
 in __init__(self, base_ring, name, sparse, implementation, element_class)
    1187                     raise ValueError, Unknown implementation %s
 for ZZ[x]
    1188         PolynomialRing_commutative.__init__(self, base_ring,
 name=name,
 - 1189                 sparse=sparse, element_class=element_class)
    1190
    1191     def _repr_(self):

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.pyc
 in __init__(self, base_ring, name, sparse, element_class)
    1121             raise TypeError, Base 

[sage-support] Re: var() function behavior changes when calculus.py is imported

2011-01-18 Thread Jean-Pierre Flori
Hi,

 Huh.  Can I ask where one would import * from sage.calculus.calculus?
In my badly written code.
I wanted to call symbolic_sum which is not reachable by default,
rather than sum when doing some tests.

Cheers,
JP

-- 
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: var() function behavior changes when calculus.py is imported

2011-01-18 Thread kcrisman


On Jan 18, 11:03 am, Jean-Pierre Flori jpfl...@gmail.com wrote:
 Hi,

  Huh.  Can I ask where one would import * from sage.calculus.calculus?

 In my badly written code.
 I wanted to call symbolic_sum which is not reachable by default,
 rather than sum when doing some tests.

I see.  Why not just import that one function, in that case?  That is
a very natural thing to do.  Only import a whole namespace if you
really have to - it can really mess things up, as you have pointed
out.

What do you think about the other things - bugs, annoying, user error?

- 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: var() function behavior changes when calculus.py is imported

2011-01-18 Thread Jean-Pierre Flori
 I see.  Why not just import that one function, in that case?  That is
 a very natural thing to do.  Only import a whole namespace if you
 really have to - it can really mess things up, as you have pointed
 out.
I'm aware of that, that piece of code was stupid because I was lazy
when I wrote that.

 What do you think about the other things - bugs, annoying, user error?
Do you mean about the different import of var() ?
Both functions have in fact different uses and my problem arose
because of my bad programming.
I did not see it before, but it's stated in the note of calculus/
var.pyx var() function:
The new variable is both returned and automatically injected
   into the global namespace. If you need symbolic variable in
   library code, it is better to use either SR.var() or
SR.symbol().
So I guess there is no problem at all.
I should have been more careful and less noisy.

-- 
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] solving equation question --- rounding error ?

2011-01-18 Thread Eckhard Kosin
Hi tvn,

Am Montag, den 17.01.2011, 14:22 -0800 schrieb tvn:
 I try to solve for 3 variables x y z with 3 equations as below  ,
 I am expecting something like  z = r1, x = -r1, y = -2*r1  but instead
 get x = y = z = 0 (which trivially valid though not expected).   Is
 this because the numbers used too complex (equation 2)  and have some
 rounding errors ?   if not what's the cause and how to get around it ?
 Thanks  
 
 
 
 
 sage version 4.6.1
 
 
 solve([x + 0.106*y + 1.212*z == 0, 3.8759765625*x + 0.04801171875*y +
 3.972*z == 0, 3.0625*x + 0.09325*y + 3.249*z == 0],[x,y,z])
 [[x == 0, y == 0, z == 0]]   #not expected 
sage: A = matrix([[1, 0.106, 1.212], [3.8759765625, 0.04801171875,
3.972], [3.0625, 0.09325, 3.249]])
sage: A.rank()
3

Thus (0,0,0) is the unique solution of your system.

Cheers,

   Eckhard

 
 
 
 
 Is this due to rounding/precision error because if I replace the 2nd
 equation with another one  then it works fine  ?
 
 
 solve([x + 0.106*y + 1.212*z == 0, 2.25*x + 0.841*y + 3.932*z == 0,
 3.0625*x + 0.09325*y + 3.249*z == 0],[x,y,z])
 [[x == -r44, y == -2*r44, z == r44]]#expected
 
 
 
 -- 
 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
-- 
  Service für Mathematik und Simulation
  Dr. Eckhard Kosin, selbständiger Diplom-Mathematiker

  Am Nymphenbad 14
D-81245 München, Germany

  Tel.: (+49)(+89) 88 88 479
  Tel.,Fax: (+49)(+89) 835 844
  mailto:e...@mathematik-service-kosin.de
  http://www.mathematik-service-kosin.de

-- 
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] plot problem

2011-01-18 Thread Daniel Harris
Hello everybody

I am just looking at sketching graphs and I came across a problem that
has me stumped.  The graph I am trying to sketch is

(x-3) / ( (x+1) * (x-2) )

now I have plotted the graph in sage on my TI-83 and at wolfram and
they all different.  Now I am thinking is sage right and the others
wrong? or have I made an error inputting the equation?

I would certainly welcome some help on the issue

Thanks in advance

Dan

PS this is just for fun and not an exam piece or any test

-- 
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] plot problem

2011-01-18 Thread Robert Bradshaw
On Tue, Jan 18, 2011 at 2:35 PM, Daniel Harris
mail.dhar...@googlemail.com wrote:
 Hello everybody

 I am just looking at sketching graphs and I came across a problem that
 has me stumped.  The graph I am trying to sketch is

 (x-3) / ( (x+1) * (x-2) )

 now I have plotted the graph in sage on my TI-83 and at wolfram and
 they all different.  Now I am thinking is sage right and the others
 wrong? or have I made an error inputting the equation?

 I would certainly welcome some help on the issue

What range are you plotting over? -1  x  1? -5  x  5? This could
make a big difference on what the graph looks like. Likewise, what is
the scale of the y-axis? I don't think Sage yet tries to remove the
asymptotes at -1 and 2 from the plot.

- 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] solving equation question --- rounding error ?

2011-01-18 Thread tvn


On Tuesday, January 18, 2011 10:19:58 AM UTC-7, einek wrote:

 Hi tvn,

 Am Montag, den 17.01.2011, 14:22 -0800 schrieb tvn:
  I try to solve for 3 variables x y z with 3 equations as below  ,
  I am expecting something like  z = r1, x = -r1, y = -2*r1  but instead
  get x = y = z = 0 (which trivially valid though not expected).   Is
  this because the numbers used too complex (equation 2)  and have some
  rounding errors ?   if not what's the cause and how to get around it ?
  Thanks  
  
  
  
  
  sage version 4.6.1
  
  
  solve([x + 0.106*y + 1.212*z == 0, 3.8759765625*x + 0.04801171875*y +
  3.972*z == 0, 3.0625*x + 0.09325*y + 3.249*z == 0],[x,y,z])
  [[x == 0, y == 0, z == 0]]   #not expected 
 sage: A = matrix([[1, 0.106, 1.212], [3.8759765625, 0.04801171875,
 3.972], [3.0625, 0.09325, 3.249]])
 sage: A.rank()
 3

 Thus (0,0,0) is the unique solution of your system.


x=1,y=2,z=-1   is another solution (in fact there are many solutions  for 
this linear system of equations) .

 


Cheers,

Eckhard

  
  
  
  
  Is this due to rounding/precision error because if I replace the 2nd
  equation with another one  then it works fine  ?
  
  
  solve([x + 0.106*y + 1.212*z == 0, 2.25*x + 0.841*y + 3.932*z == 0,
  3.0625*x + 0.09325*y + 3.249*z == 0],[x,y,z])
  [[x == -r44, y == -2*r44, z == r44]]#expected
  
  
  
  -- 
  To post to this group, send email to sage-s...@googlegroups.com
  To unsubscribe from this group, send email to sage-support
  +unsub...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/sage-support
  URL: http://www.sagemath.org
 -- 
   Service für Mathematik und Simulation
   Dr. Eckhard Kosin, selbständiger Diplom-Mathematiker

   Am Nymphenbad 14
 D-81245 München, Germany

   Tel.: (+49)(+89) 88 88 479
   Tel.,Fax: (+49)(+89) 835 844
   mailto:e...@mathematik-service-kosin.de
   http://www.mathematik-service-kosin.de



-- 
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: solving equation question --- rounding error ?

2011-01-18 Thread Ben Edwards
 Thus (0,0,0) is the unique solution of your system.

Uh... not quite 'Thus'. The system in fact has an infinite number of
unique solutions, as the original poster pointed out. Though I don't
know why sage converges on [0,0,0]. Also just because a second sage
method gives the same result as the first does not mean something
isn't amiss.

-- 
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] plot problem

2011-01-18 Thread Daniel Harris
On Tue, Jan 18, 2011 at 10:51 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 On Tue, Jan 18, 2011 at 2:35 PM, Daniel Harris
 mail.dhar...@googlemail.com wrote:
 Hello everybody

 I am just looking at sketching graphs and I came across a problem that
 has me stumped.  The graph I am trying to sketch is

 (x-3) / ( (x+1) * (x-2) )

 now I have plotted the graph in sage on my TI-83 and at wolfram and
 they all different.  Now I am thinking is sage right and the others
 wrong? or have I made an error inputting the equation?

 I would certainly welcome some help on the issue

 What range are you plotting over? -1  x  1? -5  x  5? This could
 make a big difference on what the graph looks like. Likewise, what is
 the scale of the y-axis? I don't think Sage yet tries to remove the
 asymptotes at -1 and 2 from the plot.


-1.5   x  3 the y peak at x=2 is the part that bothers me.  It
doesnt seem to show up on my calc or wolfram alpha?

Dan

 - 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


-- 
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: solving equation question --- rounding error ?

2011-01-18 Thread Keshav Kini
Hello,

sage: A = matrix([[1, 0.106, 1.212], [3.8759765625, 0.04801171875,
: 3.972], [3.0625, 0.09325, 3.249]])
sage: A.rank()
3
sage: A.det()
0.000

Though sage computes the rank to be 3, the determinant is negligible.
Mathematica says the rank of this matrix is 2, and that its
determinant is -4.02835*10^(-17) (and reduces the system to `z =
-1.04202x + 0.0210102y`). Perhaps it's just an issue of the standard
precision for floating point real numbers. The matrix in question is
certainly very ill-conditioned.

By the way, this system doesn't have an infinite number of unique
solutions, though it does have an infinite number of distinct
solutions (just a quibble...).

-Keshav

On Jan 19, 6:58 am, Ben Edwards bjedwa...@gmail.com wrote:
  Thus (0,0,0) is the unique solution of your system.

 Uh... not quite 'Thus'. The system in fact has an infinite number of
 unique solutions, as the original poster pointed out. Though I don't
 know why sage converges on [0,0,0]. Also just because a second sage
 method gives the same result as the first does not mean something
 isn't amiss.

-- 
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] Bug in implicit_plot?

2011-01-18 Thread adrian
In the following I expected the line $y=x$ in red for q;  and the line
$y=-x$ in yellow for p.  The plot for p is as desired, but the plot
for q contains also the line $y=-x$.  This is using sage 4.6.1

#Is this a bug?
x,y=var('x y')
q=implicit_plot((x-y)/(x+y)==0,(x,-2,2),(y,-2,2),color='red')
p=implicit_plot((x+y)/(x-y)==0,(x,-2,2),(y,-2,2),color='yellow')
show(q)
show(p)
show(p+q)

-- 
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] solving equation question --- rounding error ?

2011-01-18 Thread Robert Bradshaw
 On Tuesday, January 18, 2011 10:19:58 AM UTC-7, einek wrote:

 Hi tvn,

 Am Montag, den 17.01.2011, 14:22 -0800 schrieb tvn:
  I try to solve for 3 variables x y z with 3 equations as below  ,
  I am expecting something like  z = r1, x = -r1, y = -2*r1  but instead
  get x = y = z = 0 (which trivially valid though not expected).   Is
  this because the numbers used too complex (equation 2)  and have some
  rounding errors ?   if not what's the cause and how to get around it ?
  Thanks
 
 
 
 
  sage version 4.6.1
 
 
  solve([x + 0.106*y + 1.212*z == 0, 3.8759765625*x + 0.04801171875*y +
  3.972*z == 0, 3.0625*x + 0.09325*y + 3.249*z == 0],[x,y,z])
  [[x == 0, y == 0, z == 0]]   #not expected
 sage: A = matrix([[1, 0.106, 1.212], [3.8759765625, 0.04801171875,
 3.972], [3.0625, 0.09325, 3.249]])
 sage: A.rank()
 3

 Thus (0,0,0) is the unique solution of your system.

The problem is rounding error. Over the rationals:

sage: A = matrix(3, 3, [QQ(a) for a in [1, 0.106, 1.212, 3.8759765625,
0.04801171875, 3.972, 3.0625, 0.09325, 3.249]])
sage: A
[   1   53/500  303/250]
[   3969/1024 12291/256000  993/250]
[   49/16 373/40003249/1000]

sage: A.rank()
 2

- 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: Errors When Starting Sage-4.6.1

2011-01-18 Thread Volker Braun
Are you using the gentoo ebuild or are you installing just the Sage source 
tarball? The latter is designed to be installed in a users home directory. 

-- 
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: plot problem

2011-01-18 Thread kcrisman


On Jan 18, 6:07 pm, Daniel Harris mail.dhar...@googlemail.com wrote:
 On Tue, Jan 18, 2011 at 10:51 PM, Robert Bradshaw





 rober...@math.washington.edu wrote:
  On Tue, Jan 18, 2011 at 2:35 PM, Daniel Harris
  mail.dhar...@googlemail.com wrote:
  Hello everybody

  I am just looking at sketching graphs and I came across a problem that
  has me stumped.  The graph I am trying to sketch is

  (x-3) / ( (x+1) * (x-2) )

  now I have plotted the graph in sage on my TI-83 and at wolfram and
  they all different.  Now I am thinking is sage right and the others
  wrong? or have I made an error inputting the equation?

  I would certainly welcome some help on the issue

  What range are you plotting over? -1  x  1? -5  x  5? This could
  make a big difference on what the graph looks like. Likewise, what is
  the scale of the y-axis? I don't think Sage yet tries to remove the
  asymptotes at -1 and 2 from the plot.

 -1.5   x  3 the y peak at x=2 is the part that bothers me.  It
 doesnt seem to show up on my calc or wolfram alpha?


This is really showing the asymptote.  If you do


sage: plot((x-3) / ( (x+1) * (x-2) ) ,(x,-1.5,3))

sage: plot((x-3) / ( (x+1) * (x-2) ) ,(x,-1.5,3),ymin=-10,ymax=10)

you'll see what I mean.  Unfortunately we don't have any 'guessing'
for the vertical range.  That's a bug and a feature at the same
time :)  A graphing calculator likely just picks something arbitrary
for that.

- 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: Bug in implicit_plot?

2011-01-18 Thread kcrisman
Here is a minimal example (implicit_plot does this, essentially):

sage: contour_plot(x/y==0,(x,-1,1),(y,-1,1), plot_points=150,
contours=(0,0), fill=False, cmap=[blue])

So the real question is why p *doesn't* have the 'wrong' line!

sage: C = contour_plot(x/y==0,(x,-1,1),(y,-1,1),plot_points=4,
contours=(0,0), fill=False, cmap=[blue])
sage: c = C[0]
sage: c.xy_data_array
[[1.0, 0.7, -0.33326, -1.0],
[2.9996, 1.0, -0.99967, -2.9996],
[-3.0009, -1.0004, 1.0, 3.0009],
[-1.0, -0.7, 0.33326, 1.0]]

And looking at the code for ContourPlot, this is somehow happening in
matplotlib.

else:
CS = subplot.contour(self.xy_data_array, contours,
cmap=cmap, extent=(x0,x1,y0,y1),
linewidths=linewidths,
linestyles=linestyles, label=options['legend_label'])


A mpl expert will have to take the story from here, but I suspect that
our use of subplot.contour is causing problems here - the
'contours=(0,0)' or something.  Hope someone else chimes in!

- kcrisman

On Jan 18, 6:36 pm, adrian nihilalienumcr...@gmail.com wrote:
 In the following I expected the line $y=x$ in red for q;  and the line
 $y=-x$ in yellow for p.  The plot for p is as desired, but the plot
 for q contains also the line $y=-x$.  This is using sage 4.6.1

 #Is this a bug?
 x,y=var('x y')
 q=implicit_plot((x-y)/(x+y)==0,(x,-2,2),(y,-2,2),color='red')
 p=implicit_plot((x+y)/(x-y)==0,(x,-2,2),(y,-2,2),color='yellow')
 show(q)
 show(p)
 show(p+q)

-- 
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: Errors When Starting Sage-4.6.1

2011-01-18 Thread Richard
I am NOT using the ebuild. 

I just downloaded sage-4.6.1.tar, created a /usr/local/sage-4.6.1
directory, chowned that directory to my user, un-tared it, executed
'export MAKE=make -j12' then 'make  make.out 21' and then a few
hours later tried to run it with './sage'.   I'll  try compiling it in
my home directory although I don't see how that would make a difference.

Thanks for the reply.



On 01/18/2011 04:32 PM, Volker Braun wrote:
 Are you using the gentoo ebuild or are you installing just the Sage
 source tarball? The latter is designed to be installed in a users home
 directory.  --
 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


Re: [sage-support] Re: Errors When Starting Sage-4.6.1

2011-01-18 Thread Richard
Thanks for the reply.  I think I'll try to re-post on sage-devel. 

(Although gcc-4.5.2 is in Gentoo's portage it is not in the 'stable'
branch yet. So I don't really know if I want to 'upgrade' gcc yet.)





On 01/18/2011 07:08 AM, Marshall Hampton wrote:
 I have no real idea what is going wrong there - I've never used Gentoo
 and I suspect it must be something to do with its infrastructure.  But
 one idea would be to retry with gcc 4.5.2; my impression is that there
 are some significant improvements between the 4.4 and 4.5 series.

 You might also want to repost this on sage-devel, since there might be
 some Gentoo users who read that and not sage-support.

 -M. Hampton

 On Jan 17, 8:36 pm, Richard richj...@pacbell.net wrote:
 After compiling sage-4.6.1 (again), without errors in install.log, I try
 to start up sage and get the following:

  /usr/local/sage-4.6.1]$ ./sage
 --
 | Sage Version 4.6.1, Release Date: 2011-01-11   |
 | Type notebook() for the GUI, and license() for information.|
 --
 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1097, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1102, 0))

 ---
 TypeError Traceback (most recent call last)

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/IPython/ipmaker.pyc
 in force_import(modname)
  64 reload(sys.modules[modname])
  65 else:
 --- 66 __import__(modname)
  67
  68

 /usr/local/sage-4.6.1/local/bin/ipy_profile_sage.py in module()
   5 preparser(True)
   6
  7 import sage.all_cmdline
   8 sage.all_cmdline._init_cmdline(globals())
   9

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/all_cmdline.py
 in module()
  12 try:
  13
 --- 14 from sage.all import *
  15 from sage.calculus.predefined import x
  16 preparser(on=True)

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/all.py in
 module()
  70 get_sigs()
  71
 --- 72 from sage.rings.all  import *
  73 from sage.matrix.all import *
  74

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/all.py in
 module()
  91
  92 # Algebraic numbers

 --- 93 from qqbar import (AlgebraicRealField, is_AlgebraicRealField, AA,
  94AlgebraicReal, is_AlgebraicReal,
  95AlgebraicField, is_AlgebraicField, QQbar,

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/qqbar.py
 in module()
4220 return isinstance(x, AlgebraicNumber)
4221
 - 4222 QQbarPoly = PolynomialRing(QQbar, 'x')
4223 AAPoly = PolynomialRing(AA, 'x')
4224

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc
 in PolynomialRing(base_ring, arg1, arg2, sparse, order, names, name,
 implementation)
 341 raise TypeError, if second arguments is a
 string with no commas, then there must be no other non-optional arguments
 342 name = arg1
 -- 343 R = _single_variate(base_ring, name, sparse,
 implementation)
 344 else:
 345 # 2-4. PolynomialRing(base_ring, names,
 order='degrevlex'):

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.pyc
 in _single_variate(base_ring, name, sparse, implementation)
 421
 422 elif base_ring.is_field(proof = False):
 -- 423 R = m.PolynomialRing_field(base_ring, name, sparse,
 implementation=implementation)
 424
 425 elif base_ring.is_integral_domain(proof = False):

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.pyc
 in __init__(self, base_ring, name, sparse, element_class, implementation)
1252 element_class =
 polynomial_element_generic.Polynomial_generic_dense_field
1253
 - 1254 PolynomialRing_integral_domain.__init__(self, base_ring,
 name=name, sparse=sparse, element_class=element_class)
1255
1256 self._has_singular = can_convert_to_singular(self)

 /usr/local/sage-4.6.1/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.pyc
 in __init__(self, base_ring, name, sparse, implementation, element_class)
1187 raise ValueError, Unknown implementation %s
 for ZZ[x]
1188 PolynomialRing_commutative.__init__(self, base_ring,
 name=name,
 - 1189 sparse=sparse, 

Re: [sage-support] Re: Errors When Starting Sage-4.6.1

2011-01-18 Thread Volker Braun
The error looks like it didn't build correctly. Is there anything suspicious 
in the install.log? Maybe rebuild the sage library (sage -ba).


-- 
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] Finite Group Homomorphism question

2011-01-18 Thread D. M. Monarres
Hello all,

Running into an issue with something. I must be missing something. Say I
construct two groups that I know are isomorphic.

sage: G = SymmetricGroup(5)
sage: r = G('(1,2,5,4,3)')
sage: s = G('(1,5),(3,4)')
sage: H = G.subgroup([r,s])
sage: H
Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]
sage: D = DihedralGroup(5)
sage: D
Dihedral group of order 10 as a permutation group

I get an TypeError when I try and construct a homomorphism between these two
groups.
sage: phi = D.hom( ['(1,2,5,4,3)', '(1,5)(3,4)'] , H)
---
TypeError Traceback (most recent call last)

/Users/ayeq/Dropbox/src/sdsu-sage-tutorial/ipython console in module()

/Users/ayeq/sage/local/lib/python2.6/site-packages/sage/structure/parent_gens.so
in sage.structure.parent_gens.ParentWithGens.hom
(sage/structure/parent_gens.c:3858)()

/Users/ayeq/sage/local/lib/python2.6/site-packages/sage/categories/homset.pyc
in __call__(self, x, y, check, on_basis)
432 return self.element_class_set_morphism(self, x)
433
-- 434 raise TypeError, Unable to coerce x (=%s) to a morphism in
%s%(x,self)
435
436 @lazy_attribute

TypeError: Unable to coerce x (=['(1,2,5,4,3)', '(1,5)(3,4)']) to a morphism
in Set of Morphisms from Dihedral group of order 10 as a permutation group
to Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)] in
Category of finite permutation groups


I have tried to do this in a few different ways. (by coercing the elements
first, etc...) Can somebody see what I am missing? Thank you in advance.

--
D. M. Monarres
dmmonar...@gmail.com

-- 
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: Finite Group Homomorphism question

2011-01-18 Thread D. M. Monarres
Ignore. I was stupid. Sorry for wasting bits.
--
D. M. Monarres
dmmonar...@gmail.com


On Tue, Jan 18, 2011 at 7:30 PM, D. M. Monarres dmmonar...@gmail.comwrote:

 Hello all,

 Running into an issue with something. I must be missing something. Say I
 construct two groups that I know are isomorphic.

 sage: G = SymmetricGroup(5)
  sage: r = G('(1,2,5,4,3)')
 sage: s = G('(1,5),(3,4)')
 sage: H = G.subgroup([r,s])
  sage: H
 Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]
  sage: D = DihedralGroup(5)
 sage: D
 Dihedral group of order 10 as a permutation group

 I get an TypeError when I try and construct a homomorphism between these
 two groups.
 sage: phi = D.hom( ['(1,2,5,4,3)', '(1,5)(3,4)'] , H)
 ---
 TypeError Traceback (most recent call last)

 /Users/ayeq/Dropbox/src/sdsu-sage-tutorial/ipython console in module()

 /Users/ayeq/sage/local/lib/python2.6/site-packages/sage/structure/parent_gens.so
 in sage.structure.parent_gens.ParentWithGens.hom
 (sage/structure/parent_gens.c:3858)()

 /Users/ayeq/sage/local/lib/python2.6/site-packages/sage/categories/homset.pyc
 in __call__(self, x, y, check, on_basis)
 432 return self.element_class_set_morphism(self, x)
 433
 -- 434 raise TypeError, Unable to coerce x (=%s) to a morphism in
 %s%(x,self)
 435
 436 @lazy_attribute

 TypeError: Unable to coerce x (=['(1,2,5,4,3)', '(1,5)(3,4)']) to a
 morphism in Set of Morphisms from Dihedral group of order 10 as a
 permutation group to Subgroup of SymmetricGroup(5) generated by
 [(1,2,5,4,3), (1,5)(3,4)] in Category of finite permutation groups


 I have tried to do this in a few different ways. (by coercing the elements
 first, etc...) Can somebody see what I am missing? Thank you in advance.

 --
 D. M. Monarres
 dmmonar...@gmail.com


-- 
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: Finite Group Homomorphism question

2011-01-18 Thread John H Palmieri
On Jan 18, 7:30 pm, D. M. Monarres dmmonar...@gmail.com wrote:
 Hello all,

 Running into an issue with something. I must be missing something. Say I
 construct two groups that I know are isomorphic.

         sage: G = SymmetricGroup(5)
 sage: r = G('(1,2,5,4,3)')
 sage: s = G('(1,5),(3,4)')
 sage: H = G.subgroup([r,s])
 sage: H
 Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]
 sage: D = DihedralGroup(5)
 sage: D
 Dihedral group of order 10 as a permutation group

 I get an TypeError when I try and construct a homomorphism between these two
 groups.
 sage: phi = D.hom( ['(1,2,5,4,3)', '(1,5)(3,4)'] , H)
 ---
 TypeError                                 Traceback (most recent call last)

 /Users/ayeq/Dropbox/src/sdsu-sage-tutorial/ipython console in module()

 /Users/ayeq/sage/local/lib/python2.6/site-packages/sage/structure/parent_ge 
 ns.so
 in sage.structure.parent_gens.ParentWithGens.hom
 (sage/structure/parent_gens.c:3858)()

 /Users/ayeq/sage/local/lib/python2.6/site-packages/sage/categories/homset.p yc
 in __call__(self, x, y, check, on_basis)
     432             return self.element_class_set_morphism(self, x)
     433
 -- 434         raise TypeError, Unable to coerce x (=%s) to a morphism in
 %s%(x,self)
     435
     436     @lazy_attribute

 TypeError: Unable to coerce x (=['(1,2,5,4,3)', '(1,5)(3,4)']) to a morphism
 in Set of Morphisms from Dihedral group of order 10 as a permutation group
 to Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)] in
 Category of finite permutation groups

 I have tried to do this in a few different ways. (by coercing the elements
 first, etc...) Can somebody see what I am missing? Thank you in advance.

This looks like a bug to me, but I'm not sure.  Anyway, you can do
this:

sage: PermutationGroupMorphism(D, H, D.gens(), H.gens())
Homomorphism : Dihedral group of order 10 as a permutation group --
Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]

(I don't know why D.hom(H.gens(), H) doesn't do the same thing...)

--
John

-- 
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: Finite Group Homomorphism question

2011-01-18 Thread D. M. Monarres
Thanks for the other command. I am writing a tutorial for my university and
am running into quite a few of these little gotcha's with these sort of
things.


--
D. M. Monarres
dmmonar...@gmail.com


On Tue, Jan 18, 2011 at 8:28 PM, John H Palmieri jhpalmier...@gmail.comwrote:

 On Jan 18, 7:30 pm, D. M. Monarres dmmonar...@gmail.com wrote:
  Hello all,
 
  Running into an issue with something. I must be missing something. Say I
  construct two groups that I know are isomorphic.
 
  sage: G = SymmetricGroup(5)
  sage: r = G('(1,2,5,4,3)')
  sage: s = G('(1,5),(3,4)')
  sage: H = G.subgroup([r,s])
  sage: H
  Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]
  sage: D = DihedralGroup(5)
  sage: D
  Dihedral group of order 10 as a permutation group
 
  I get an TypeError when I try and construct a homomorphism between these
 two
  groups.
  sage: phi = D.hom( ['(1,2,5,4,3)', '(1,5)(3,4)'] , H)
 
 ---
  TypeError Traceback (most recent call
 last)
 
  /Users/ayeq/Dropbox/src/sdsu-sage-tutorial/ipython console in
 module()
 
 
 /Users/ayeq/sage/local/lib/python2.6/site-packages/sage/structure/parent_ge
 ns.so
  in sage.structure.parent_gens.ParentWithGens.hom
  (sage/structure/parent_gens.c:3858)()
 
 
 /Users/ayeq/sage/local/lib/python2.6/site-packages/sage/categories/homset.p
 yc
  in __call__(self, x, y, check, on_basis)
  432 return self.element_class_set_morphism(self, x)
  433
  -- 434 raise TypeError, Unable to coerce x (=%s) to a morphism
 in
  %s%(x,self)
  435
  436 @lazy_attribute
 
  TypeError: Unable to coerce x (=['(1,2,5,4,3)', '(1,5)(3,4)']) to a
 morphism
  in Set of Morphisms from Dihedral group of order 10 as a permutation
 group
  to Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]
 in
  Category of finite permutation groups
 
  I have tried to do this in a few different ways. (by coercing the
 elements
  first, etc...) Can somebody see what I am missing? Thank you in advance.

 This looks like a bug to me, but I'm not sure.  Anyway, you can do
 this:

 sage: PermutationGroupMorphism(D, H, D.gens(), H.gens())
 Homomorphism : Dihedral group of order 10 as a permutation group --
 Subgroup of SymmetricGroup(5) generated by [(1,2,5,4,3), (1,5)(3,4)]

 (I don't know why D.hom(H.gens(), H) doesn't do the same thing...)

 --
 John

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.comsage-support%2bunsubscr...@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