[sage-support] Strange bug connected to GAP as a backend

2022-11-20 Thread 'Peter Mueller' via sage-support
Start with

g = SymmetricGroup(3)
chi = g.trivial_character()
u = g.subgroup([])

Next

reg = u.trivial_character().induct(g)
print(chi.scalar_product(reg))

yields as expected the answer 1.

Now repeat the very same two lines, but before doing so compute the  
representatives of conjugacy classes of subgroups:

lg = g.conjugacy_classes_subgroups()
reg = u.trivial_character().induct(g)
print(chi.scalar_product(reg))

This results in
---
GAPError  Traceback (most recent call last)
[...]
GAPError: Error, no method found! Error, no 1st choice method found for `=' 
on 2 arguments

I omit the full traceback, because it is very well reproducible in versions 
9.7 and 9.8.beta3, and also on the SageCell.

-- Peter Müller

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/d381c4c3-0a3a-495b-8953-4802639ede50n%40googlegroups.com.


Re: [sage-support] Strange behavior when evaluating multivariate polynomials over integers modulo n

2021-03-08 Thread Dima Pasechnik
On Mon, Mar 8, 2021 at 12:27 PM Alex Braat  wrote:
>
> Small update:
> Replacing Integers(p^2) by QuotientRing(ZZ, p^2) seems to fix the issue.

Could you open a trac ticket on this?
It looks as if multivariate polynomial rings over Integers(p^2) are
directly using Singular,
but I don't think Singular can do such computations (over non-fields)

QuotientRing(ZZ, p^2) does something else.

>
> Op maandag 8 maart 2021 om 10:34:06 UTC+1 schreef dim...@gmail.com:
>>
>> On Mon, Mar 8, 2021 at 9:25 AM Alex Braat  wrote:
>> >
>> > Hello,
>> >
>> > I have encountered some strange behavior when I evaluate multivariate 
>> > polynomials over the integers modulo n. For instance,
>> >
>> > In:
>> > p = 3
>> > S = Integers(p^2)
>> > R. = PolynomialRing(S)
>> > f = x^2 * y^2
>> > print(f([S(p),S(1)]), f([S(1), S(p)]))
>> >
>> > Out:
>> > 1 0
>> >
>> > while both evaluations should ofcourse be equal to 0. This does not depend 
>> > on the prime p, and is consistent in both of these versions of SageMath:
>>
>> looks like a bug (also in the 9.3.beta7)
>> sage: f(S(3),S(1))
>> 1
>>
>>
>> >
>> > 'SageMath version 8.7, Release Date: 2019-03-23'
>> > 'SageMath version 9.2, Release Date: 2020-10-24'
>> >
>> > Am I doing something wrong or is this a bug?
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "sage-support" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to sage-support...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/sage-support/e3b67e84-1d8b-46e4-b0dd-5558f6d4929bn%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/c860111e-aeea-43ff-b6c5-5c392e590789n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq0aFG%3Drtp%3DffKQc1T3ykWAXE0niAV0oQ2SQif9cRzU3Yg%40mail.gmail.com.


Re: [sage-support] Strange behavior when evaluating multivariate polynomials over integers modulo n

2021-03-08 Thread Alex Braat
Small update:
Replacing Integers(p^2) by QuotientRing(ZZ, p^2) seems to fix the issue.

Op maandag 8 maart 2021 om 10:34:06 UTC+1 schreef dim...@gmail.com:

> On Mon, Mar 8, 2021 at 9:25 AM Alex Braat  wrote:
> >
> > Hello,
> >
> > I have encountered some strange behavior when I evaluate multivariate 
> polynomials over the integers modulo n. For instance,
> >
> > In:
> > p = 3
> > S = Integers(p^2)
> > R. = PolynomialRing(S)
> > f = x^2 * y^2
> > print(f([S(p),S(1)]), f([S(1), S(p)]))
> >
> > Out:
> > 1 0
> >
> > while both evaluations should ofcourse be equal to 0. This does not 
> depend on the prime p, and is consistent in both of these versions of 
> SageMath:
>
> looks like a bug (also in the 9.3.beta7)
> sage: f(S(3),S(1))
> 1
>
>
> >
> > 'SageMath version 8.7, Release Date: 2019-03-23'
> > 'SageMath version 9.2, Release Date: 2020-10-24'
> >
> > Am I doing something wrong or is this a bug?
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sage-support" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-support...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/e3b67e84-1d8b-46e4-b0dd-5558f6d4929bn%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/c860111e-aeea-43ff-b6c5-5c392e590789n%40googlegroups.com.


Re: [sage-support] Strange behavior when evaluating multivariate polynomials over integers modulo n

2021-03-08 Thread Dima Pasechnik
On Mon, Mar 8, 2021 at 9:25 AM Alex Braat  wrote:
>
> Hello,
>
> I have encountered some strange behavior when I evaluate multivariate 
> polynomials over the integers modulo n. For instance,
>
> In:
> p = 3
> S = Integers(p^2)
> R. = PolynomialRing(S)
> f = x^2 * y^2
> print(f([S(p),S(1)]), f([S(1), S(p)]))
>
> Out:
> 1 0
>
> while both evaluations should ofcourse be equal to 0. This does not depend on 
> the prime p, and is consistent in both of these versions of SageMath:

looks like a bug (also in the 9.3.beta7)
sage: f(S(3),S(1))
1


>
> 'SageMath version 8.7, Release Date: 2019-03-23'
> 'SageMath version 9.2, Release Date: 2020-10-24'
>
> Am I doing something wrong or is this a bug?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/e3b67e84-1d8b-46e4-b0dd-5558f6d4929bn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq3W2Y47dMdY_zJSDcL_2_5aw%3DTnqqqnOrt9WGCNcwKcDQ%40mail.gmail.com.


[sage-support] Strange behavior when evaluating multivariate polynomials over integers modulo n

2021-03-08 Thread Alex Braat
Hello,

I have encountered some strange behavior when I evaluate multivariate 
polynomials over the integers modulo n. For instance,

In:
p = 3
S = Integers(p^2)
R. = PolynomialRing(S)
f = x^2 * y^2
print(f([S(p),S(1)]), f([S(1), S(p)]))

Out:
1 0

while both evaluations should ofcourse be equal to 0. This does not depend 
on the prime p, and is consistent in both of these versions of SageMath:

'SageMath version 8.7, Release Date: 2019-03-23'
'SageMath version 9.2, Release Date: 2020-10-24'

Am I doing something wrong or is this a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/e3b67e84-1d8b-46e4-b0dd-5558f6d4929bn%40googlegroups.com.


[sage-support] Strange behavior in relabeling a graph in Sage 9.2

2021-01-08 Thread Nikos Apostolakis
Dear list,

Relabeling a graph in Sage 9.2 exhibits some strange behavior.  If the
argument is a dictionary constructed by dictionary comprehension Sage seems
to just ignore it.  If the dictionary is explicitly given then everything
works.  Here is an example

sage: bar = DiGraph([((2, 3), (1, 2), 2), ((3, 4), (3, 5), 3), ((3, 5), (2,
3), 3), ((5, 6), (5, 7), 5), ((5, 7), (3, 5), 5)])
sage: foo = [(5,6), (3,4), (5,7), (3,5), (2,3), (1,2)]
sage: bar.relabel({foo[i]: i for i in range(6)})
sage: bar.vertices()
[(1, 2), (2, 3), (3, 4), (3, 5), (5, 6), (5, 7)]
sage: ## However if I explicitly give the dictionary
sage: {foo[i]: i for i in range(6)}
{(5,6): 0, (3,4): 1, (5,7): 2, (3,5): 3, (2,3): 4, (1,2): 5}
sage: bar.relabel({(5,6): 0, (3,4): 1, (5,7): 2, (3,5): 3, (2,3): 4, (1,2):
5})
sage: bar.vertices()
[0, 1, 2, 3, 4, 5]
sage: sage0_version()
'SageMath version 9.2, Release Date: 2020-10-24'


This problem doesn't seem to happen in older versions of Sage. I have Sage
8.8 in another box and the problem doesn't occur:

sage: bar = DiGraph([((2, 3), (1, 2), 2), ((3, 4), (3, 5), 3), ((3, 5), (2,
3), 3), ((5, 6), (5, 7), 5), ((5, 7), (3, 5), 5)])
sage: foo = [(5,6), (3,4), (5,7), (3,5), (2,3), (1,2)]
sage: bar.relabel({foo[i]: i for i in range(6)})
sage: bar.vertices()
[0, 1, 2, 3, 4, 5]
sage: sage0_version()
'SageMath version 8.8, Release Date: 2019-06-26'

I wonder if this is caused by the transition to Python3. Some kind of lazy
evaluation?

Thanks,
Nikos Apostolakis
-- 
Οι ελαφροί ας με λέγουν ελαφρόν.
Στα σοβαρά πράγματα ήμουν πάντοτε
επιμελέστατος.

The frivolous can call me frivolous. In serious matters I've always been
most diligent.
  K. P. Kavafy

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAO2SUmJnoUBYS88n4QP0oU_9odJVKJE053wLSH3%3Dz2ggeNDAAw%40mail.gmail.com.


Re: [sage-support] Strange

2018-04-07 Thread Nikos Apostolakis
Graph(7) creates a graph with vertices {0 ..., 6}

HTH,
Nikos

Sent from my iPhone 

> On Apr 7, 2018, at 9:16 AM, Henri Girard  wrote:
> 
> thanks, I tried david suggestion and it's correct now :
> 
> edges = [(1,2), (1,3), (1,4),
> (2,3), (2,4), (2,5), (2, 6),
> (3,4), (3,5), (3,6), (3,7),
> (4,6), (4,7), (5,6), (6,7)]
> Gamma = Graph(edges)
> Gamma.show() 
> 
> 
> 
> Meanwhile I made it too with networkx to compare :
> 
> import networkx as nx  
> import matplotlib.pyplot as plt
> G = nx.Graph()
>
> edges = [(1,2), (1,3), (1,4), 
> (2,3), (2,4), (2,5), (2, 6), 
> (3,4), (3,5), (3,6), (3,7), 
> (4,6), (4,7), (5,6), (6,7)]
> G.add_edges_from(edges)   
>
> nx.draw_networkx(G)   
>
> limits = plt.axis('off')  
>
> plt.show(G)  
> 
> 
> 
> 
>> Le 07/04/2018 à 15:09, Jan Groenewald a écrit :
>> Hi
>> 
>>> On 7 April 2018 at 14:52, Henri Girard  wrote:
>>> I made this graph (meaning a fano's plane) but I have the zero outside the 
>>> graph ?
>>> 
>>> I don't understand why ? someone could explain ?
>>> 
>>> My adjacency_matrix is 8 but shouldn't be 7 ?
>>> 
>>> g=Graph(7)
>>> edges = [(1,2), (1,3), (1,4), 
>>> (2,3), (2,4), (2,5), (2, 6), 
>>> (3,4), (3,5), (3,6), (3,7), 
>>> (4,6), (4,7), (5,6), (6,7)]
>>> g.add_edge(1,2),g.add_edge(1,3),g.add_edge(1,4),g.add_edge(2,3),
>>> g.add_edge(2,4),g.add_edge(2,5),g.add_edge(2,6),g.add_edge(3,4),
>>> g.add_edge(3,5),g.add_edge(3,6),g.add_edge(3,7),g.add_edge(4,6),
>>> g.add_edge(4,7),g.add_edge(5,6),g.add_edge(6,7)
>>> g.show()
>>> g.adjacency_matrix(),g.incidence_matrix()
>>> 
>>> 
>>> 
>>> Best
>>> 
>> 
>> 
>> Graph? shows
>> 
>>   2. "Graph(5)" -- return an edgeless graph on the 5 vertices
>>  0,...,4.
>> 
>>   3. "Graph([list_of_vertices,list_of_edges])" -- returns a
>>  graph with given vertices/edges.
>> 
>>  To bypass auto-detection, prefer the more explicit
>>  "Graph([V,E],format='vertices_and_edges')".
>> 
>>   4. "Graph(list_of_edges)" -- return a graph with a given list
>>  of edges (see documentation of "add_edges()").
>> 
>>  To bypass auto-detection, prefer the more explicit "Graph(L,
>>  format='list_of_edges')".
>> 
>>   5. "Graph({1:[2,3,4],3:[4]})" -- return a graph by
>>  associating to each vertex the list of its neighbors.
>> 
>>  To bypass auto-detection, prefer the more explicit "Graph(D,
>>  format='dict_of_lists')".
>> 
>> so it seems correct, and there are alternatives if you prefer 1..8 instead 
>> of 0..7.
>> 
>> Regards,
>> Jan 
>>> 
>> 
>> 
>> 
>> -- 
>>   .~. 
>>   /V\ Jan Groenewald
>>  /( )\www.aims.ac.za
>>  ^^-^^ 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-support+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-support@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sage-support.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Strange

2018-04-07 Thread Henri Girard

thanks, I tried david suggestion and it's correct now :

edges = [(1,2), (1,3), (1,4),
    (2,3), (2,4), (2,5), (2, 6),
    (3,4), (3,5), (3,6), (3,7),
    (4,6), (4,7), (5,6), (6,7)]
Gamma = Graph(edges)
Gamma.show()


Meanwhile I made it too with networkx to compare :

import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
edges = [(1,2), (1,3), (1,4),
    (2,3), (2,4), (2,5), (2, 6),
    (3,4), (3,5), (3,6), (3,7),
    (4,6), (4,7), (5,6), (6,7)]
G.add_edges_from(edges)
nx.draw_networkx(G)
limits = plt.axis('off')
plt.show(G)



Le 07/04/2018 à 15:09, Jan Groenewald a écrit :

Hi

On 7 April 2018 at 14:52, Henri Girard > wrote:


I made this graph (meaning a fano's plane) but I have the zero
outside the graph ?

I don't understand why ? someone could explain ?

My adjacency_matrix is 8 but shouldn't be 7 ?

g=Graph(7)
edges = [(1,2), (1,3), (1,4),
    (2,3), (2,4), (2,5), (2, 6),
    (3,4), (3,5), (3,6), (3,7),
    (4,6), (4,7), (5,6), (6,7)]
g.add_edge(1,2),g.add_edge(1,3),g.add_edge(1,4),g.add_edge(2,3),
g.add_edge(2,4),g.add_edge(2,5),g.add_edge(2,6),g.add_edge(3,4),
g.add_edge(3,5),g.add_edge(3,6),g.add_edge(3,7),g.add_edge(4,6),
g.add_edge(4,7),g.add_edge(5,6),g.add_edge(6,7)
g.show()
g.adjacency_matrix(),g.incidence_matrix()

Best



Graph? shows

  2. "Graph(5)" -- return an edgeless graph on the 5 vertices
 0,...,4.

  3. "Graph([list_of_vertices,list_of_edges])" -- returns a
 graph with given vertices/edges.

 To bypass auto-detection, prefer the more explicit
 "Graph([V,E],format='vertices_and_edges')".

  4. "Graph(list_of_edges)" -- return a graph with a given list
 of edges (see documentation of "add_edges()").

 To bypass auto-detection, prefer the more explicit "Graph(L,
 format='list_of_edges')".

  5. "Graph({1:[2,3,4],3:[4]})" -- return a graph by
 associating to each vertex the list of its neighbors.

 To bypass auto-detection, prefer the more explicit "Graph(D,
 format='dict_of_lists')".

so it seems correct, and there are alternatives if you prefer 1..8 
instead of 0..7.


Regards,
Jan





--
  .~.
  /V\ Jan Groenewald
 /( )\ www.aims.ac.za 
 ^^-^^
--
You received this message because you are subscribed to the Google 
Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to sage-support+unsubscr...@googlegroups.com 
.
To post to this group, send email to sage-support@googlegroups.com 
.

Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Strange

2018-04-07 Thread Jan Groenewald
Hi

On 7 April 2018 at 14:52, Henri Girard  wrote:

> I made this graph (meaning a fano's plane) but I have the zero outside the
> graph ?
>
> I don't understand why ? someone could explain ?
>
> My adjacency_matrix is 8 but shouldn't be 7 ?
>
> g=Graph(7)
> edges = [(1,2), (1,3), (1,4),
> (2,3), (2,4), (2,5), (2, 6),
> (3,4), (3,5), (3,6), (3,7),
> (4,6), (4,7), (5,6), (6,7)]
> g.add_edge(1,2),g.add_edge(1,3),g.add_edge(1,4),g.add_edge(2,3),
> g.add_edge(2,4),g.add_edge(2,5),g.add_edge(2,6),g.add_edge(3,4),
> g.add_edge(3,5),g.add_edge(3,6),g.add_edge(3,7),g.add_edge(4,6),
> g.add_edge(4,7),g.add_edge(5,6),g.add_edge(6,7)
> g.show()
> g.adjacency_matrix(),g.incidence_matrix()
>
> Best
>


Graph? shows

  2. "Graph(5)" -- return an edgeless graph on the 5 vertices
 0,...,4.

  3. "Graph([list_of_vertices,list_of_edges])" -- returns a
 graph with given vertices/edges.

 To bypass auto-detection, prefer the more explicit
 "Graph([V,E],format='vertices_and_edges')".

  4. "Graph(list_of_edges)" -- return a graph with a given list
 of edges (see documentation of "add_edges()").

 To bypass auto-detection, prefer the more explicit "Graph(L,
 format='list_of_edges')".

  5. "Graph({1:[2,3,4],3:[4]})" -- return a graph by
 associating to each vertex the list of its neighbors.

 To bypass auto-detection, prefer the more explicit "Graph(D,
 format='dict_of_lists')".

so it seems correct, and there are alternatives if you prefer 1..8 instead
of 0..7.

Regards,
Jan

>
>


-- 
  .~.
  /V\ Jan Groenewald
 /( )\www.aims.ac.za
 ^^-^^

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Strange

2018-04-07 Thread David Joyner
On Sat, Apr 7, 2018 at 8:52 AM, Henri Girard  wrote:

> I made this graph (meaning a fano's plane) but I have the zero outside the
> graph ?
>
> I don't understand why ? someone could explain ?
>

I don't know but

sage: edges = [(1,2), (1,3), (1,4),
: (2,3), (2,4), (2,5), (2, 6),
: (3,4), (3,5), (3,6), (3,7),
: (4,6), (4,7), (5,6), (6,7)]
sage: Gamma = Graph(edges)
sage: Gamma.show()

gives the same graph but without the 0 vertex.

> My adjacency_matrix is 8 but shouldn't be 7 ?
>
> g=Graph(7)
> edges = [(1,2), (1,3), (1,4),
> (2,3), (2,4), (2,5), (2, 6),
> (3,4), (3,5), (3,6), (3,7),
> (4,6), (4,7), (5,6), (6,7)]
> g.add_edge(1,2),g.add_edge(1,3),g.add_edge(1,4),g.add_edge(2,3),
> g.add_edge(2,4),g.add_edge(2,5),g.add_edge(2,6),g.add_edge(3,4),
> g.add_edge(3,5),g.add_edge(3,6),g.add_edge(3,7),g.add_edge(4,6),
> g.add_edge(4,7),g.add_edge(5,6),g.add_edge(6,7)
> g.show()
> g.adjacency_matrix(),g.incidence_matrix()
>
> Best
>
> Henri
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange

2018-04-07 Thread Henri Girard
I made this graph (meaning a fano's plane) but I have the zero outside 
the graph ?


I don't understand why ? someone could explain ?

My adjacency_matrix is 8 but shouldn't be 7 ?

g=Graph(7)
edges = [(1,2), (1,3), (1,4),
    (2,3), (2,4), (2,5), (2, 6),
    (3,4), (3,5), (3,6), (3,7),
    (4,6), (4,7), (5,6), (6,7)]
g.add_edge(1,2),g.add_edge(1,3),g.add_edge(1,4),g.add_edge(2,3),
g.add_edge(2,4),g.add_edge(2,5),g.add_edge(2,6),g.add_edge(3,4),
g.add_edge(3,5),g.add_edge(3,6),g.add_edge(3,7),g.add_edge(4,6),
g.add_edge(4,7),g.add_edge(5,6),g.add_edge(6,7)
g.show()
g.adjacency_matrix(),g.incidence_matrix()

Best

Henri

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Strange behavior with RealField(n)

2016-02-21 Thread Thierry Dumont

Le 21/02/2016 20:40, John Cremona a écrit :

Try RealField(500).pi() and similar.

Yes, it works... but my small piece of code should also give correct 
results...

thanks.
t.


On 21 Feb 2016 18:10, "Thierry Dumont" > wrote:

I have students who want to compute decimals of pi...so, what can we
do with RealField(n) ?
I make the following script (pi.sage):


for p in [2..10]:
 R=RealField(10^p)
 pii=4*atan(R(1))
 print p,R,pii


Then, using sage 7.0 or 7.1.beta4:

attach("pi.sage")

This produces a lot of seemingly correct output, but, as it takes a
too long time to finish :-), I interrupt the computation (Ctrl-c).

So, lets try again; replace 10 by 5 in the for statement (I do not
leave sage). I get NaNs:


2 Real Field with 100 bits of precision NaN
3 Real Field with 1000 bits of precision NaN
4 Real Field with 1 bits of precision NaN
5 Real Field with 10 bits of precision NaN
.

Strange.

Yours
t.d.


--
You received this message because you are subscribed to the Google
Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to sage-support+unsubscr...@googlegroups.com
.
To post to this group, send email to sage-support@googlegroups.com
.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sage-support+unsubscr...@googlegroups.com
.
To post to this group, send email to sage-support@googlegroups.com
.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
<>

Re: [sage-support] Strange behavior with RealField(n)

2016-02-21 Thread John Cremona
Try RealField(500).pi() and similar.
On 21 Feb 2016 18:10, "Thierry Dumont"  wrote:

> I have students who want to compute decimals of pi...so, what can we do
> with RealField(n) ?
> I make the following script (pi.sage):
>
> 
> for p in [2..10]:
> R=RealField(10^p)
> pii=4*atan(R(1))
> print p,R,pii
> 
>
> Then, using sage 7.0 or 7.1.beta4:
>
> attach("pi.sage")
>
> This produces a lot of seemingly correct output, but, as it takes a too
> long time to finish :-), I interrupt the computation (Ctrl-c).
>
> So, lets try again; replace 10 by 5 in the for statement (I do not leave
> sage). I get NaNs:
>
>
> 2 Real Field with 100 bits of precision NaN
> 3 Real Field with 1000 bits of precision NaN
> 4 Real Field with 1 bits of precision NaN
> 5 Real Field with 10 bits of precision NaN
> .
>
> Strange.
>
> Yours
> t.d.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange behavior with RealField(n)

2016-02-21 Thread Thierry Dumont
I have students who want to compute decimals of pi...so, what can we do 
with RealField(n) ?

I make the following script (pi.sage):


for p in [2..10]:
R=RealField(10^p)
pii=4*atan(R(1))
print p,R,pii


Then, using sage 7.0 or 7.1.beta4:

attach("pi.sage")

This produces a lot of seemingly correct output, but, as it takes a too 
long time to finish :-), I interrupt the computation (Ctrl-c).


So, lets try again; replace 10 by 5 in the for statement (I do not leave 
sage). I get NaNs:



2 Real Field with 100 bits of precision NaN
3 Real Field with 1000 bits of precision NaN
4 Real Field with 1 bits of precision NaN
5 Real Field with 10 bits of precision NaN
.

Strange.

Yours
t.d.


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
<>

[sage-support] Strange _.extension() function behavior

2015-08-28 Thread Rudy
Hullo all,

Can someone explain the following behavior to me? I would like to to create 
an extension of the field of rational functions in one variable 'y' over 
the finite field of three elements by adjoining a root of unity 'Y' and an 
element of Carlitz torsion 'X'. 

I run the following commands: 

sage: A.y = GF(3)[]; A
sage: w = polygen(A)
sage: K = Frac(A);K
sage: A1.X = K.extension(w^8 + (y^3 + y + 2)*w^2 + (y^2 + 2*y + 2)); A1
sage: B1.Y = A1.extension(w^2+2*w+2); B1

Note that 'w^2+2*w+2' is irreducible over GF(3), and 'w^8 + (y^3 + y + 
2)*w^2 + (y^2 + 2*y + 2)' is irreducible over 'A'. All fields are generated 
successfully. Trying to multiply 'X' and 'Y' or even 'y' and 'Y' then 
yields a NotImplementedError. This seems crazy to me, since by the output 
for 'B1', it knows it is an extension of 'A1', but it gets crazier. 

If instead I restart my worksheet and run:

sage: A.y = GF(3)[]; A
sage: w = polygen(A)
sage: K = Frac(A);K
sage: A1.X = K.extension(w^9 + (y^3 + y + 2)*w^3 + (y^2 + 2*y + 2)*w); A1
sage: B1.Y = A1.extension(w^2+2*w+2); B1

where I have multiplied through by 'w' in the modulus of 'A1', the 
extensions are generated correctly, and one may do arithmetic in all 
variables 'X', 'Y', and 'y'. 

I already have a workaround, but this behavior seems like a bug. So I 
thought I would ask. What's going on here?

All the best, Rudy

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange error

2014-10-23 Thread João Alberto
I am running the following Python example from the book Learning
Python, from Mark Lutz and David Ascher, but Sage is returning a
TypeError after presenting the correct response. Can anyone explain me
why? I've found this very strange.

sage: class Commuter:
: def __init__(self, val):
: self.val = val
: def __add__(self, other):
: print add, self.val, other
: def __radd__(self, other):
: print radd, self.val, other
:
sage: x = Commuter(88)
sage: y = Commuter(99)
sage: x + 1
add 88 1
sage: 1 + y
radd 99 1
---
TypeError Traceback (most recent call last)
ipython-input-76-e047f7a3a32a in module()
 1 Integer(1) + y

/usr/local/Sagemath/sage-6.3/local/lib/python2.7/site-packages/sage/structure/element.so
in sage.structure.element.RingElement.__add__
(build/cythonized/sage/structure/element.c:14696)()

/usr/local/Sagemath/sage-6.3/local/lib/python2.7/site-packages/sage/structure/coerce.so
in sage.structure.coerce.CoercionModel_cache_maps.bin_op
(build/cythonized/sage/structure/coerce.c:8323)()

TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and
'type 'instance''

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange characters in sage terminal

2014-08-18 Thread Oscar Lazo
Hi!

I used to see some straight lines when I started the sage command-line (the 
ones surrounding the header), but now I see some question marks of the kind 
you see when your system doesn't recognize some character. What do you 
think I'm missing? I have an Ubuntu system.

http://i.imgur.com/NItMB21.png

Thank you!

Oscar Lazo

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] strange behavior with sums

2014-06-23 Thread Karl Schultheisz
I'm using Sage 6.2 on Arch Linux. I have posted before about sums being 
wrong 
https://groups.google.com/d/msg/sage-support/IgC78rcdO7c/qTWzpA9f-P8J, 
and I am happy to see that the community took action. Thanks! I have been 
seeing other errors that may or may not be related to those addressed in 
the link above.

I open a new Sage session (command line). The following code ought to 
return (e^x - 1)/x.

sage: k = var('k')
sage: sum(x^k/factorial(k+1),k,0,oo)
1/4*sqrt(pi)*sqrt(x)*e^(1/2*x)

This looks similar to the sort of nonsense it was spitting out when 
misinterpreting 
Bessel functions from Maxima http://trac.sagemath.org/ticket/16224. In 
the same session, if I run the summation command again, the result is 
different.

sage: sum(x^k/factorial(k+1),k,0,oo)
sum(x^k/factorial(k + 1), k, 0, +Infinity)

And after this it will not simplify any sums, even ones it would have done 
correctly on the first try:

sage: sum(x^k/factorial(k),k,0,oo)
sum(x^k/factorial(k), k, 0, +Infinity)

Even a reset doesn't help. (As a side-note, the exit command doesn't 
survive reset.)

sage: reset()
sage: k = var('k')
sage: sum(x^k/factorial(k),k,0,oo)
sum(x^k/factorial(k), k, 0, +Infinity)
sage: exit

---
NameError Traceback (most recent call 
last)
/opt/sage/local/lib/python2.7/site-packages/sage/all_cmdline.py in 
module()
 1 exit

NameError: name 'exit' is not defined

Finite sums seem to be ok.

sage: sum(x^k,k,0,3)
x^3 + x^2 + x + 1
sage: m = var('m')
sage: sum(x^k,k,0,m)
(x^(m + 1) - 1)/(x - 1)

Any help is greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange mpmath result in $\sum_{ n 0} \pi^n$

2014-01-20 Thread Georgi Guninski
Perhaps someone should forward this upstream.

$\sum_{ n  0} \pi^n$ certainly diverges though
mpmath claims it equals -pi/(pi-1)

sage: import mpmath
sage: mpmath.mp.pretty=True;mpmath.mp.dps=40
sage: r1=mpmath.nsum(lambda n:  mpmath.pi**n,[ 1, mpmath.inf])
sage: r1
-1.466942206924259859983394813233667573143
sage: 
sage: r2=-mpmath.pi/(mpmath.pi - 1)
sage: r1-r2
0.0

sage: r3=mpmath.nsum(lambda n:  mpmath.mpf('2')**n,[ 1, mpmath.inf]);r3
-2.0

Computing zeta(2) appears OK:

sage: z2=mpmath.nsum(lambda n:  1/n**2,[ 1, mpmath.inf]);z2
1.644934066848226436472415166646025189219
sage: z2 - mpmath.zeta(2)
0.0

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Strange results with subgroups of automorphism group of graphs

2014-01-09 Thread Georgi Guninski
Strange results with subgroups of automorphism group of graphs

There is an element in the automorphism group of graph
which is in no subgroup (though the full group is a subgroup).

I suspect the problem is the usage of zero.

G1=Graph(':H`ECw@HGXGAGUG`e');G=G1.automorphism_group();sg=G.subgroups()
print G.gens()
  [(0,7)(1,4)(2,3)(6,8)]
print sg
  [Permutation Group with generators [()], Permutation Group with generators 
[(1,8)(2,5)(3,4)(7,9)]]
for i in G:
co=len([i for j in sg if i in j])
if co==0:  print i,co
  (0,7)(1,4)(2,3)(6,8) 0

sage: [G.is_isomorphic(i) for i in sg]

  [False, True]

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Strange behaviour for two similar functions

2013-06-07 Thread B. Zhang
Hi,

How to explain the difference between these two similar functions ?
Thansk.

= Test 1 
F = [1,2,3]
def test1(F):
F[0] = 0
F[1] = 0
F[2] = 0
print F
test1(F); F
[0, 0, 0]
[0, 0, 0]

=== Test 2 ===
F = [1,2,3]
def test2(F):
F = [0,0,0]
test2(F); F
[0, 0, 0]
[1, 2, 3]

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Strange behaviour for two similar functions

2013-06-07 Thread John Cremona
I think you need to read a python intro to see the difference between
mutable / immutable lists and similar.  This is a python question, not
really a Sage question.

John Cremona

On 7 June 2013 09:24, B. Zhang yangtz...@gmail.com wrote:
 Hi,

 How to explain the difference between these two similar functions ?
 Thansk.

 = Test 1 
 F = [1,2,3]
 def test1(F):
 F[0] = 0
 F[1] = 0
 F[2] = 0
 print F
 test1(F); F
 [0, 0, 0]
 [0, 0, 0]

 === Test 2 ===
 F = [1,2,3]
 def test2(F):
 F = [0,0,0]
 test2(F); F
 [0, 0, 0]
 [1, 2, 3]

 --
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sage-support+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-support@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Strange behaviour for two similar functions

2013-06-07 Thread Christophe BAL
+1


2013/6/7 John Cremona john.crem...@gmail.com

 I think you need to read a python intro to see the difference between
 mutable / immutable lists and similar.  This is a python question, not
 really a Sage question.

 John Cremona

 On 7 June 2013 09:24, B. Zhang yangtz...@gmail.com wrote:
  Hi,
 
  How to explain the difference between these two similar functions ?
  Thansk.
 
  = Test 1 
  F = [1,2,3]
  def test1(F):
  F[0] = 0
  F[1] = 0
  F[2] = 0
  print F
  test1(F); F
  [0, 0, 0]
  [0, 0, 0]
 
  === Test 2 ===
  F = [1,2,3]
  def test2(F):
  F = [0,0,0]
  test2(F); F
  [0, 0, 0]
  [1, 2, 3]
 
  --
  You received this message because you are subscribed to the Google
 Groups sage-support group.
  To unsubscribe from this group and stop receiving emails from it, send
 an email to sage-support+unsubscr...@googlegroups.com.
  To post to this group, send email to sage-support@googlegroups.com.
  Visit this group at http://groups.google.com/group/sage-support?hl=en.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 You received this message because you are subscribed to the Google Groups
 sage-support group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-support+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-support@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Strange behaviour when generating SVG files for (combinatorial) graphs

2012-11-27 Thread Rogério Brito
Hi there.

I was just trying to get my feet wet with Sage by generating some SVG files of 
graphs for use with my LaTeX documents, but I noticed a problem:

In the following session, with Sage 5.4.1 (actually, 
sage-5.4.1-linux-32bit-ubuntu_12.04.1_lts-i686-Linux) running on a Debian sid 
machine, I get a strange error:

g = graphs.PetersenGraph()
g.plot().save('petersen.png') # generated OK
g.plot().save('petersen.pdf') # also generated OK
g.plot().save('petersen.svg') # not OK

In the case of the SVG file, the edges of the graph are OK, as with the PNG and 
PDF format (when viewed with Gnome's eog), but all the vertices are collapsed 
on the top left corner of the figure.

BTW, my original intention was to generate some drawings of graphs with Sage so 
that I could shift back and forth between SVG and tikz (via Inkscape), once 
they are created by Sage, but that strategy didn't work. :(

Is this a known bug?


Thanks,

Rogério Brito.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Strange results in DiGraph.girth()

2012-10-27 Thread Georgi Guninski
Got results with DiGraph.girth() which appear inconsistent to
me. girth() returns 3 and powers of the adjacency matrix suggest
there are no directed triangle cycles and couldn't s see a directed
triangle cycle on the plot of the digraph.

sage: GR=DiGraph('FWE@_WF@o?');M=GR.adjacency_matrix()
sage: GR.girth()
3
sage: (M^3).trace()
0
sage: GR
Digraph on 7 vertices

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Strange results with multivariate resultants

2012-09-20 Thread Julian Rüth
* Georgi Guninski gunin...@guninski.com [2012-09-19 07:34:46 +0300]:

 According to wikipedia [1]
 the multivariate resultant or Macaulay's resultant of n homogeneous 
 polynomials in n variables is a polynomial in their coefficients that 
 vanishes when they have a common non-zero solution
 My pain is $1$ can't vanish while solutions exist.
I don't think the article talks about the multivariate resultant. Imho
the line you quote is just there to mention that there are
generalizations of resultants to the multivariate case (it says
Alternatively, More generally close to that line).

 Here is homogeneous example:
 sage: K.x1,x2,x3,x4=QQ[]
 sage: p1,p2=(x2)*(x3-x4),x2*(x3-2*x4)
 sage: p1.resultant(p2,x1)
 1
Afaik this computes the resultant of p1 and p2 as polynomials in
QQ(x2,x3,x4)[x1]. As p1 and p2 are constant, they have no common root.

 On the same example pari/gp returns 0:
I don't know anything about GP, but it seems that it doesn't like to
compute resultants when the variable is not in any of the polynomials
(or do any of the variables have a special meaning?)

? p1=(x2)*(x3-x4);p2=x2*(x3-2*x4);
? polresultant(p1,p2,x1)
%2 = 0
? p1=(y)*(z-t);p2=y*(z-2*t);
? polresultant(p1,p2,x1)
%4 = 1

julian

 On Tue, Sep 18, 2012 at 05:22:59PM +0200, Julian Rüth wrote:
  Hi,
  
  I'm not sure if I understand what is counterintuitive about the results.
  
  * Georgi Guninski gunin...@guninski.com [2012-09-18 16:55:37 +0300]:
   sage: K.x1,x2,x3=PolynomialRing(QQ)
   sage: p1=(x2-1)*(x3+2)
   sage: p2=(x2-1)*(x3+3)
   sage: p1.resultant(p2)
   1
  This is the resultant of p1 and p2 w.r.t. x1 (the first variable of K).
  
   sage: K_.x2,x3=PolynomialRing(QQ)
   sage: p1_=K_(p1)
   sage: p2_=K_(p2)
   sage: p1_.resultant(p2_)
   0
  The resultant of p1 and p2 w.r.t. x2 (the first variable of K_).
  
   sage: gp.polresultant(gp(p1),gp(p2))
   0
  I'm not entirely sure what gp.polresultant() does, but it seems it
  computes the resultant w.r.t. variable()
  
  sage: gp(p1).variable()
  x2
  
  The following is strange though:
  
  sage: gp.polresultant(p1,p2,x1)
  0 # this should be 1?
  sage: gp.polresultant(p1,p2,x2)
  0
  sage: gp.polresultant(p1,p2,x3)
  x2^2 - 2*x2 + 1
  
  Am I missing something here?
  
  julian
  
  -- 
  You received this message because you are subscribed to the Google Groups 
  sage-support group.
  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.
  Visit this group at http://groups.google.com/group/sage-support?hl=en.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 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.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Strange results with multivariate resultants

2012-09-20 Thread luisfe


On Wednesday, September 19, 2012 6:34:52 AM UTC+2, Georgi Guninski wrote:

 Hi, 

 I may be missing something, but the resultant = 1 confuses me. 
 According to wikipedia [1] 
 the multivariate resultant or Macaulay's resultant of n homogeneous 
 polynomials in n variables is a polynomial in their coefficients that 
 vanishes when they have a common non-zero solution 


Note that this means n homogeneous polynomials in n variables, in your 
example you only have two polynomials in four variables, it is not the same 
case of Macaulay's resultant.
 

 My pain is $1$ can't vanish while solutions exist. 

 Here is homogeneous example: 
 sage: K.x1,x2,x3,x4=QQ[] 
 sage: p1,p2=(x2)*(x3-x4),x2*(x3-2*x4) 
 sage: p1.resultant(p2,x1) 
 1 

 Certainly p1 and p2 have common solutions while the res. w.r.t. 
 x1 never vanishes (got this in a real world situation). 


As said, in this case the resultant is computed in the ring QQ(x2,x3)[x1] 
and the resultant will vanish if the two (univariate) polynomials have a 
common root in the algebraic closure of QQ(x2,x3). This is the standard 
resultant of multivariate polynomials with respect to one variable.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Strange results with multivariate resultants

2012-09-20 Thread luisfe


On Thursday, September 20, 2012 1:05:56 PM UTC+2, Georgi Guninski wrote:

 pari disagrees with sage and maxima agrees with it. 

 which way is it? 

 maxima session: 
 (%i12) p1:(x2)*(x3-x4);p2:x2*(x3-2*x4); 
 (%i14) resultant(p1,p2,x1); 
 (%o14) 1 


In this case, there is no evaluation of x1 in the algbebraic closure of 
QQ(x2,x3,x4) that makes both polynomials zero.
 

 (%i15) resultant(p1,p2,x2); 
 (%o15) 0


In this case, there is a common root in the algebraic closure of 
QQ(x1,x3,x4), namely x2=0

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Strange results with multivariate resultants

2012-09-20 Thread Dima Pasechnik


On Thursday, 20 September 2012 19:05:56 UTC+8, Georgi Guninski wrote:

 pari disagrees with sage and maxima agrees with it. 

 which way is it? 

 maxima session: 
 (%i12) p1:(x2)*(x3-x4);p2:x2*(x3-2*x4); 
 (%i14) resultant(p1,p2,x1); 
 (%o14) 1 
 (%i15) resultant(p1,p2,x2); 
 (%o15) 0 

 On Wed, Sep 19, 2012 at 07:34:46AM +0300, Georgi Guninski wrote: 
  Hi, 
  
  I may be missing something, but the resultant = 1 confuses me. 


I bet the confusion comes from the fact the Sylvester matrix in this case 
is empty.
Whether an empty matrix has determinant 0, or 1, it's a deep question :–)
Note that in the ring of empty matrices, 0 equals 1, so in this sense it's 
OK...

sage: K.x1,x2,x3,x4=QQ[] 
sage: p1,p2=(x2)*(x3-x4),x2*(x3-2*x4)
sage: p1.sylvester_matrix(p2,x1)
[]
sage: p1.sylvester_matrix(p2,x1).det()
1


 

  According to wikipedia [1] 
  the multivariate resultant or Macaulay's resultant of n homogeneous 
 polynomials in n variables is a polynomial in their coefficients that 
 vanishes when they have a common non-zero solution 
  My pain is $1$ can't vanish while solutions exist. 
  
  Here is homogeneous example: 
  sage: K.x1,x2,x3,x4=QQ[] 
  sage: p1,p2=(x2)*(x3-x4),x2*(x3-2*x4) 
  sage: p1.resultant(p2,x1) 
  1 
  
  Certainly p1 and p2 have common solutions while the res. w.r.t. 
  x1 never vanishes (got this in a real world situation). 
  
  On the same example pari/gp returns 0: 
  ? p1=(x2)*(x3-x4);p2=x2*(x3-2*x4);polresultant(p1,p2,x1) 
  %5 = 0 
  
  
  [1]: 
  http://en.wikipedia.org/w/index.php?title=Resultantoldid=511538674 
  
  


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Strange results with multivariate resultants

2012-09-20 Thread Georgi Guninski
Thanks all for the replies.

Pari devs acknowledged their bug and fixed it in trunk here:

http://pari.math.u-bordeaux.fr/archives/pari-dev-1209/msg00034.html


On Thu, Sep 20, 2012 at 09:45:14AM -0700, Dima Pasechnik wrote:
 
 
 On Thursday, 20 September 2012 19:05:56 UTC+8, Georgi Guninski wrote:
 
  pari disagrees with sage and maxima agrees with it. 
 
  which way is it? 
 
  maxima session: 
  (%i12) p1:(x2)*(x3-x4);p2:x2*(x3-2*x4); 
  (%i14) resultant(p1,p2,x1); 
  (%o14) 1 
  (%i15) resultant(p1,p2,x2); 
  (%o15) 0 
 
  On Wed, Sep 19, 2012 at 07:34:46AM +0300, Georgi Guninski wrote: 
   Hi, 
   
   I may be missing something, but the resultant = 1 confuses me. 
 
 
 I bet the confusion comes from the fact the Sylvester matrix in this case 
 is empty.
 Whether an empty matrix has determinant 0, or 1, it's a deep question :–)
 Note that in the ring of empty matrices, 0 equals 1, so in this sense it's 
 OK...
 
 sage: K.x1,x2,x3,x4=QQ[] 
 sage: p1,p2=(x2)*(x3-x4),x2*(x3-2*x4)
 sage: p1.sylvester_matrix(p2,x1)
 []
 sage: p1.sylvester_matrix(p2,x1).det()
 1
 
 
  
 
   According to wikipedia [1] 
   the multivariate resultant or Macaulay's resultant of n homogeneous 
  polynomials in n variables is a polynomial in their coefficients that 
  vanishes when they have a common non-zero solution 
   My pain is $1$ can't vanish while solutions exist. 
   
   Here is homogeneous example: 
   sage: K.x1,x2,x3,x4=QQ[] 
   sage: p1,p2=(x2)*(x3-x4),x2*(x3-2*x4) 
   sage: p1.resultant(p2,x1) 
   1 
   
   Certainly p1 and p2 have common solutions while the res. w.r.t. 
   x1 never vanishes (got this in a real world situation). 
   
   On the same example pari/gp returns 0: 
   ? p1=(x2)*(x3-x4);p2=x2*(x3-2*x4);polresultant(p1,p2,x1) 
   %5 = 0 
   
   
   [1]: 
   http://en.wikipedia.org/w/index.php?title=Resultantoldid=511538674 
   
   
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 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.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Strange results with multivariate resultants

2012-09-18 Thread Georgi Guninski
I had to workaround against this counterintuitive results.

5.2 and 5.3 on linux x86_64


sage: K.x1,x2,x3=PolynomialRing(QQ)
sage: p1=(x2-1)*(x3+2)
sage: p2=(x2-1)*(x3+3)
sage: p1.resultant(p2)
1
sage: K_.x2,x3=PolynomialRing(QQ)
sage: p1_=K_(p1)
sage: p2_=K_(p2)
sage: p1_.resultant(p2_)
0
sage: gp.polresultant(gp(p1),gp(p2))
0

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Strange results with multivariate resultants

2012-09-18 Thread Julian Rüth
Hi,

I'm not sure if I understand what is counterintuitive about the results.

* Georgi Guninski gunin...@guninski.com [2012-09-18 16:55:37 +0300]:
 sage: K.x1,x2,x3=PolynomialRing(QQ)
 sage: p1=(x2-1)*(x3+2)
 sage: p2=(x2-1)*(x3+3)
 sage: p1.resultant(p2)
 1
This is the resultant of p1 and p2 w.r.t. x1 (the first variable of K).

 sage: K_.x2,x3=PolynomialRing(QQ)
 sage: p1_=K_(p1)
 sage: p2_=K_(p2)
 sage: p1_.resultant(p2_)
 0
The resultant of p1 and p2 w.r.t. x2 (the first variable of K_).

 sage: gp.polresultant(gp(p1),gp(p2))
 0
I'm not entirely sure what gp.polresultant() does, but it seems it
computes the resultant w.r.t. variable()

sage: gp(p1).variable()
x2

The following is strange though:

sage: gp.polresultant(p1,p2,x1)
0 # this should be 1?
sage: gp.polresultant(p1,p2,x2)
0
sage: gp.polresultant(p1,p2,x3)
x2^2 - 2*x2 + 1

Am I missing something here?

julian

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Strange sum() result and can't be evaluated numerically

2012-09-14 Thread Renan Birck Pinheiro
The command sum( ((-1)^k*(x^(2*k+1))/factorial(2*k+1)),k,0,oo) should give
sin(x) - it does in Mathematica. But in Sage it gives

1/2*sqrt(pi)*sqrt(2)*sqrt(x)*bessel_j(1/2, x)

which can't be evaluated numerically:

_(x=3).N()

Traceback (most recent call last):
  File stdin, line 1, in module
  File _sage_input_4.py, line 10, in module
exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8
-*-\\n +
_support_.preparse_worksheet_cell(base64.b64decode(Xyh4PTMpLk4oKQ==),globals())+\\n);
execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpMc56sG/___code___.py, line 3, in module
exec compile(u'_(x=_sage_const_3 ).N()
  File , line 1, in module

  File expression.pyx, line 4319, in
sage.symbolic.expression.Expression._numerical_approx
(sage/symbolic/expression.cpp:20837)
TypeError: cannot evaluate symbolic expression numerically

What am I missing here? I am using Sage 5.3.

Thanks!

--
Renan Birck Pinheiro - Grupo de Microeletrônica
Engenharia Elétrica - UFSM - Santa Maria, Brasil
http://renanbirck.blogspot.com - +55 55 91162798

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] strange behavior in sage 5.0

2012-05-17 Thread Kenneth A. Ribet
Any advice here?  Am I doing something wrong:

 sage: 1+1
 2
 sage: (0.8*0.15)/(0.8*0.15 + 0.2*0.85)
 
 
 Unhandled SIGILL: An illegal instruction occurred in Sage.
 This probably occurred because a *compiled* component of Sage has a bug
 in it and is not properly wrapped with sig_on(), sig_off(). You might
 want to run Sage under gdb with 'sage -gdb' to debug this.
 Sage will now terminate.
 
 /Users/kribet/Desktop/sage/spkg/bin/sage: line 312: 70167 Illegal 
 instruction: 4  sage-ipython $@ -i

Ken

-- 
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] Strange interaction between sage and numpy

2012-01-07 Thread Vegard Lima
Hello,

I was doing some computation involving finding nullspace
of a matrix with only \pm 1 entries when right_kernel().basis() started
giving me nullvectors...

Here is a minimal example to reproduce the behaviour:

import numpy as np
r=10
c=76
A = 2*np.random.randint(2, size=(r,c))-np.ones((r,c),dtype=np.int)
A = matrix(QQ,A)
print A.right_kernel().dimension()+A.rank()
B = A.right_kernel().basis()
print B[-1]

Sage 4.7.2 on 64 bit Fedora 16 linux (compiled from source) gives me:
$ sage minex.sage
86
(0, 0, 0, 0, 0, 0, 0, ... lots of zeros, 0, 0, 0, 0, 0, 0, 0)

while sage 4.7 on 32 bit osx (downloaded binary) gives:
$ sage minex.sage
76
(0, 0, 0, 0, 0, ..lots of zeros... , 0, 0, 2, -1, 2, 4, -1, 3, -1, -3, 0, -2, 1)

sage 4.7.2 on 64 bit osx behaves as the linux version.

When the number of columns in the matrix is less than
76 I can't reproduce the error, and when the number
of rows is less than 10 it only happens sometimes.
Also removing dtype=np.int, so that the dtype of the
numpy matrix is the default float64, makes the error go away.

Any ideas what is happening?

Thanks,
-- 
Vegard Lima

-- 
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] Strange behaviour in a simple function

2011-09-29 Thread m m
Hi
I have written very simple function, which code I paste below. The
thing is that it produces completely unexpected results. I paste them
below. Please let me know if this is a bug or I just do something
completely wrong. I change in tests only the modulus M.

def MLCG_S(B,M,N,x0):
x = x0
L = []
for i in range(1,N):
x = Mod(B*x, M) #MLCG(B,M,x)
print x==B
print (B-M)
print (x-M)
print M-B
print M-x
return L;
2^31-1
Invocation: LCG_16807 = MLCG_S(16807,2^31-1,2,1);
Result:
True
-2147466840
16807
2147466840
2147466840
___2^20-1
Invocation:LCG_16807 = MLCG_S(16807,2^20-1,2,1);
Result:
True
-1031768
16807
1031768
1031768
___2^10-1
Invocation:LCG_16807 = MLCG_S(16807,2^10-1,2,1);
Result:
True
15784
439
-15784
584

Above, not only the first two differences are different, but also the
last two differences are different!

Cheers

-- 
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] Strange behaviour in a simple function

2011-09-29 Thread Maarten Derickx
Mod(B*x, M) doesn't return an integer but an element of Integers(M) = the ring 
of integers modulo M. So the differences you see are because B is a normal 
integer so the subtractions involving B and M are just integer subtractions, 
but the substractions involing x and M are substractions in  Integers(M)

-- 
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] strange issue with 3d plots/Jmol

2011-08-28 Thread pong
I encountered a pretty strange issue with Jmol.

In each notebook worksheet, I can have Jmol to display only two 3d
plots! From the third 3d plots onwards, it just giving me black
screens...
It must be some problems on the installation since if I transfer the
same worksheet to another server, it display all the plots.

Any idea on where the problem could be and how to fix that?

I'm using SAGE 4.7.1

-- 
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] Strange error using R pexpect interface?

2011-06-06 Thread kcrisman
I'm using R matrices to use an R program and then do things with it in
Sage.  For some reason Sage doesn't get the right answer for
matrices above a certain size.

The first one is right (it gives the space that is in the returned
string) while the second one makes no sense; ZZ='' is what actually
comes back.  But there is no real reason for this - what's special
about the length? - and doing these in Sage's r_console() gives normal
results for the matrix.

So I feel like pexpect must be doing something naughty.  Does anyone
have any ideas what might be going on so I can use more data?

Thanks,
- kcrisman


sage: ZZ = r.eval('matrix(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 4, 4, 4, 4, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, 1,
3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1,
1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 2, 2, 2, 2,
3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 4, 4, 4, 4,
1),ncol=4)'); ZZ[1]
' '
sage: ZZ = r.eval('matrix(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 4, 4, 4, 4, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, 1,
3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1,
1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 2, 2, 2, 2,
3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 4, 4, 4, 4, 1,
1, 1, 1, 3),ncol=4)'); ZZ[1]

-- 
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] strange error message when using maxima

2010-10-02 Thread Oscar Gerardo Lazo Arjona

When I use sage from the command line I get the following error message:

sage: integral(x,x)
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File /home/oscar/sage-4.5.2/local/bin/sage-cleaner, line 21, in 
module

import os, shutil, sys, time, socket
  File /home/oscar/sage-4.5.2/local/lib/python/os.py, line 49, in 
module

import posixpath as path
  File /home/oscar/sage-4.5.2/local/lib/python/posixpath.py, line 14, 
in module

import stat
  File stat.py, line 2, in module
from sage.all_cmdline import *   # import sage library
ImportError: No module named sage.all_cmdline
1/2*x^2

But as you can see, sage returns the correct answer. If I start sage 
from ~/sage-4.5.2 I don't get the error message:


sage: integral(x,x)
1/2*x^2

I think that this might be related to the way in which I added 
~/sage-4.5.2 to my PATH: I put the following line at the end of my 
~/.bashrc file (Ubuntu 10.04):


export PATH=$PATH:/home/oscar/sage-4.5.2

I also think this is Maxima-related, since it appears to happen only 
when calling Maxima (It does not happen anymore once Maxima has been 
started). I've had this error since sage 3.x but I thought I was making 
some no0bish mistake (which might still be the case).


thanks!

Oscar


--
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] Strange bug in latex rendering

2010-08-08 Thread Oscar Gerardo Lazo Arjona

Hello!

I've come across this strange bug:

sage: var('x y')
(x, y)
sage: a=x-y/x
sage: a
x - y/x
sage: print a
x - y/x
sage: latex(a)
x + \frac{y}{x}

that last + should be a -. This also doesn't work in the notebook, using 
print a works, but show(a) shows the expression with a plus sign.


Any ideas as to what is wrong?

thanks!

Oscar

--
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] Strange (non-)substitution of variables whose name is not equal to their representation

2010-07-07 Thread David Sanders
Hi,

I have finally managed to try out Sage seriously after a long time
wanting to (and with intermediate-level Python experience). In general
it's really rather amazing, thanks to all involved!

I have come across what -- to me -- seems at least incongruous, when
substituting variables.
I am using 'Sage Version 4.4.4, Release Date: 2010-06-23', downloaded
a couple of days ago as the Ubuntu 10.04 binary package.

I want to have a variable called eps, but which appears as an epsilon
in the notebook interface, so I do

eps = var(epsilon)

Now suppose I have

a = 3 * eps

I now want to substitute eps=1, so I do

a.subs(eps = 1)

but the response is still 3*epsilon !

If I do

a.subs(epsilon = 1)

then I get 3.

But also, if I do

a.subs({eps:1})

with a dictionary instead, then I get what I expect, namely 3.

This seems to me strange, and possibly a bug, but maybe I'm just
misunderstanding.
Of course, I have found the solution -- just use a dictionary -- but I
would like to understand what's going on.

I see that the examples in the documentation seem always to use
variables defined simply as

var('x')

etc.,  whose names are equal to their representations, so this problem
seems not to arise.

Thanks and best wishes,
David.

-- 
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] Strange (non-)substitution of variables whose name is not equal to their representation

2010-07-07 Thread Mike Hansen
On Wed, Jul 7, 2010 at 1:49 PM, David Sanders dpsand...@gmail.com wrote:
 I now want to substitute eps=1, so I do

 a.subs(eps = 1)

 but the response is still 3*epsilon !

This is due to the way Python functions work.  Basically, doing

a.subs(eps=1)

is the same as doing

a.subs(**{'eps': 1})

When you use keyword arguments, the function gets the string 'eps'
rather than the var eps.  So, it tries to look for a variable named
'eps' which it doesn't find.  When you pass in the dictionary
explicitly:

a.subs({eps: 1})

the key is the actual variable object rather than a string so it knows
to do the right thing.

--Mike

-- 
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] strange behavior in matrix substitution

2010-06-13 Thread Robert Bradshaw

On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:


Please tell me if this is a bug, or, I'm missing something obvious...

sage: a = 3 # Assign a value to a variable a
sage: b = a # Create a copy of a


You're not really copying a, you're just making 'b' refer to the same  
thing that 'a' does, i.e. '3'.



sage: b = 2 # Change the value of b


Now b points to a different integer (2).


sage: b
2
sage: a # The value of a remains unchanged, as expected.
3

So far, it looks good to me. But, when I do a similar thing with
matrices, it doesn't look to be the same.

sage: v = matrix(ZZ, 3, range(9))
sage: u = v


u and v point to the same thing.


sage: u[2] = [0,0,0]


The matrix stored in the variable u has not been reassigned, it' been  
mutated.



sage: u
[0 1 2]
[3 4 5]
[0 0 0]
sage: v
[0 1 2]
[3 4 5]
[0 0 0]

Shouldn't the value of v remain the same? Why does the change in u
(or, a row of u) affect v?




On Jun 12, 2010, at 8:25 PM, Justin C. Walker wrote:



On Jun 12, 2010, at 19:07 , William Stein wrote:


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:

[snip]

Shouldn't the value of v remain the same? Why does the change in u
(or, a row of u) affect v?

[snip]
For, e.g., integers, u=v means that the names u,v both refer to  
their own copies of the value in question.




Are you sure???  I think you statement that u is a new copy is  
wrong.   I bet


u is v

would still return true above.


Picky picky picky.  I was hoping to avoid a trip into the twisty  
maze of passages in language definition (all of which are subtly  
different :-}).  But you are correct.  u is v does return true and  
the two actually refer to the same (physical) value.  And, if one  
variable is modified, this doesn't modify the other, or the value  
that both previously referred to.


Actually, even in the case of integers, if you were to modify one, it  
would modify the other. Most object are (basically) immutable, so this  
doesn't come up. Assignment never copies, it only creates references.


- 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 on iPhone - Re: [sage-support] strange behavior in matrix substitution

2010-06-13 Thread calcpage
I check my student's worksheets (those they share) on my iPod Touch no 
problem from sagenb.


The only problem is viewing a plot() in 3D as the jre is not supported 
on the iPod Touch's Safari.


HTH,
A. Jorge Garcia
http://calcpage.tripod.com

Teacher  Professor
Applied Mathematics, Physics  Computer Science
Baldwin Senior High School  Nassau Community College


-Original Message-
From: William Stein wst...@gmail.com
To: sage-support@googlegroups.com sage-support@googlegroups.com
Sent: Sat, Jun 12, 2010 11:55 pm
Subject: Sage on iPhone - Re: [sage-support] strange behavior in matrix 
substitution


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 20:30 , William Stein wrote:


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 19:07 , William Stein wrote:


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:

[snip]


[snip]


I find that hard to believe.  I thought you had Sage running on all 

things digital...




Your right that I could check it on my iPhone, but I was lazy.    I'm
working on building sage *on* my ipad bit haven't finished yet


OK, that would be cool.  Would one have to jailbreak to run it?



Yes, unfortunately.  Also there's no iPhone fortran (yet), so only
parts of sage will build.
I'll show you at MSRI at sage days 22...


Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
---
Like the ski resort full of girls hunting for husbands
and husbands hunting for girls, the situation is not
as symmetrical as it might seem.
  - Alan MacKay
--

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



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.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


--
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] strange behavior in matrix substitution

2010-06-12 Thread Byungchul Cha

Please tell me if this is a bug, or, I'm missing something obvious...

sage: a = 3 # Assign a value to a variable a
sage: b = a # Create a copy of a
sage: b = 2 # Change the value of b
sage: b
2
sage: a # The value of a remains unchanged, as expected.
3

So far, it looks good to me. But, when I do a similar thing with
matrices, it doesn't look to be the same.

sage: v = matrix(ZZ, 3, range(9))
sage: u = v
sage: u[2] = [0,0,0]
sage: u
[0 1 2]
[3 4 5]
[0 0 0]
sage: v
[0 1 2]
[3 4 5]
[0 0 0]

Shouldn't the value of v remain the same? Why does the change in u
(or, a row of u) affect v?

-- 
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] strange behavior in matrix substitution

2010-06-12 Thread Justin C. Walker


On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:



Please tell me if this is a bug, or, I'm missing something obvious...

sage: a = 3 # Assign a value to a variable a
sage: b = a # Create a copy of a
sage: b = 2 # Change the value of b
sage: b
2
sage: a # The value of a remains unchanged, as expected.
3

So far, it looks good to me. But, when I do a similar thing with
matrices, it doesn't look to be the same.

sage: v = matrix(ZZ, 3, range(9))
sage: u = v
sage: u[2] = [0,0,0]
sage: u
[0 1 2]
[3 4 5]
[0 0 0]
sage: v
[0 1 2]
[3 4 5]
[0 0 0]

Shouldn't the value of v remain the same? Why does the change in u
(or, a row of u) affect v?


You might think the behavior should be the same, but that's not the  
case.  Objects with structure (matrices, for example) are copied by  
reference, while things like integers, which have little or no  
structure (from the user's perspective at any rate) are copied by  
value.


What that means is that, for matrices, u=v means that the names u,v  
now refer to the same Sage object, so when you modify one, you are  
modifying the other (since you are really modifying the underlying  
object).


For, e.g., integers, u=v means that the names u,v both refer to  
their own copies of the value in question.


This is, BTW, the way Python works, and Python is the language with  
which (most of) Sage is implemented.


In case you didn't already know that :-}

HTH.

Justin

--
Justin C. Walker, Curmudgeon at Large
Director
Institute for the Enhancement of the Director's income
---
--
They said it couldn't be done, but sometimes,
it doesn't work out that way.
  - Casey Stengel
--



--
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] strange behavior in matrix substitution

2010-06-12 Thread Mike Hansen
Hello,

On Sat, Jun 12, 2010 at 5:27 PM, Byungchul Cha cha3...@gmail.com wrote:

 Please tell me if this is a bug, or, I'm missing something obvious...

 sage: a = 3 # Assign a value to a variable a
 sage: b = a # Create a copy of a

This does not create a copy of a.  When you do a = 3, this creates
new object for the integer 3 and then makes a point to that object.
When you do b = a, it makes b point to the object that you
originally created.  When you do b = 2, it makes a new object for
the integer 2 and makes b point to that.  Notice that you are never
changing (mutating) any of the objects.


 So far, it looks good to me. But, when I do a similar thing with
 matrices, it doesn't look to be the same.
 ...
 Shouldn't the value of v remain the same? Why does the change in u
 (or, a row of u) affect v?

Here, the line sage: u[2] = [0,0,0] change the object that u in
referencing.  Since u and v point to that same object (as above), you
see the changes when you look at v.  You can use copy() to actually
make a copy of v:

sage: sage: v = matrix(ZZ, 3, range(9))
sage: v = matrix(ZZ, 3, range(9))
sage: u = copy(v)
sage: u[2] = [0,0,0]
sage: u
[0 1 2]
[3 4 5]
[0 0 0]
sage: v
[0 1 2]
[3 4 5]
[6 7 8]

--Mike

-- 
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] strange behavior in matrix substitution

2010-06-12 Thread William Stein
On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:

 On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:



 Please tell me if this is a bug, or, I'm missing something obvious...

 sage: a = 3 # Assign a value to a variable a
 sage: b = a # Create a copy of a
 sage: b = 2 # Change the value of b
 sage: b
 2
 sage: a # The value of a remains unchanged, as expected.
 3

 So far, it looks good to me. But, when I do a similar thing with
 matrices, it doesn't look to be the same.

 sage: v = matrix(ZZ, 3, range(9))
 sage: u = v
 sage: u[2] = [0,0,0]
 sage: u
 [0 1 2]
 [3 4 5]
 [0 0 0]
 sage: v
 [0 1 2]
 [3 4 5]
 [0 0 0]

 Shouldn't the value of v remain the same? Why does the change in u
 (or, a row of u) affect v?


 You might think the behavior should be the same, but that's not the case.  
 Objects with structure (matrices, for example) are copied by reference, 
 while things like integers, which have little or no structure (from the 
 user's perspective at any rate) are copied by value.

 What that means is that, for matrices, u=v means that the names u,v now 
 refer to the same Sage object, so when you modify one, you are modifying the 
 other (since you are really modifying the underlying object).

 For, e.g., integers, u=v means that the names u,v both refer to their own 
 copies of the value in question.


Are you sure???  I think you statement that u is a new copy is wrong.   I bet

  u is v

would still return true above.   I can't check this now, since am on iPhone



 This is, BTW, the way 
 Pythttp://www.cnn.com/2010/HEALTH/05/29/energy.boosters/hon works, and Python 
 is the language with which (most of) Sage is implemented.

 In case you didn't already know that :-}

 HTH.

 Justin

 --
 Justin C. Walker, Curmudgeon at Large
 Director
 Institute for the Enhancement of the Director's income
 ---
 --
 They said it couldn't be done, but sometimes,
 it doesn't work out that way.
   - Casey Stengel
 --



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


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.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] strange behavior in matrix substitution

2010-06-12 Thread Justin C. Walker


On Jun 12, 2010, at 19:07 , William Stein wrote:


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:

[snip]

Shouldn't the value of v remain the same? Why does the change in u
(or, a row of u) affect v?

[snip]
For, e.g., integers, u=v means that the names u,v both refer to  
their own copies of the value in question.




Are you sure???  I think you statement that u is a new copy is  
wrong.   I bet


 u is v

would still return true above.


Picky picky picky.  I was hoping to avoid a trip into the twisty maze  
of passages in language definition (all of which are subtly  
different :-}).  But you are correct.  u is v does return true and  
the two actually refer to the same (physical) value.  And, if one  
variable is modified, this doesn't modify the other, or the value that  
both previously referred to.



  I can't check this now, since am on iPhone


I find that hard to believe.  I thought you had Sage running on all  
things digital...


Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income

When LuteFisk is outlawed,
Only outlaws will have LuteFisk




--
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] strange behavior in matrix substitution

2010-06-12 Thread William Stein
On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:

 On Jun 12, 2010, at 19:07 , William Stein wrote:


 On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


 On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:

 [snip]

 Shouldn't the value of v remain the same? Why does the change in u
 (or, a row of u) affect v?

 [snip]

 For, e.g., integers, u=v means that the names u,v both refer to their own 
 copies of the value in question.



 Are you sure???  I think you statement that u is a new copy is wrong.   I bet

  u is v

 would still return true above.


 Picky picky picky.  I was hoping to avoid a trip into the twisty maze of 
 passages in language definition (all of which are subtly different :-}).  But 
 you are correct.  u is v does return true and the two actually refer to the 
 same (physical) value.  And, if one variable is modified, this doesn't modify 
 the other, or the value that both previously referred to.


   I can't check this now, since am on iPhone


 I find that hard to believe.  I thought you had Sage running on all things 
 digital...


Your right that I could check it on my iPhone, but I was lazy.I'm
working on building sage *on* my ipad bit haven't finished yet



 Justin

 --
 Justin C. Walker, Curmudgeon-At-Large
 Institute for the Enhancement of the Director's Income
 
 When LuteFisk is outlawed,
 Only outlaws will have LuteFisk
 



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


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.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] strange behavior in matrix substitution

2010-06-12 Thread Justin C. Walker


On Jun 12, 2010, at 20:30 , William Stein wrote:


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 19:07 , William Stein wrote:


On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:

[snip]


[snip]


I find that hard to believe.  I thought you had Sage running on all  
things digital...




Your right that I could check it on my iPhone, but I was lazy.I'm
working on building sage *on* my ipad bit haven't finished yet


OK, that would be cool.  Would one have to jailbreak to run it?

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
---
Like the ski resort full of girls hunting for husbands
and husbands hunting for girls, the situation is not
as symmetrical as it might seem.
  - Alan MacKay
--

--
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 on iPhone - Re: [sage-support] strange behavior in matrix substitution

2010-06-12 Thread William Stein
On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:

 On Jun 12, 2010, at 20:30 , William Stein wrote:


 On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


 On Jun 12, 2010, at 19:07 , William Stein wrote:


 On Saturday, June 12, 2010, Justin C. Walker jus...@mac.com wrote:


 On Jun 12, 2010, at 17:27 , Byungchul Cha wrote:

 [snip]


 [snip]


 I find that hard to believe.  I thought you had Sage running on all things 
 digital...



 Your right that I could check it on my iPhone, but I was lazy.    I'm
 working on building sage *on* my ipad bit haven't finished yet


 OK, that would be cool.  Would one have to jailbreak to run it?


Yes, unfortunately.  Also there's no iPhone fortran (yet), so only
parts of sage will build.
I'll show you at MSRI at sage days 22...

 Justin

 --
 Justin C. Walker, Curmudgeon at Large
 Institute for the Absorption of Federal Funds
 ---
 Like the ski resort full of girls hunting for husbands
 and husbands hunting for girls, the situation is not
 as symmetrical as it might seem.
   - Alan MacKay
 --

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


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.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] strange behavior on assigning string with single quotes

2010-05-12 Thread Rajeev
Hi,

I am finding a very strange behavior in notebook. Evaluating

a = 'hello'

gives

Traceback (most recent call last):
  File stdin, line 1, in module
  File _sage_input_12.py, line 4, in module
print _support_.syseval(python, ur\u0027\u0027\u0027a = \u0027hello
\u0027\u0027\u0027\u0027, \u0027/home/rajeev/sage_notebook/
sage_notebook.sagenb/home/admin/32/cells/25\u0027)
  File , line 1
print _support_.syseval(python, ur'''a = 'hello, '/home/rajeev/
sage_notebook/sage_notebook.sagenb/home/admin/32/cells/25')
 
^
SyntaxError: EOL while scanning string literal

There is no problem when I use double quotes. I am using sage 4.2 and
I have selected python from the dropdown menu at the top.

Rajeev

-- 
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] strange n()

2010-04-11 Thread bb

Mike Hansen schrieb:

On Sat, Apr 10, 2010 at 3:37 AM, bb bblo...@arcor.de wrote:
  

sage: n(sqrt(2.), digits=40)
1.414213562373095145474621858738828450441
sage: n(sqrt(2), digits=40)
1.414213562373095048801688724209698078570
sage:



If you wanted this to be more like Maxima, the appropriate thing to do
would some something like:

sage: RealNumber = RealField(137)
sage: sqrt(2.0)
1.414213562373095048801688724209698078570
sage: sqrt(2).n(digits=40)
1.414213562373095048801688724209698078570

  

Sage is missing the errror forwarding of Mathematica.



Yes, Sage does not have a numerical type that does Mathematica's
significance arithmetic.  An interesting thread about the merits and
demerits of significance arithmetic is
http://sci.tech-archive.net/Archive/sci.math.symbolic/2008-03/msg00014.html
.

One could do a little work to get Sage's interval arithmetic to do
something similar.

--Mike

  
Tnx for helping. I did some more experimentation. I dont want to bother 
you, but if you have some time and some pation I would be thankfull for 
one more explanation. Your tip works as expected, but if I use the 
method n() I still get 53 bit of significant bits??? (see last 
expression of the snippet.)


I argue, that the parameter of n() is set elsewhere in another Variable 
than RealNumber?


sage: RealNumber = RealField(137)
sage: sqrt(2.)
1.414213562373095048801688724209698078570
sage: _.prec()
137
sage: 
sqrt(2.000)

1.414213562373095048801688724209698078570
sage: _.prec()
137
sage: 
n(sqrt(2.000), 
digits=60)

1.41421356237309504880168872420969807856967336610324780267484
sage: _.prec()
203
sage: 
n(sqrt(2.000))

1.41421356237310
sage: _.prec()
53
sage:

Regards BB

--
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-11 Thread Mike Hansen
On Sun, Apr 11, 2010 at 10:01 AM, bb bblo...@arcor.de wrote:
 Tnx for helping. I did some more experimentation. I dont want to bother you,
 but if you have some time and some pation I would be thankfull for one more
 explanation. Your tip works as expected, but if I use the method n() I still
 get 53 bit of significant bits??? (see last expression of the snippet.)

 I argue, that the parameter of n() is set elsewhere in another Variable than
 RealNumber?

Yes, in the code for n, we have the following:

if prec is None:
if digits is None:
prec = 53
else:
prec = int((digits+1) * 3.32192) + 1

so it just defaults to 53 if nothing is passed in.  The RealNumber =
RealField(137) just changes the precision for floating point literals
entered on the command line.

--Mike

-- 
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-11 Thread bb

Mike Hansen schrieb:

On Sun, Apr 11, 2010 at 10:01 AM, bb bblo...@arcor.de wrote:
  

Tnx for helping. I did some more experimentation. I dont want to bother you,
but if you have some time and some pation I would be thankfull for one more
explanation. Your tip works as expected, but if I use the method n() I still
get 53 bit of significant bits??? (see last expression of the snippet.)

I argue, that the parameter of n() is set elsewhere in another Variable than
RealNumber?



Yes, in the code for n, we have the following:

if prec is None:
if digits is None:
prec = 53
else:
prec = int((digits+1) * 3.32192) + 1

so it just defaults to 53 if nothing is passed in.  The RealNumber =
RealField(137) just changes the precision for floating point literals
entered on the command line.

--Mike

  

Tnx for clearing that n()-question!

In an earlier posting (I am always thankful for any help!) you wrote:
One could do a little work to get Sage's interval arithmetic to do
something similar. Would be an interesting experiment.

I found an internet page about that topic concerning MPFR from 2/5/2006:
http://www.ma.utexas.edu/users/kschalm/mpfr-in-sage.html
(MPFR seems to be very broadly used by different Progs under GNU Lesser 
GPL. Added is a list of related software.)


There are used some Sage-examples with a strange line-numbering with 
underscores? May be that is an outdated Sage-Version? Actual versions do 
not do any line numbering.


I did not find any evidence that MPFR or MAPM is included in Sage? I do 
not understand if MPFR is compiled with Sage in this examples on that 
page? I cannot find any evidence that MPFR is loaded?


In an extension of the floating point issue I am actually interested in: 
I found a list of libs to support floating point arithmetics that are 
not in the list of included libs to Sage. I found some examples to 
include tools with a CLI via http in the documentatin. I did not find 
hints how to include C/C++ or other language libs to Sage? (To clear 
that statement: The fact I could not find it does not mean it is not 
documented in some place!)


Again - please ignore my boring question if you feel bothered - I can 
understand that! With yor response you opened a door for floting point 
questions.


Tnx anyway - regards BB




--
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-11 Thread Mike Hansen
On Sun, Apr 11, 2010 at 12:47 PM, bb bblo...@arcor.de wrote:
 In an earlier posting (I am always thankful for any help!) you wrote:
 One could do a little work to get Sage's interval arithmetic to do
 something similar. Would be an interesting experiment.

Here's a brief example

sage: RIF
Real Interval Field with 53 bits of precision
sage: R = RealIntervalField(200); R
Real Interval Field with 200 bits of precision
sage: f = RIF(pi) + 0.5; f
3.641592653589794?
sage: g = R(f); g
3.641592653589794?
sage: g.parent()
Real Interval Field with 200 bits of precision

Even when you increase the precision, it doesn't print out more digits
since it knows the upper and lower bounds.  However, this does not
currently play nice with the .n() stuff.


 I found an internet page about that topic concerning MPFR from 2/5/2006:
 http://www.ma.utexas.edu/users/kschalm/mpfr-in-sage.html
 (MPFR seems to be very broadly used by different Progs under GNU Lesser GPL.
 Added is a list of related software.)

 There are used some Sage-examples with a strange line-numbering with
 underscores? May be that is an outdated Sage-Version? Actual versions do not
 do any line numbering.

This page is indeed quite outdated.


 I did not find any evidence that MPFR or MAPM is included in Sage? I do not
 understand if MPFR is compiled with Sage in this examples on that page? I
 cannot find any evidence that MPFR is loaded?

MPFR is included in Sage by default.  Sage's RealNumber class is a
wrapper around an MPFR object.  Any high-precision floating point
arithmetic in Sage uses MPFR.

 In an extension of the floating point issue I am actually interested in: I
 found a list of libs to support floating point arithmetics that are not in
 the list of included libs to Sage. I found some examples to include tools
 with a CLI via http in the documentatin. I did not find hints how to include
 C/C++ or other language libs to Sage? (To clear that statement: The fact I
 could not find it does not mean it is not documented in some place!)

If you want to interface with other C/C++ libraries, the easiest way
to do so is using Cython [1].  There are also lots of examples in the
Sage library; for example,
$SAGE_ROOT/devel/sage/sage/rings/real_mpfr.pyx

--Mike

-- 
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 unsubscribe, reply using remove me as the subject.


[sage-support] strange n()

2010-04-10 Thread bb

Just experimenting with Sage syntax I found something strange:

sage: n(pi)
3.14159265358979
sage: n(pi,20)
3.1416
sage: n(pi,29)
3.1415927
sage: n(pi,59)
3.1415926535897932
sage: n(pi,0x59)
3.1415926535897932384626434
sage: pi.n(digits=17)
3.1415926535897932
sage:

Is there any explanation?

Regards BB

--
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-10 Thread Mike Hansen
On Sat, Apr 10, 2010 at 1:02 AM, bb bblo...@arcor.de wrote:
 Is there any explanation?

Could you be more specific in your question?  Everything there looks
normal to me.  n(pi, 20) means to compute using 20 bits of precision.

--Mike

-- 
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-10 Thread Alex Ghitza
On Sat, 10 Apr 2010 01:08:12 -0700, Mike Hansen mhan...@gmail.com wrote:
 On Sat, Apr 10, 2010 at 1:02 AM, bb bblo...@arcor.de wrote:
  Is there any explanation?
 
 Could you be more specific in your question?  Everything there looks
 normal to me.  n(pi, 20) means to compute using 20 bits of precision.

... which you can figure out from the first two lines of the docstring
for n, by typing n? at the Sage prompt :).


Best,
Alex


-- 
Alex Ghitza -- http://aghitza.org/
Lecturer in Mathematics -- The University of Melbourne -- Australia

-- 
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-10 Thread bb

Mike Hansen schrieb:

On Sat, Apr 10, 2010 at 1:02 AM, bb bblo...@arcor.de wrote:
  

Is there any explanation?



Could you be more specific in your question?  Everything there looks
normal to me.  n(pi, 20) means to compute using 20 bits of precision.

--Mike

  

Ok, I see - the argument defines the number of bits and not of digits!

In any other CAS (I know) that parameter describes the number of digits 
displayed. I. e .


Maxima:
(%i2) fpprec: 40;
(%o2) 40
(%i3) bfloat(sqrt(2.));
(%o3) 1.41421356237309504880168872420969807857b0
(%i4) bfloat(sqrt(2));
(%o4) 1.41421356237309504880168872420969807857b0
(%i4)

That are 40 digits (with decimal point)

Mathematica:

N[sqrt[2], 40]
1.41421356237309504880168872420969807857
delivers 40 decimal places including the decimal point.
N[sqrt[2.], 40]
1.414213562373095
(that is because Mathematica assumes a 18 bit machine precision in the 
number 2.0 and cuts off questionable digits of precision)


Sage works a bit different from the main stream with the definition of 
the number of digits. So one should not wonder about my misinterpretation!

But thanks for helping! Now I understand the difference:

sage: n(sqrt(2.), digits=40)
1.414213562373095145474621858738828450441
sage: n(sqrt(2), digits=40)
1.414213562373095048801688724209698078570
sage:

Sage is missing the errror forwarding of Mathematica.

sage: n(sqrt(2.000), digits=40)
1.414213562373095145474621858738828450441
sage: n(sqrt(2.000), digits=40)
1.414213562373095048804445654500039353252
sage: n(sqrt(2.000), digits=40)
1.414213562373095048801688724209698078570
sage: n(sqrt(2.000), digits=41)
1.4142135623730950488016887242096980785697
sage:

So one has an assortet collection and a rich choice of different 
numbers. Where I find the calculation philosophie of maxima not too bad!


Regards BB




--
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 unsubscribe, reply using remove me as the subject.


Re: [sage-support] strange n()

2010-04-10 Thread Mike Hansen
On Sat, Apr 10, 2010 at 3:37 AM, bb bblo...@arcor.de wrote:
 sage: n(sqrt(2.), digits=40)
 1.414213562373095145474621858738828450441
 sage: n(sqrt(2), digits=40)
 1.414213562373095048801688724209698078570
 sage:

If you wanted this to be more like Maxima, the appropriate thing to do
would some something like:

sage: RealNumber = RealField(137)
sage: sqrt(2.0)
1.414213562373095048801688724209698078570
sage: sqrt(2).n(digits=40)
1.414213562373095048801688724209698078570


 Sage is missing the errror forwarding of Mathematica.

Yes, Sage does not have a numerical type that does Mathematica's
significance arithmetic.  An interesting thread about the merits and
demerits of significance arithmetic is
http://sci.tech-archive.net/Archive/sci.math.symbolic/2008-03/msg00014.html
.

One could do a little work to get Sage's interval arithmetic to do
something similar.

--Mike

-- 
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 unsubscribe, reply using remove me as the subject.


[sage-support] strange 3d plot

2010-03-02 Thread ma...@mendelu.cz
Dear sage-support

If I plot 3d graph using

sage: plot3d(sqrt(sin(x)*sin (y)), (x,0,12),(y,0,12) )

the output looks fine. The output of

sage: plot3d(sqrt(sin(x)*sin (y)), (x,0,2*pi),(y,0,2*pi) )

should be different but it is completely wrong (no graph and bounds
for z from 0.0 to 0.0156).
The plot for

sage: plot3d(sqrt(sin(x)*sin (y)), (x,0,(2*pi+pi/2)),(y,0,(2*pi+pi/
2)) )

looks fine again. Is it a bug in code for plot3d when determing z-
range?  Is it possible to force my z-range to show command?

Many thanks
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] Strange behaviour of trig_expand

2010-02-02 Thread Nicolas
Here is some to-my-opinion strange behaviour of trig_expand :

#Declare real variables
var('a b c')
assume([a,'real'],[b,'real'],[c,'real'])
assumptions()
--- [a is real, b is real, c is real]

#Case 1
sin(a+b).trig_expand()
--- sin(a)*cos(b) + sin(b)*cos(a)

#Case 2
sin((a+b)/2).trig_expand()
--- sin(1/2*a)*cos(1/2*b) + sin(1/2*b)*cos(1/2*a)

#Case 3
sin((a+b)/c).trig_expand()
--- sin((a + b)/c)

#Case 4
sin((a/c+b/c)).trig_expand()


In case 3, the expansion is not done. I wonder if it would be possible
to do it. Obviously, if the sine argument was rational expanded before
trig expansion, it would work but none seem to work on the whole
expression.

Any idea ?

PS: I am actually using this in an expression where doing this
expansion would simplify a lot and I would have expected simplify_full
to see it... which it does not, I suspect because of this.
--- sin(a/c)*cos(b/c) + sin(b/c)*cos(a/c)

-- 
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] strange lab behavior

2009-09-23 Thread michel

Hi,

I'm a high school math teacher experimenting with getting students to
use SAGE.  I've been successful in getting my students to open their
own notebook accounts.  I took my classes to the computer lab one day,
and during the session the kids started experiencing other names on
their accounts.  The names were all from our class.  No one had access
to anyone else's files, but suddenly the account name would shift to
someone else's.  And then yesterday in my regular classroom while I
was demoing SAGE, suddenly the name on my account changed to that of
one of my students.  She was not in class that period, and I have to
check to see if maybe she was using SAGE somewhere else on campus at
that time.  It was all very mysterious, and so I checked it out with
our tech guy.  I was wondering if the issue was our network.  His
response was, I wonder if technically we’re seen as just a singular
IP address (which is our proxy).  Because, everyone is using the same
proxy (thus same IP) to access this website.  So even though everyone
is making an individual login, it’s all going through the same IP
address.  Any ideas as to what's happening?

Thanks very much,

Michel Paul


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Strange behavior in timeit

2009-08-03 Thread VictorMiller

I was trying to find out how fast a calculation was (applying an
isogeny of degree on an elliptic curve over
a finite field).  At first I noticed that when I repeated a timeit
call with the same expression I was getting monotonically increasing
numbers, so I decided to try something more systematic. I got the
following peculiar results on sagenb.org (just now).  The average
times keep getting longer and longer.  Could this be some bug in the
way that the calls to internal timer routines are used?

 phi = E.isogeny([E(0),P,-P])
for i in xrange(20): timeit('phi(Q)')

625 loops, best of 3: 1.17 ms per loop
625 loops, best of 3: 1.75 ms per loop
125 loops, best of 3: 2.1 ms per loop
125 loops, best of 3: 2.22 ms per loop
125 loops, best of 3: 2.3 ms per loop
125 loops, best of 3: 2.4 ms per loop
125 loops, best of 3: 2.52 ms per loop
125 loops, best of 3: 2.73 ms per loop
125 loops, best of 3: 3.02 ms per loop
125 loops, best of 3: 3.32 ms per loop
125 loops, best of 3: 3.48 ms per loop
125 loops, best of 3: 3.73 ms per loop
125 loops, best of 3: 3.79 ms per loop
125 loops, best of 3: 4.21 ms per loop
125 loops, best of 3: 4.56 ms per loop
125 loops, best of 3: 5.09 ms per loop
125 loops, best of 3: 5.63 ms per loop
125 loops, best of 3: 6.23 ms per loop
125 loops, best of 3: 6.86 ms per loop
125 loops, best of 3: 7.52 ms per loop

Victor

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] strange behavior

2009-06-13 Thread Florian Beutler

Hay
I am a bit annoyed by sage... I just want to print a function two
times and sage gives me an error... this is the first script

#!/usr/bin/env sage -python
import sys
from sage.all import *

import functions
from functions import *

grav_const = 4.3e-06
pi = 3.14159265358979323846
sat_mass = 20.

print Ok... dann legen wir mal los!\n
print step1: definition of the density profile

r = 0.08

print rho(r),\n

print step3: definition of the integrated mass

print mass(r).n(),\n

print step3: definition of the integrated mass

print mass(r).n(),\n

the function definition is the following

import sys
from sage.all import *

def rho(r):
return  1.32419e+08/(1.+(r/0.81))**3

def mass(r):
pi = 3.14159265358979323846

x=var('x')
assume(x0)
i_term = integral(x**2*rho(x), x, 0, r)

return i_term*4.*pi;

so I just try to plot the mass two times... the error message of sage
is not very helpful (at least to me)
thanks for any help
florian



--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] strange characters in notebook

2009-05-07 Thread gyro

Hi,
I am running Sage version 3.4.1 on a CentosOS5 Linux workstation. Sage
is compiled from source.
I am using the notebook interface through Firefox version 3.0.10 with
jsMath v3.6a.

In the notebook interface, when I evaluate the contents of a cell, the
proper output is 'sandwiched' between sets of strange characters.

I apologize for being ignorant as to what the characters are or
represent, but there are some square boxes containing '001B' and the
strings '[0m' and '[1;30m' repeated several times.

I have tried previous versions of both Sage (v3.3) and Firefox
(v3.0b5) and the problem is still there.

Does anyone have any ideas as to what might be happening and how to
fix the problem?

Thank you for any help you can offer.

-gyro


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Strange behavior on sagenb

2009-03-26 Thread Jason Bandlow

Hi all,

When I start up a clean version of sage 3.4 on my local machine and
enter the following into a notebook cell:

M=load('http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.sobj')
# This object is a dictionary
key = (1, Partition([1]),Partition([2]))
print key in M.keys()
M[key]

I get the following (correct) output:

Attempting to load remote file:
http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.s\
obj
Loading: [..]
True
# A matrix that I won't reproduce here

When I enter the exact same text in a notebook cell on sagenb, I get the
following output:

Attempting to load remote file:
http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.s\
obj
Loading: [..]
True
Traceback (most recent call last):
  File stdin, line 1, in module
  File
/home/sage/sagenb/sage_notebook/worksheets/jbandlow/11/code/41.py,
line 10, in module
M[key]
  File
/home/sage/sage_install/sage-a/local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/,
line 1, in module

KeyError: (1, [1], [2])

Why am I getting a KeyError if key in M.keys() is returning True?  And
why is the behavior on sagenb different than on my local, 3.4
built-from-source on Ubuntu 10.8 distribution?

Any ideas are very welcome!

Cheers,
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Strange behaviour of float()?

2009-01-29 Thread martin Campos Pinto

Hi everybody,

in my Notebook (version 3.2.3) I get the following:

sage: a = float(11)
sage: a

0.0

sage: var('x')
sage: b(x) = float(x1)

Traceback (most recent call last):
  File stdin, line 1, in module
  File /Users/campos/.sage/sage_notebook/worksheets/admin/4/code/
204.py, line 8, in module
_=var(x);b=symbolic_expression(float(x_sage_const_1 )).function
(x)
  File /Applications/sage/local/lib/python2.5/site-packages/
SQLAlchemy-0.4.6-py2.5.egg/, line 1, in module

TypeError: float() argument must be a string or a number

... is this a normal behaviour for float()? And sorry is this is a
silly question!
-- Martin

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] strange list behavior

2008-01-09 Thread benjamin antieau

Code for the worksheet attached below.

There must surely be a simple answer to this problem, but I have not
been able to figure it out. I loop through i,j print the list
[i,j], and append the list to pts. However, once appended to points
something goes wrong, and all that points sees are the constant lists
[3,3]. I have changed the various constants and such, but I am at a
loss to explain why this is happening.

What I need is for pts to contain the correct information. Any help
would really be appreciated.

Ben

{{{id=125|
P=[0,0]
i=0
pts=[]
while i4:
P[0]=i

j=0
while j4:
P[1]=j
print P
pts.append(P)
j+=1
i+=1
pts
///
[0, 0]
[0, 1]
[0, 2]
[0, 3]
[1, 0]
[1, 1]
[1, 2]
[1, 3]
[2, 0]
[2, 1]
[2, 2]
[2, 3]
[3, 0]
[3, 1]
[3, 2]
[3, 3]
[[3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3,
3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]]
}}}

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] strange behaviour when converting a numpy matrix to a sage one.

2007-10-11 Thread adrianmatematico

sage: import numpy
sage: numpy.array([[1,2,3],[4,5,6],[7,8,9]],'f')

array([[ 1.,  2.,  3.],
   [ 4.,  5.,  6.],
   [ 7.,  8.,  9.]], dtype=float32)
sage: a=numpy.array([[1,2,3],[4,5,6],[7,8,9]],'f')
sage: matrix(a)

[ 2.0047311  512.000122547   8192.0019722]
[ 131072.031677 9.87267348858e-312 1.48958728182e-263]
[6.36598737141e-314  6.6976282025e-316 3.40280828847e-313]
sage:


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Strange Error in Converting polynomials to vector

2007-10-01 Thread Ahmad

I just tried this and when the field is bigger or equal  to 2^16 I got
following error:

2^15: Fine!

K.a = GF(2^15, 'a')
V = K.vector_space()
z = (a+1)^13
V(z)

(1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0)


2^16: Error!

K.a = GF(2^16, 'a')
V = K.vector_space()
z = (a+1)^13
V(z)



Exception (click to the left for traceback):
...
TypeError: can't initialize vector from nonzero non-list



I just wanted to know what is the difference between case 2^15 and
2^16.

Thanx in advance!

Bests,
Ahmad


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---