[sage-devel] 2 errors in jmol viewer when plotting 3d triangles

2016-07-07 Thread Yao Shuidie
When I try the 3d plot commands of polyhedron class and polygon3d on the 
default jmol viewer, the output doesn't match the command, since I directly 
copy these commands from examples in tutorials.


1.
polygon3d([[0,0,1],[0,1,0],[1,0,0]])

This gives a totally empty graph, though the numbers on the axes changes as 
I change the coordinates. 
The 2d case works well though, and it gives a nice colored triangle.


2.
p2 = Polyhedron(vertices=[[2,0,0],[0,2,0],[0,0,2]])
p2.projection().plot()

This gives a triangle, but only edges. See right of the graph below.
 If I add another vector to the graph
p1 = Polyhedron(rays = [[2,2,2]])
p2.projection().plot() + p1.projection().plot()
Then as the vector is added, the triangle is also colored.See the left of 
the graph below.





In both cases, I believe that the command should plot a colored triangle, 
since the 2d case do so. And if I change the viewer to tachyon, it gives 
the right output. So I consider this as a bug and I hope you can work on 
it. Great thanks!


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


Re: [sage-devel] VotePlugin for trac?

2016-07-07 Thread kcrisman
FWIW I think this is not a bad idea, as long as it's effortless to maintain 
and someone is already volunteering to do it.  If I were spending time on 
developing Sage again instead of wrestling with getting Rob's MBX to work 
for me ;-) then I think this would help somewhat in prioritizing what I 
looked at.  Of course, this also happens already when someone says "ping"; 
I don't know that it will be ridiculously effective but who knows?

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


Re: [sage-devel] Re: sage fails to build on (fresh install of) debian linux 8.4 (64 bit)...

2016-07-07 Thread Joseph Hundley
 

"./sage -t src/sage/arith.py" gets this.


hundleymac:sage jahundle$ ./sage -t src/sage/arith.py

init.sage does not exist ... creating

no stored timings available

Running doctests with ID 2016-07-07-13-47-14-67aaeb78.

Git branch: develop

Using --optional=mpir,python2,sage

Doctesting 1 file.

sage -t src/sage/arith.py

IOError in doctesting framework

**

Traceback (most recent call last):

  File 
"/Users/jahundle/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
 
line 2127, in __call__

doctests, extras = self.source.create_doctests(sage_namespace)

  File 
"/Users/jahundle/sage/local/lib/python2.7/site-packages/sage/doctest/sources.py",
 
line 661, in create_doctests

raise IOError(errno.ENOENT, "File does not exist", self.path)

IOError: [Errno 2] File does not exist: 'src/sage/arith.py'


--

sage -t src/sage/arith.py  # IOError in doctesting framework

--

Total time for all tests: 0.0 seconds

cpu time: 0.0 seconds

cumulative wall time: 0.0 seconds




On Friday, July 1, 2016 at 9:30:24 AM UTC-4, Johan S. R. Nielsen wrote:
>
> Are you having the same problem as me: 
>
> https://groups.google.com/forum/#!topic/sage-devel/WERLdTKfAho 
>
> For instance, do you have sympy installed? (if you don't, "./sage -t 
> src/sage/arith.py" will fail immediately due to uninstalled sympy). 
>
> Do you have Cremona's mini-database installed? Test by running 
>
>sage: db = CremonaDatabase() 
> 
>ValueError: Desired database (='cremona mini') does not exist 
>
> I'm missing many other vital packages on a fresh install, for some 
> reason, including Jmol. 
>
> Best, 
> Johan 
>   
>
>
> Joseph Hundley writes: 
>
> > Installing on yet another computer today.  Same basic deal: everything 
> > builds except dochtml. This time I did check the logs before running 
> ./sage 
> > -i jmol, and can confirm that no file with a name of the form 
> > $SAGE_ROOT/logs/pkgs/jmol-*.log   
> > was written on the initial build. 
> > 
> > On Sunday, June 26, 2016 at 3:05:36 PM UTC-4, Joseph Hundley wrote: 
> >> 
> >> Ah. Then I think we can say with reasonable certainty that there was 
> >> nothing in   
> >> $SAGE_ROOT/logs/pkgs/jmol-*.log   
> >> before today, because when I looked the first time today, there was 
> only 
> >> 
> >> 
> >> Found local metadata for jmol-14.2.11_2015.01.20 
> >> 
> >> Attempting to download package jmol-14.2.11_2015.01.20.tar.bz2 from 
> mirrors 
> >> 
> >> Downloading the Sage mirror list 
> >> 
> >> Searching fastest mirror 
> >> 
> >>   227ms: http://echidna.maths.usyd.edu.au/sage/ 
> >> 
> >>  
> >> 
> >>   178ms: http://www.mirrorservice.org/sites/www.sagemath.org/ 
> >> 
> >> Fastest mirror: http://ftp.ntua.gr/pub/sagemath/ 
> >> 
> >> 
> >> 
> http://ftp.ntua.gr/pub/sagemath/spkg/upstream/jmol/jmol-14.2.11_2015.01.20.tar.$
>  
> >> 
> >> [ 
> >> 
> >> 
> >> On Sunday, June 26, 2016 at 2:13:53 PM UTC-4, leif wrote: 
> >>> 
> >>> Joseph Hundley wrote: 
> >>> > Running ./sage -i jmol fixes the problem of "point3d((0,0,0))" 
> >>> producing 
> >>> > a message about a Jmol viewer being launched but no actual Jmol 
> >>> > viewer.  And fixing jmol fixes the problem with building dochtml. 
> >>> > 
> >>> > Thanks! 
> >>> > 
> >>> > I went to check $SAGE_ROOT/logs/pkgs/jmol-*.log  after issuing the 
> >>> > ./sage -i jmol command, unfortunately. So, all I found there was the 
> >>> log 
> >>> > file being written 
> >>> > at that time. 
> >>> 
> >>> Sage doesn't overwrite existing logs, so the log should contain the 
> >>> output from both attempts. 
> >>> 
> >>> 
> >>> -leif 
> >>> 
> >>> > Interestingly enough, my first run of "make" on my other machine 
> >>> > (running elementary OS) produced a nearly identical dochtml problem. 
> I 
> >>> > presumed I'd have to fix jmol on that one too. But A second run of 
> >>> > "make" just now failed to replicated the problem and Jmol works over 
> >>> there. 
> >>> > 
> >>> > Sorry for not better documenting the bug. 
> >>> > 
> >>> > Best, 
> >>> > 
> >>> > JH 
> >>> > 
> >>> > On Sunday, June 26, 2016 at 3:30:09 AM UTC-4, Dima Pasechnik wrote: 
> >>> > 
> >>> > 
> >>> > 
> >>> > On Sunday, June 26, 2016 at 8:21:16 AM UTC+1, Dima Pasechnik 
> wrote: 
> >>> > 
> >>> > 
> >>> > 
> >>> > On Sunday, June 26, 2016 at 2:48:26 AM UTC+1, Joseph Hundley 
> >>> wrote: 
> >>> > 
> >>> > Was this ever resolved? 
> >>> > I seem to be having the same problem trying to build on 
> >>> both 
> >>> > a Mac and a recent install of elementary OS.   
> >>> > 
> >>> > Certainly there is recent Java on this machine. Other 
> Java 
> >>> > programs run fine. 
> >>> > 
> >>> > The error message appears to say that sage (or Jmol 
> c

Re: [sage-devel] Doc-testing ouptut with dots

2016-07-07 Thread David Roe
On Jul 7, 2016 07:13, "Andrew"  wrote:
>
> Hi!
>
> How do you doc-test output that starts with ...? The particular output
that I want to test is:
>
> sage: print(CartanType(['A', oo]).ascii_art())
> ...---O---O---O---O---O---O---O---...
>  -3  -2  -1   0   1   2   3
>

You could do
sage: print(CartanType(['A',oo]).ascii_art().replace('...','***')

I don't know of a way to directly check your original output.
> but sage complains with:
>
>
> ValueError: line 6 of the docstring for
sage.combinat.root_system.type_A_infinity.CartanType.i lacks blank after
...: '...---O---O---O---O---O---O---O---...'
>
> Clearly, sphinx is getting confused because ... normally indicates code
continuation. Is it possible to work around or disable this or do I need to
change my output?
>
> Andrew
>
> --
> You received this message because you are subscribed to the Google Groups
"sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

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


[sage-devel] Re: python3 imports

2016-07-07 Thread Frédéric Chapoton


Le jeudi 7 juillet 2016 11:13:52 UTC+2, Dima Pasechnik a écrit :
>
>
>
> On Wednesday, July 6, 2016 at 8:22:57 PM UTC+1, Frédéric Chapoton wrote:
>>
>> Dear all,
>>
>> Essentially, print has now been converted to python3-compatible behaviour 
>> in all of sage, after a lot of work by many people
>>
>
> shouldn't we release an update to sagenb, to get these changes there into 
> Sage?
>

Why not, but there is not urgency, and python3 is still a long way ahead.

Frederic 

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


Re: [sage-devel] Re: Errors in an old, massive patch for Skew Polynomials in Sage

2016-07-07 Thread Johan S . H . Rosenkilde
Hi Arpit,

Did you try doctesting other parts of Sage to see whether your
segfaults are related to the ticket or not? It could be related to your
system setup.

If this is not the case, you should, as Travis asked you on an earlier
question, try to find a minimal example which causes the bug from the
Sage shell.

The the signalling behaviour of Cython code changed quite a lot during
the last few years, with ao. cysignals becoming a stand-alone package.
Perhaps the skew polynomial ticket doesn't use sig_on and sig_off
correctly.

Best,
Johan

Arpit Merchant writes:

> Hello,
>
> My apologies for not being able to get back sooner. I was working on a 
> separate ticket this week. And there were some compile errors after Sage 
> upgraded to 7.3beta6. I've fixed those and pushed the changes. Sage now 
> builds and running Sage allows access to the functionalities in the 
> original patch that were already working/fixed. However, before I can move 
> on to fixing the pending ones from last week, I am suddenly getting weird 
> segfault errors while running doctests. i.e. when I do ``./sage -t 
> src/sage/rings/polynomial/skew_polynomial_element.pyx``, I get the 
> following output. What changed in the latest update that has caused this 
> and how can I fix it?
>
> too few successful tests, not using stored timings
>> Running doctests with ID 2016-07-07-14-07-44-39349bdf.
>> Git branch: fix_skew_polynomials_patch
>> Using --optional=mpir,python2,sage
>> Doctesting 1 file.
>> sage -t src/sage/rings/polynomial/skew_polynomial_element.pyx
>> **
>> File "src/sage/rings/polynomial/skew_polynomial_element.pyx", line 100, in 
>> sage.rings.polynomial.skew_polynomial_element
>> Failed example:
>> q,r = c.quo_rem(b,side=Left)
>> Expected:
>> Traceback (most recent call last):
>> ...
>> NotImplementedError
>> Got:
>> 
>> Traceback (most recent call last):
>>   File 
>> "/home/arpit/Documents/GSOC_16/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
>>  
>> line 498, in _run
>> self.compile_and_execute(example, compiler, test.globs)
>>   File 
>> "/home/arpit/Documents/GSOC_16/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
>>  
>> line 861, in compile_and_execute
>> exec(compiled, globs)
>>   File "", 
>> line 1, in 
>> q,r = c.quo_rem(b,side=Left)
>>   File "sage/rings/polynomial/skew_polynomial_element.pyx", line 1232, 
>> in sage.rings.polynomial.skew_polynomial_element.SkewPolynomial.quo_rem 
>> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/rings/polynomial/skew_polynomial_element.c:11397)
>> return self.lquo_rem(other)
>>   File "sage/rings/polynomial/skew_polynomial_element.pyx", line 1092, 
>> in sage.rings.polynomial.skew_polynomial_element.SkewPolynomial.lquo_rem 
>> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/rings/polynomial/skew_polynomial_element.c:10375)
>> c = parent.twist_map(-db)(inv*a[i+db])
>>   File 
>> "/home/arpit/Documents/GSOC_16/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/skew_polynomial_ring.py",
>>  
>> line 607, in twist_map
>> map = self._map**n
>>   File "sage/categories/map.pyx", line 1264, in 
>> sage.categories.map.Map.__pow__ 
>> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/categories/map.c:9103)
>> return generic_power(self, n)
>>   File "sage/structure/element.pyx", line 3496, in 
>> sage.structure.element.generic_power 
>> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/structure/element.c:27116)
>> return generic_power_c(a,n,one)
>>   File "sage/structure/element.pyx", line 3529, in 
>> sage.structure.element.generic_power_c 
>> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/structure/element.c:27789)
>> a = ~a
>> TypeError: bad operand type for unary ~: 
>> 'sage.rings.morphism.RingHomomorphism_im_gens'
>> Killed due to segmentation fault
>> **
>> Tests run before process (pid=13179) failed:
>> sage: R. = ZZ[] ## line 19 ##
>> sage: sigma = R.hom([t+1]) ## line 20 ##
>> sage: S. = R['x',sigma]; S ## line 21 ##
>> Skew Polynomial Ring in x over Univariate Polynomial Ring in t over 
>> Integer Ring twisted by t |--> t + 1
>> sage: a = t + x + 1; a ## line 26 ##
>> x + t + 1
>> sage: b = S([t^2,t+1,1]); b ## line 28 ##
>> x^2 + (t + 1)*x + t^2
>> sage: c = S.random_element(degree=3,monic=True); c ## line 30 ##
>> x^3 + (-95*t^2 + t + 2)*x^2 + (-t^2 + t)*x + 2*t - 8
>> sage: a + b ## line 35 ##
>> x^2 + (t + 2)*x + t^2 + t + 1
>> sage: a - b ## line 37 ##
>> -x^2 - t*x - t^2 + t + 1
>> sage: a * b ## line 40 ##
>> x^3 + (2*t + 3)*x^2 + (2*t^2 + 4*t + 2)*x + t^3 + t^2
>> sage: b * a ## line 42 ##
>> x^3 + (2*t + 4)*x^2 + (2*t^2 + 3*t + 2)*x + t^3 + t^2
>> sage: a * b == b * a ## line 44 ##
>> Fa

[sage-devel] Doc-testing ouptut with dots

2016-07-07 Thread Andrew
Hi!

How do you doc-test output that starts with ...? The particular output that 
I want to test is:

sage: print(CartanType(['A', oo]).ascii_art()) 
...---O---O---O---O---O---O---O---... 
 -3  -2  -1   0   1   2   3

but sage complains with:


ValueError: line 6 of the docstring for sage.combinat.root_system.
type_A_infinity.CartanType.i lacks blank after ...: '   
 ...---O---O---O---O---O---O---O---...'

Clearly, sphinx is getting confused because ... normally indicates code 
continuation. Is it possible to work around or disable this or do I need to 
change my output?

Andrew

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


Re: [sage-devel] VotePlugin for trac?

2016-07-07 Thread Dima Pasechnik


On Wednesday, July 6, 2016 at 5:04:33 PM UTC+1, William wrote:
>
>
>
> On Wednesday, July 6, 2016, Erik Bray > 
> wrote:
>
>> On Jul 6, 2016 17:40, "William Stein" <> wrote:
>> >
>> > On Wed, Jul 6, 2016 at 8:31 AM, Erik Bray <> wrote:
>> >
>> > > Alternatively, we can do a little better than "anonymous" be
>> > > re-enabling registration on the Trac site.
>> > >
>> > > Trac has an "authenticated" role, for users who have passed
>> > > authentication but nothing else.
>> >
>> > That sounds OK.
>> >
>> > >   For now we can at give merely
>> > > authenticated users zero privileges (besides maybe voting) and upgrade
>> > > them to more privileged users (can comment, etc.) if they are trusted.
>> > > If it helps, I can at least add a captcha to the registration page so
>> > > we don't get cluttered with (as many) spam users who otherwise can't
>> > > do anything.
>> > >
>> > > Dima also mentioned adding OpenID authentication which is a
>> > > possibility, but more effort.
>> >
>> > Back when we had easy registration -- without a human manual
>> > verification process -- we would nearly instantly get massive amounts
>> > of horrible spam, and cleaning them up in trac used to be hard because
>> > you couldn't edit/delete comments easily.  A captcha or OpenID would
>> > not have prevented that at all.
>>
>
I was talking about OpenID used for voting only. One really does not want 
completely anonymous
voting, this is too prone to vandalism and the same persons voting many, 
many times.
Certainly, OpenIDs are not enough for anything related to actually posting 
content.
 

> Are captchas just totally useless now? I haven't kept up with the state of 
>> the art on that but I know for a while they were getting pretty easy to 
>> defeat. 
>>
> Well they are useless against a human spammer who simply creates an 
> account and posts content.  Math puzzles work better though against such 
> jerks. 
>
>  
>
>> > I don't know if things are better now and there are less such
>> > spammers.  At least now you can easily delete trac comments to clean
>> > up after a spammer.
>>
>> It's not better. I noted in another thread recently that /register on the 
>> Trac site (even though it's disabled) gets hammered several times per 
>> minute). I'm not too concerned about that though if registered users can't 
>> actually do anything (save for maybe vote?) until they've been manually 
>> verified. 
>>
>> I wonder how large sites like GitHub are managing spam these days. I've 
>> almost never seen spam on GH. 
>>
> That's part of their secret sauce, which is why they get paid the big 
> bucks and almost everybody (except us) uses them...
>
>
>  
>

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


[sage-devel] Re: python3 imports

2016-07-07 Thread Dima Pasechnik


On Wednesday, July 6, 2016 at 8:22:57 PM UTC+1, Frédéric Chapoton wrote:
>
> Dear all,
>
> Essentially, print has now been converted to python3-compatible behaviour 
> in all of sage, after a lot of work by many people
>

shouldn't we release an update to sagenb, to get these changes there into 
Sage?
   

>
> In order to go on moving towards python3, I have started a new sequence of 
> tickets aiming
> at making the imports compatible with python3. This is done folder by 
> folder, and I started with the largest folders.
>
> Please help by reviewing some of those tickets if you can. Thanks to 
> people that have already done so.
>
> See the tickets near the bottom of
>
> https://trac.sagemath.org/query?status=!closed&component=python3
>
> Cheers,
>
> Frederic
>

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


[sage-devel] Re: Errors in an old, massive patch for Skew Polynomials in Sage

2016-07-07 Thread Arpit Merchant
Hello,

My apologies for not being able to get back sooner. I was working on a 
separate ticket this week. And there were some compile errors after Sage 
upgraded to 7.3beta6. I've fixed those and pushed the changes. Sage now 
builds and running Sage allows access to the functionalities in the 
original patch that were already working/fixed. However, before I can move 
on to fixing the pending ones from last week, I am suddenly getting weird 
segfault errors while running doctests. i.e. when I do ``./sage -t 
src/sage/rings/polynomial/skew_polynomial_element.pyx``, I get the 
following output. What changed in the latest update that has caused this 
and how can I fix it?

too few successful tests, not using stored timings
> Running doctests with ID 2016-07-07-14-07-44-39349bdf.
> Git branch: fix_skew_polynomials_patch
> Using --optional=mpir,python2,sage
> Doctesting 1 file.
> sage -t src/sage/rings/polynomial/skew_polynomial_element.pyx
> **
> File "src/sage/rings/polynomial/skew_polynomial_element.pyx", line 100, in 
> sage.rings.polynomial.skew_polynomial_element
> Failed example:
> q,r = c.quo_rem(b,side=Left)
> Expected:
> Traceback (most recent call last):
> ...
> NotImplementedError
> Got:
> 
> Traceback (most recent call last):
>   File 
> "/home/arpit/Documents/GSOC_16/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
>  
> line 498, in _run
> self.compile_and_execute(example, compiler, test.globs)
>   File 
> "/home/arpit/Documents/GSOC_16/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
>  
> line 861, in compile_and_execute
> exec(compiled, globs)
>   File "", 
> line 1, in 
> q,r = c.quo_rem(b,side=Left)
>   File "sage/rings/polynomial/skew_polynomial_element.pyx", line 1232, 
> in sage.rings.polynomial.skew_polynomial_element.SkewPolynomial.quo_rem 
> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/rings/polynomial/skew_polynomial_element.c:11397)
> return self.lquo_rem(other)
>   File "sage/rings/polynomial/skew_polynomial_element.pyx", line 1092, 
> in sage.rings.polynomial.skew_polynomial_element.SkewPolynomial.lquo_rem 
> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/rings/polynomial/skew_polynomial_element.c:10375)
> c = parent.twist_map(-db)(inv*a[i+db])
>   File 
> "/home/arpit/Documents/GSOC_16/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/skew_polynomial_ring.py",
>  
> line 607, in twist_map
> map = self._map**n
>   File "sage/categories/map.pyx", line 1264, in 
> sage.categories.map.Map.__pow__ 
> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/categories/map.c:9103)
> return generic_power(self, n)
>   File "sage/structure/element.pyx", line 3496, in 
> sage.structure.element.generic_power 
> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/structure/element.c:27116)
> return generic_power_c(a,n,one)
>   File "sage/structure/element.pyx", line 3529, in 
> sage.structure.element.generic_power_c 
> (/home/arpit/Documents/GSOC_16/sage/src/build/cythonized/sage/structure/element.c:27789)
> a = ~a
> TypeError: bad operand type for unary ~: 
> 'sage.rings.morphism.RingHomomorphism_im_gens'
> Killed due to segmentation fault
> **
> Tests run before process (pid=13179) failed:
> sage: R. = ZZ[] ## line 19 ##
> sage: sigma = R.hom([t+1]) ## line 20 ##
> sage: S. = R['x',sigma]; S ## line 21 ##
> Skew Polynomial Ring in x over Univariate Polynomial Ring in t over 
> Integer Ring twisted by t |--> t + 1
> sage: a = t + x + 1; a ## line 26 ##
> x + t + 1
> sage: b = S([t^2,t+1,1]); b ## line 28 ##
> x^2 + (t + 1)*x + t^2
> sage: c = S.random_element(degree=3,monic=True); c ## line 30 ##
> x^3 + (-95*t^2 + t + 2)*x^2 + (-t^2 + t)*x + 2*t - 8
> sage: a + b ## line 35 ##
> x^2 + (t + 2)*x + t^2 + t + 1
> sage: a - b ## line 37 ##
> -x^2 - t*x - t^2 + t + 1
> sage: a * b ## line 40 ##
> x^3 + (2*t + 3)*x^2 + (2*t^2 + 4*t + 2)*x + t^3 + t^2
> sage: b * a ## line 42 ##
> x^3 + (2*t + 4)*x^2 + (2*t^2 + 3*t + 2)*x + t^3 + t^2
> sage: a * b == b * a ## line 44 ##
> False
> sage: b^2 ## line 47 ##
> x^4 + (2*t + 4)*x^3 + (3*t^2 + 7*t + 6)*x^2 + (2*t^3 + 4*t^2 + 3*t + 1)*x 
> + t^4
> sage: b^2 == b*b ## line 49 ##
> True
> sage: q,r = c.quo_rem(b)   # default side is right ## line 80 ##
> sage: q ## line 81 ##
> x - 95*t^2
> sage: r ## line 83 ##
> (95*t^3 + 93*t^2 - t - 1)*x + 95*t^4 + 2*t - 8
> sage: c == q*b + r ## line 85 ##
> True
> sage: q == c // b ## line 91 ##
> True
> sage: r == c % b ## line 93 ##
> True
> sage: q,r = c.quo_rem(b,side=Left) ## line 100 ##
> sage: k. = GF(5^3) ## line 107 ##
> sage: Frob = k.frobenius_endomorphism() ## line 108 ##
> sage: S. = k['x',Frob] ## line 109 ##
> sage: a = x^4 + (4*t + 1)*x^3 + (t^2 

Re: [sage-devel] inverse of units

2016-07-07 Thread Daniel Krenn
On 2016-07-06 22:17, Vincent Delecroix wrote:
> Indeed
> {{{
> sage: parent(~1)   # parent changes
> Rational Field
> sage: parent(1.inverse_of_unit())  # same parent
> Integer Ring
> sage: 2.inverse_of_unit()  # error
> Traceback (most recent call last):
> ...
> ZeroDivisionError: Inverse does not exist.
> }}}
> sided note: I would like the above to actually be an `ArithmeticError`
> rather than a `ZeroDivisionError`.

I agree that it is in general not a ZeroDivisionError, but that it is a
(special) ArithmeticError.

Built-in exceptions (from [1]):
  |+-- ArithmeticError
  ||+-- FloatingPointError
  ||+-- OverflowError
  ||+-- ZeroDivisionError

Maybe a class
   class NotInvertibleError(ArithmeticError)
would be suitable; thus one can catch exactly when something is not
invertible and not accidentally catch something else (e.g.
OverflowError, etc.).
(+ Deprecation)

Daniel

[1] https://docs.python.org/2/library/exceptions.html, bottom

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