Ask Your Question

FrédéricC's profile - activity

2019-02-10 11:42:12 -0600 received badge  Nice Question (source)
2019-02-10 06:57:48 -0600 edited question Use colormap for a 3dlistplot?

How can I plot a list of points in space where the points are colored by their height?

The following code:

biglist = [(0, 0, 12), (0, 1, 19), (0, 2, 24), (0, 3, 30), (0, 4, 33), (0, 5, 35),
(0, 6, 38), (0, 7, 40), (0, 8, 41), (0, 9, 43), (0, 10, 44), (0, 11,
44), (0, 12, 44), (0, 13, 44)]

cm = colormaps.autumn
cf = lambda (x,y,z): z/100 % 1

list_plot3d(biglist, color=(cm,cf), point_list=True)

produces the following error:

b/ MatplotlibDeprecationWarning: The matplotlib.delaunay
module was deprecated in version 1.4. Use matplotlib.tri.Triangulation
  warnings.warn(message, mplDeprecation, stacklevel=1)
.7/site-packages/numpy-1.11.0-py2.7-macosx-10.7-x86_64.egg/numpy/lib/fun\ RuntimeWarning: invalid value encountered in
  c /= stddev[:, None]
.7/site-packages/numpy-1.11.0-py2.7-macosx-10.7-x86_64.egg/numpy/lib/fun\ RuntimeWarning: invalid value encountered in
  c /= stddev[None, :]
Traceback (click to the left of this block for traceback)
KeyError: 'popitem(): dictionary is empty'
2019-02-08 02:29:45 -0600 edited question draw all faces of alcoves (affine root system)

I am trying to plot alcoves for in a rank 3 affine root system with some of those alcoves highlighted by having all faces drawn and the others only shown as a wire frame.

The manual on visualising root systems at is quite useful, but I have some effects show that I don't understand.

For some reason while the fundamental alcove will have all faces shown many of the others have not, that is, some faces are missing. Below you find one example code that I have done. For the chosen seq one face is missing, the red one. For other choices of seq one might even see only one face drawn. How do I force to have all faces shown?

L = RootSystem(["A",3,1]).ambient_space()
P = RootSystem(["A",3,1]).weight_space(extended=True)
Lambda = P.fundamental_weights()
W = L.weyl_group()
plot_options = L.plot_parse_options()
t = 1*Lambda[1]-1*Lambda[2]+1*Lambda[3]
Alcoves=[W.from_reduced_word(w.reduced_word()) for w in W0]
p = L.plot_fundamental_chamber("classical")
p += L.plot_fundamental_weights()
p += L.plot_alcoves(alcoves=Alcoves, wireframe=True)
p += L.plot_alcoves(alcoves=[W.from_reduced_word(seq)])
p += L.plot_alcoves(alcoves=[W.from_reduced_word([])])
p += plot_options.family_of_vectors({t: L(t)})
2019-02-05 14:00:00 -0600 commented question What does the [ File " " , Line 1, in < module > ] error mean?

This looks like the error that appears when calling "var" inside python, not inside sage..

2019-02-05 08:20:49 -0600 received badge  Nice Answer (source)
2019-02-04 13:01:46 -0600 answered a question Problem with Padé approximation

Here is what I get with sage 8.7.beta2. This seems to be correct. Which version of sage are you using ?

sage: x = QQ[['x']].0
sage: f = x.cos()
sage: f.pade(2,4)
(-244/3*x^2 + 200)/(x^4 + 56/3*x^2 + 200)
sage: f.pade(2,4)(x)
1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 - 17/216000*x^8 + 463/32400000*x^10 - 9139/9720000000*x^12 + 23771/1458000000000*x^14 + 1390687/437400000000000*x^16 - 24818093/65610000000000000*x^18 + O(x^20)
sage: f
1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 + 1/40320*x^8 - 1/3628800*x^10 + 1/479001600*x^12 - 1/87178291200*x^14 + 1/20922789888000*x^16 - 1/6402373705728000*x^18 + O(x^20)
2019-01-27 09:09:04 -0600 answered a question codimension of an ideal or free submodule

Like that

sage: R=GF(2)['x,y']
sage: x,y=R.gens()
sage: I=R.ideal([1+x*y,x+y])
sage: I.vector_space_dimension()
2019-01-19 02:46:07 -0600 commented question weird behavior quotient operator

try ZZ(test)//2

2019-01-19 02:45:43 -0600 edited question weird behavior quotient operator


i am calculating the quotient of a really big number using the operator // the fact is: if the big number is in a variable, let's say x, and i write x//2, it won't work (it'll return x/2). But if i copy/paste the big number and write //2 at the end, it works.

I don't understand it. I wanted to post a picture as example, but it seems that i need more karma to do it... so instead i put a copy/paste of the problem at the end of this post. The variable's name is "test", so i first print it, then do the //2; as you can see it doesn't work, i got the same number with /2 at the end. Then i copy/paste the number and use //2 again and here it works. The point is: when i use it in a programm, i can't copy/paste the number, it'll be in a variable. And then it fails.

sage: test
sage: test//2
sage: 83785236716094168688218220327981082153433159005629218206574922035922990009479932230685369370646
....: 30888727678204051700187944518981017658536142831535214125053659602283044807607946885170928966526
....: 46155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504
....: 593832198908321736540951//2
2019-01-17 02:54:02 -0600 commented question How can I solve the following (linear) differential equation?

giac gives an answer, but this answer fails to be converted to sage

2019-01-15 09:59:43 -0600 commented question sage 8.5 windows jupyter can't work

What can not be decoded is 未命名

2019-01-15 09:57:52 -0600 edited question sage 8.5 windows jupyter can't work

i use a windows laptop with Chinese. i download the windows installer, and install the sage 8.5 successfully. it can run sage(shell) correctly, but when i launch the jupyter, something wrong with it.

"sage -n" use the cmd to start a server, i got

File "/opt/sagemath-8.5/src/bin/sage-notebook", line 268, in 
File "/opt/sagemath-8.5/src/bin/sage-notebook", line 142, in init
super(SageNBExport, self).init(argv)
File "/opt/sagemath-8.5/src/bin/sage-notebook", line 100, in init
File "/opt/sagemath-8.5/local/lib/python2.7/site-packages/jupyter_core/", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/opt/sagemath-8.5/local/lib/python2.7/site-packages/traitlets/config/", line 657, in launch_instance
File "", line 2, in initialize
File "/opt/sagemath-8.5/local/lib/python2.7/site-packages/traitlets/config/", line 89, in catch_config_error
File "/opt/sagemath-8.5/local/lib/python2.7/site-packages/traitlets/config/", line 385, in print_help
File "/opt/sagemath-8.5/local/lib/python2.7/site-packages/traitlets/config/", line 377, in print_subcommands
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128)

so i try some solutions, i can skip this step, but i got stuck in the jupyter launch step:

Could not decode '\xe6\x9c\xaa\xe5\x91\xbd\xe5\x90\x8d' for unicode trait 'untitled_notebook' of a LargeFileManager instance.

i know there is something wrong with the coding in python (and there are many problems when software operate with Chinese), but i can't find the right way to solve it

2019-01-10 10:22:29 -0600 commented question Is it possible to import machine learning libraries in Sage?

or more precisely in the python used by sage, which can be the system's python, depending on the way you installed sage.

2019-01-10 04:25:21 -0600 commented question Number of elements in vector

This can be found using len(v)

2019-01-10 01:57:27 -0600 commented question Is it possible to import machine learning libraries in Sage?

you can import any python module that is installed in sage's own python.

2019-01-09 02:32:22 -0600 edited answer How to format posts on this forum?

Not exactly Markdown, but close to it, you can discover the syntax by editing a post and clicking on the icons on top of the edit section (e.g. B, I, planet, ", 101010, picture,...).

For example bild is obtained with **, italic with *, and so on.

Regarding formatting Sage, you can have a monospaced code either with the button 101010, or by adding 4 spaces at the beginning of very code line.

I edited your other question, you can check the markup by editing it.

2019-01-04 03:03:04 -0600 edited question Torsion subgroups of Jacobian over fields bigger than rationals.

I am interested to compute: ``torsion subgroups of Jacobian abelian variety J_0(p^2) defined over fields bigger than rationals."

The command: Upto p=11 it is fine after that if you give


gives the error:

``AttributeError                            Traceback (most recent call last)
<ipython-input-1-0f46a1a51624> in <module>()
      1 A = J0(Integer(169))
      2 A.qbar_torsion_subgroup()
----> 3 A.field_of_definition()
      4 J0(Integer(169)).qbar_torsion_subgroup().field_of_definition()"

Can somebody kindly tell me why Sage can compute upto p=11?

2019-01-03 10:27:30 -0600 received badge  Nice Answer (source)
2018-12-30 10:39:39 -0600 received badge  Nice Answer (source)
2018-12-30 04:19:42 -0600 commented question What is the .modulus() function doing?


2018-12-21 01:17:08 -0600 commented question Error in SageMath Code which crash my PC

syntax error, the brackets are not right. You are trying to iterate over QQ...

2018-12-20 11:41:04 -0600 edited answer Is it possible to use python3?

The long-term plan is to move Sage to Python 3. Here's a couple Trac metatickets that show the progress:

In the mean time, just be aware of the major changes between the two versions and write Python 3-compatible code as much as possible.

2018-12-20 11:40:25 -0600 edited question Is it possible to use python3?

I just learnt python3. But i came to know after installing sage that it use python2? Do I have a future in sage? I don't prefer to use the cloud, but the package i have?

What should I do now?

2018-12-18 02:59:52 -0600 commented question Global Dependency in Polyhedron Volume

There is a known issue with volume computations when coefficients are in RR. Try if possible to use coefficients in QQ.

See for the known bug.

2018-12-11 13:09:15 -0600 answered a question Overloading the binary operation of symmetric groups to reverse the order

Well, this is sort of a known problem..

There is something for permutations:

sage: Permutations.options(mult='r2l',display='cycle')
sage: a=Permutation([(1,2),(3,)]);a
sage: b=Permutation([(2,3),(1,)]);b
sage: a*b

But this does not seem to be available for SymmetricGroup.

2018-12-11 02:48:49 -0600 commented question Norm in UniversalCyclotomicField

Maybe using

sage: E(8)*E(8).conjugate()

to make your own norm method for vectors ?

2018-12-11 02:46:36 -0600 commented question Viewer 3D issues

Which version of sage ? Which OS (windows© or not windows©) ? How did you install sage ? etc..

2018-12-04 01:32:32 -0600 received badge  Good Answer (source)
2018-12-04 01:03:19 -0600 received badge  Nice Answer (source)
2018-12-03 14:22:56 -0600 commented question Get bit representation of an elliptic curve group element

Maybe like that:

2018-12-03 14:21:43 -0600 commented question How to get the collection of all functions from X to Y in SageMath

Like this:

M = FiniteSetMaps(["a", "b"], [3, 4, 5]); M
2018-12-03 10:47:28 -0600 received badge  Nice Answer (source)
2018-12-03 04:48:18 -0600 commented question gauss-Legendre quadrature

Did you look at the doc: numerical_integral?

2018-11-27 13:09:59 -0600 commented question TypeError with graphs.RandomGNP

typical sage+python3 error ; already fixed in the latest beta

2018-11-12 03:34:44 -0600 received badge  Good Answer (source)
2018-11-11 11:04:09 -0600 received badge  Nice Answer (source)
2018-11-08 14:46:13 -0600 answered a question Are subtypes of Cartan types implemented correctly?

It seems that currently the index set for reducible types can only be consecutive integers starting from 1.

sage: ct = CartanType("B3").subtype([1, 3])
sage: ct.index_set??

This is displayed also in the following example

sage: CartanType("A5").index_set()
(1, 2, 3, 4, 5)
sage: CartanType("A5").subtype([3,4]).index_set()
(3, 4)
sage: CartanType("A5").subtype([1,4]).index_set()
(1, 2)

So there is certainly room for improvement here.

2018-10-26 08:16:28 -0600 commented question Indefinite integral is incorrect

in 8.5.b0:

sage: integral(sqrt(1+cos(x)**2), x).full_simplify()
2018-10-25 10:18:02 -0600 answered a question How to define this polynomial?

Use something like that

sage: [v for v in IntegerVectors(n=4,k=3)]
[[4, 0, 0],
 [3, 1, 0],
 [3, 0, 1],
 [2, 2, 0],
 [2, 1, 1],
 [2, 0, 2],
 [1, 3, 0],
 [1, 2, 1],
 [1, 1, 2],
 [1, 0, 3],
 [0, 4, 0],
 [0, 3, 1],
 [0, 2, 2],
 [0, 1, 3],
 [0, 0, 4]]
2018-10-23 09:30:16 -0600 commented answer Cannot get threejs rendering to work on MacOS

The threejs works very well for me with a python3-built sage (on Ubuntu).

2018-10-12 08:14:09 -0600 commented question Polynomial interpolation given a mathematic function f(x), an interval [a,b] and a natural number n

your px and py should be vectors, not matrices. Use vector(list2(2,5,6))

2018-10-09 11:05:08 -0600 commented answer Is it possible to run (may be partially) Sage with Python 3?

You should not use "make" for the moment.

2018-10-08 12:15:24 -0600 received badge  Necromancer (source)
2018-10-08 03:40:52 -0600 commented question Python3 MigrationStatus
2018-09-19 11:00:04 -0600 answered a question Enumerating prime ideals in SAGE

Like that maybe

sage: K.<a>=QuadraticField(5)
sage: K.primes_of_bounded_norm(120)