[sage-support] color-fill plot help

2011-02-14 Thread Vasudev
Hi everyone,

I would like to know is there a plotting utility in Sage which plots a three
dimensional scalar(variable).. whose values at discrete form are stored in a
3D array

something similar i have seen is implicitplot3d of sage it is for
expressions is there something like that for numerical arrays (or matrices)

to be more precise u(x,y,z) < physical quantity

calculated value in an araay U(xdim,ydim,zdim) <--- discrete numerical array

those who are familiar with computational fluid dynamics think it as
'Mach-scene' or color fill plot ...

I hope i've explained my question clearly (if not please point out)...

eagerly waiting for replies..


reagards...

Vasu

-- 
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] Bug with ending line in question mark in NB

2011-02-14 Thread Vasudev
even i noticed that  i just dropped the ? mark instead of trying to
figure out why?

On Mon, Jan 31, 2011 at 3:15 PM, kcrisman  wrote:

> I think this is known, but I couldn't find the Trac ticket.
>
> If you end a line with a question mark in the notebook, even after a #
> (comment sign), the nb interprets this as a request for documentation,
> ending with (potentially) amusing/destructive results.
>
> is_prime(5) # Is this number prime?
> unknown object 'prime'
>
> or something like that.  Interestingly, one of my students noted that
>
>
> is_prime(5) # Is this number prime'?'
> True
>
> works.  I guess that's not totally surprising.  Still, it's
> unfortunate.  So if it isn't known, I'm reporting it.  Would it be
> quite easy to fix?  (?)
>
> - 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
>

-- 
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] Numpy Troubles

2011-02-14 Thread D. S. McNeil
I think it's neither Sage nor numpy that's at fault, it's a weird
interaction (Sage 4.6.1):

sage: import numpy
sage: numpy.binary_repr(17)
''
sage: numpy.binary_repr(int(17))
'10001'

and I think it's rooted in this fact:

sage: hex(17)
'11'
sage: hex(int(17))
'0x11'

That is, Sage capital-I Integers deliberately don't have the '0x'
prepended, and the numpy.binary_repr routine has lines

ostr = hex(num)
[..]
bin = ''.join([_lkup[ch] for ch in ostr[2:]])

which fail if the prefix isn't there.


Doug

-- 
Department of Earth Sciences
University of Hong Kong

-- 
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] Numpy Troubles

2011-02-14 Thread Graham Enos
Hi everyone,

I've run into some unexpected behavior with Numpy on Sage 4.6 (running
on Mac OS X 10.6.6). Specifically in the binary_repr function, I get
empty strings. For instance:

$ sage
--
| Sage Version 4.6, Release Date: 2010-10-30 |
| Type notebook() for the GUI, and license() for information.|
--
sage [1]: import numpy as np
sage [2]: np.version.version
'1.3.0'
sage [3]: np.binary_repr(17)
''
sage [4]: np.binary_repr(42)
''
sage [5]: np.binary_repr(3)
''

Whereas in my other Python installation (EPD), things work fine:

$ python
Enthought Python Distribution -- www.enthought.com
Version: 7.0-1 (32-bit)

Python 2.7.1 |EPD 7.0-1 (32-bit)| (r271:86832, Dec  3 2010, 15:41:32)
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.version.version
'1.5.1'
>>> np.binary_repr(17)
'10001'
>>> np.binary_repr(42)
'101010'
>>> np.binary_repr(3)
'11'

Is this an issue with the version of NumPy installed in Sage?

Best,
Graham

-- 
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] Link missing

2011-02-14 Thread Rolandb
Hi, link missing

Indices and tables

* Index
* Module Index
* Search Page

Requested page /doc/numerical_sage/py-modindex.html  could not be
found.

Roland

-- 
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] Typo: fiel

2011-02-14 Thread Rolandb
Hi, a typo.

How can I reload a Python script in a Sage session?

You can load a Python script in a Sage session with the command load.
For example, we could use Sage to import a file called simple.py with:

load("simple.py")

and repeat this command every time that we change the fiel simple.py.
However, if we type:

attach("simple.py")

every change applied to the file simple.py will be automatically
updated in Sage.

Roland

-- 
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: Error in using PolynomialRing(QQ, vars) and elimination_ideal()

2011-02-14 Thread Simon King
Ceterum censeo: The use of symbolic expressions for the creation of a
polynomial ring should be deprecated (see trac ticket #10483).

Mistaking a symbolic expression for an element of a polynomial ring of
the same name is a *very* common error, and would be easy to avoid by
making the PolynomialRing constructor insist that the names be given
by a list of strings or by one string and one integer - it should not
try to make sense of string representations of arbitrary objects.

Hence:
We should ban
  sage: R = PolynomialRing(QQ,names=[singular])
  sage: R
  Univariate Polynomial Ring in Singular over Rational Field
(Note that singular in lower case [which is the Sage pseudo-tty
interface to Singular] is interpreted as the variable name Singular in
upper case)
  sage: QQ[(sage0,)]
  Univariate Polynomial Ring in Sage over Rational Field
(dito, but this time the interface sage0 to a sage subprocess is read
as "Sage").

And we should deprecate
  sage: gens = var('x y z')
  sage: PolynomialRing(QQ,gens)
  Multivariate Polynomial Ring in x, y, z over Rational Field

The recommended ways of creating a polynomial ring are actually
shorter than the hopefully-to-be-deprecated way:
  sage: R. = QQ[] # which defines x,y,z globally, but only on
the command line
or
  sage: R = QQ['x, y, z']
or
  sage: R = QQ['x', 'y', 'z']

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


[sage-support] Re: Error in using PolynomialRing(QQ, vars) and elimination_ideal()

2011-02-14 Thread Nils Bruin
On Feb 14, 9:54 am, tvn  wrote:
> sage: R.=QQ[]
This is a shorthand notation that assigns to x, ..., m the polynomial
variables generating QQ[x,y,z,...,m]
> sage: J=I.elimination_ideal([k,i,j,m,A,B])
This routine expects a list of polynomial variables as argument

> Version 2:
> sage: vs = var('x,y,z,A,B,k,i,j,m')
This is the special "top level" var, that also binds x,...,m to the
*symbolic variables* x,...,m

> sage: R = PolynomialRing(QQ,vs)
This creates the right polynomial ring because it can figure out what
to do with the symbolic variables given as an argument. However, the
identifiers x,...,m still refer to the symbolic variables with the
same print names.
> sage: I = R*invs
Your "invs" consists of symbolic expressions. However, they only
contain variable names whose print names match the generating
polynomial variables for R, so sage can figure out how to map over
these symbolic expressions to R and generate the right ideal there.
See "coercion framework" for the tricks employed for that.
> sage: J=I.elimination_ideal([k,i,j,m,A,B])
You are calling this routine with a list of *symbolic variables*. This
routine does not try to use the coercion framework (perhaps it
should), so when you give it a list of symbolic variables it doesn't
know what to do. If you explicitly convert the symbolic variables to
polynomial ones, it does work:

sage: I.elimination_ideal( list(R(v) for v in [k,i,j,m,A,B]) )

Example:

sage: x_symbolic=SR.var('x')
sage: x_polynomial=QQ['x','y'].0
sage: L=[x_polynomial, x_symbolic]
sage: L
[x, x]
sage: [type(a) for a in L]
[,
]

The problem is that there can be a lot of "x"s: There is x the python/
sage variable, which is bound to some object. Then there are several
objects: a "symbolic expression" that happens to print as "x" and an
element of a polynomial ring that happens to print as "x".
Some shorthands in sage try to hide the difference between the python
variable and the object it is bound to, by implicitly making that
binding. This is convenient for casual use. However, when you mix
polynomial rings and symbolic expressions there is not a clear choice
anymore and you are better off ensuring you preserve the distinction
between python variables and mathematical objects that happen to be
called (symbolic or polynomial) variables.

sage: x=x_symbolic
sage: parent(x)
Symbolic Ring
sage: x=x_polynomial
sage: parent(x)
Multivariate Polynomial Ring in x, y over Rational Field

-- 
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: Error in using PolynomialRing(QQ, vars) and elimination_ideal()

2011-02-14 Thread luisfe
The first method creates the ring AND add the variables so that they
are available to the user by tipping their name. for instance:

sage: R.=QQ[]
sage: x
x
sage: type(x)


Note that this is not python, but a sage-specific shortcut.


However, the second creation of R only creates a polynomial ring with
variables x,y,z,A,B,k,i,j,m.

sage: vs = var('x,y,z,A,B,k,i,j,m')
sage: x
x
sage: type(x)


x is a symbolic variable (not a polynomial variable)

sage: R = PolynomialRing(QQ,vs)
sage: x
x
sage: type(x)


x is still a symbolic variable. Not an element of R. Sage is smart
enough to make sense of the creation of the ideal. But you cannot
eliminate the variables k,i,j,m,A,B from the ideal because this
variables are symbolic variables. Not the variables of R.

What would be equivalent to the first method would be:

sage: vs = var('x,y,z,A,B,k,i,j,m')
sage: R = PolynomialRing(QQ,vs)
sage: R
Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over
Rational
Field
sage: R.inject_variables()
Defining x, y, z, A, B, k, i, j, m
sage: invs = [i*A+j*B-x,k*A+m*B-y,(i-k)*A+(j-m)*B-z]
sage: I = R*invs
sage: I
Ideal (A*i + B*j - x, A*k + B*m - y, -A*k + A*i + B*j - B*m - z) of
Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over
Rational
Field
sage: J=I.elimination_ideal([k,i,j,m,A,B])



The method R.inject_variables() introduces the variables in the
polynomialring so that the user can acces them.

Why is this?

Suppose that you define

sage: R1 = QQ['t']
sage: R2 = GF(2)['t']
sage: R3 = QQ['t','s']

This creates three rings. Where t should belong to? Each of those
polynomial ring introduces its own variable t and it may happen that I
just want the variable t to be other thing different from those
variables.

In fact, what Sage is really doing with your first attempt is:

sage: preparse('R.=QQ[]')
"R = QQ['x, y, z, A, B, k, i, j, m']; (x, y, z, A, B, k, i, j, m,) =
R._first_ngens(9)"

Creating the ring R and then inserting the variables so they are
available to the user.


On Feb 14, 6:54 pm, tvn  wrote:
> I thought the below 2 versions would be the same but version 2 using
> PolynomialRing(QQ,vars) seems to have problem as listed below.  Am I missing
> something  ?
>
> Version 1:
>
> --
> | Sage Version 4.6.1, Release Date: 2011-01-11   |
> | Type notebook() for the GUI, and license() for information.|
> --
> sage: R.=QQ[]
> sage: R
> Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational
> Field
> sage: invs = [i*A+j*B-x,k*A+m*B-y,(i-k)*A+(j-m)*B-z]
> sage: I = R*invs
> sage: I
> Ideal (A*i + B*j - x, A*k + B*m - y, -A*k + A*i + B*j - B*m - z) of
> Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational
> Field
> sage: J=I.elimination_ideal([k,i,j,m,A,B])
> sage:
>
> Version 2:
>
> $ sage
> --
> | Sage Version 4.6.1, Release Date: 2011-01-11   |
> | Type notebook() for the GUI, and license() for information.|
> --
> sage: vs = var('x,y,z,A,B,k,i,j,m')
> sage: R = PolynomialRing(QQ,vs)
> sage: R
> Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational
> Field
> sage: invs = [i*A+j*B-x,k*A+m*B-y,(i-k)*A+(j-m)*B-z]
> sage: I = R*invs
> sage: I
> Ideal (A*i + B*j - x, A*k + B*m - y, -A*k + A*i + B*j - B*m - z) of
> Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational
> Field
> sage: J=I.elimination_ideal([k,i,j,m,A,B])
> ---
> TypeError Traceback (most recent call last)
>
> /home/tnguyen/USB/SVN/DCBA/code/ in ()
>
> /home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc
> in wrapper(*args, **kwds)
> 367 """
> 368 with RedSBContext():
> --> 369 return func(*args, **kwds)
> 370
> 371 from sage.misc.sageinspect import sage_getsource
>
> /home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc
> in elimination_ideal(self, variables)
>1822 R = self.ring()
>1823 Is = MPolynomialIdeal(R,self.groebner_basis())
> -> 1824 return MPolynomialIdeal(R, eliminate(Is, prod(variables)) )
>1825
>1826 @redSB
>
> /home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/libs/singular/function.so
> in sage.libs.singular.function.SingularFunction.__call__
> (sage/libs/singular/function.cpp:9634)()
>
> /home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/libs/singular/function.so
> in sage.libs.singular.function.call_function
> (sage/libs/singular/function.cpp:10594)()
>
> /home/tnguyen/Src/Devel/sage/local/lib/pytho

[sage-support] Re: Given a set of equations (which contains variables v1,...,vn), solve for a variable v_i in terms of variables v_k,v_j, ...

2011-02-14 Thread tvn
Thanks,  it seems to be what I need.   Though I try to generate the 
PolynomialRing slightly different and and this seems to cause problem in 
using elimination_ideal()  

sage: vs = var('x,y,z,A,B,k,i,j,m')
sage: R = PolynomialRing(QQ,vs)
sage: invs = [i*A+j*B-x,k*A+m*B-y,(i-k)*A+(j-m)*B-z]
sage: I = R*invs
sage: J=I.elimination_ideal([k,i,j,m,A,B])
TypeError.



Any idea what was wrong ?  I also posted the problem and the trace in 
another post.  

-- 
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 using PolynomialRing(QQ, vars) and elimination_ideal()

2011-02-14 Thread tvn
I thought the below 2 versions would be the same but version 2 using 
PolynomialRing(QQ,vars) seems to have problem as listed below.  Am I missing 
something  ?  


Version 1:  

--
| Sage Version 4.6.1, Release Date: 2011-01-11   |
| Type notebook() for the GUI, and license() for information.|
--
sage: R.=QQ[] 
sage: R
Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational 
Field
sage: invs = [i*A+j*B-x,k*A+m*B-y,(i-k)*A+(j-m)*B-z]
sage: I = R*invs
sage: I
Ideal (A*i + B*j - x, A*k + B*m - y, -A*k + A*i + B*j - B*m - z) of 
Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational 
Field
sage: J=I.elimination_ideal([k,i,j,m,A,B])
sage: 


Version 2:

$ sage
--
| Sage Version 4.6.1, Release Date: 2011-01-11   |
| Type notebook() for the GUI, and license() for information.|
--
sage: vs = var('x,y,z,A,B,k,i,j,m')
sage: R = PolynomialRing(QQ,vs)
sage: R
Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational 
Field
sage: invs = [i*A+j*B-x,k*A+m*B-y,(i-k)*A+(j-m)*B-z]
sage: I = R*invs
sage: I
Ideal (A*i + B*j - x, A*k + B*m - y, -A*k + A*i + B*j - B*m - z) of 
Multivariate Polynomial Ring in x, y, z, A, B, k, i, j, m over Rational 
Field
sage: J=I.elimination_ideal([k,i,j,m,A,B])
---
TypeError Traceback (most recent call last)

/home/tnguyen/USB/SVN/DCBA/code/ in ()

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc
 
in wrapper(*args, **kwds)
367 """
368 with RedSBContext():
--> 369 return func(*args, **kwds)
370 
371 from sage.misc.sageinspect import sage_getsource 

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc
 
in elimination_ideal(self, variables)
   1822 R = self.ring()
   1823 Is = MPolynomialIdeal(R,self.groebner_basis())
-> 1824 return MPolynomialIdeal(R, eliminate(Is, prod(variables)) )
   1825 
   1826 @redSB

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/libs/singular/function.so
 
in sage.libs.singular.function.SingularFunction.__call__ 
(sage/libs/singular/function.cpp:9634)()

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/libs/singular/function.so
 
in sage.libs.singular.function.call_function 
(sage/libs/singular/function.cpp:10594)()

/home/tnguyen/Src/Devel/sage/local/lib/python2.6/site-packages/sage/libs/singular/function.so
 
in sage.libs.singular.function.Converter.__init__ 
(sage/libs/singular/function.cpp:5060)()

TypeError: unknown argument type ''





-- 
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] sage worksheet math processing loops

2011-02-14 Thread LeonSwinkels
Hi everybody,

I have installed sage on 64 bit ubuntu (sage-4.6.1-linux-64bit-
ubuntu_10.04.1_lts-x86_64-Linux.tar.lzma) and am running the notebook
on port 8000, using it from a remote location ( my workplace ).

When I create a new worksheet everything runs as expected, yet after a
few operations ( usually in the first 4-5 minutes ) the math updating
( bottom of the page: processing math ) keeps running. ( starts, runs,
finishes ) <- many times.

This does not change with different browsers ( IE/Chrome ) and the
problem recurs using a new worksheet, but also stops after closing the
browser window and returning after a few minutes.

Is this a known issue? Is there anything I can do against it? This
prevents me from working with sage at the moment.

Thank you all very much in advance,

Leon

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