Ask Your Question

FrédéricC's profile - activity

2019-07-09 08:04:16 -0500 commented question Does the set_embedding command have a bug?

I am not sure whether our planar plot function respects the embedding or not :

sage: G = graphs.RandomTriangulation(10)
sage: G.plot(layout='planar')

But at least it displays a planar graph.

2019-07-05 07:35:14 -0500 answered a question From the following collection how to find only those graphs having only integer eigenvalue

Like that

L = [G for G in graphs.nauty_geng("8 -c")
     if all( <= 1 for f, d in G.laplacian_matrix().charpoly().factor())]

Then you have a list of graphs. You can then use

graphics_array([G.plot() for G in L])

or any other way to display them.

2019-07-05 02:49:58 -0500 commented question How to count face on a bipartite graph?

What about using

sage: RibbonGraph?
2019-07-05 02:39:22 -0500 commented question Possible bug in CC needs confirmation

I would qualify this as "garbage in > garbage out"..

2019-07-05 02:11:13 -0500 commented question From the following collection how to find only those graphs having only integer eigenvalue

Something like that

sage: [G for G in graphs(6) if all(<=1 for f,d in G.charpoly().factor())]
2019-07-03 02:14:33 -0500 commented answer how can i export an elliptic curve over finite field values as a look up table.

Please use python3 syntax for print in your answers.

2019-07-02 05:05:54 -0500 answered a question Octave-like plot function, or, how to plot sequence of points?

Like this

sage: x = [1, 5, 7, 8, 8.7, 10, 13, 15]
sage: y = [2, 8, 13, 10, 9, 6.3, 2, -1]
sage: list_plot(list(zip(x,y)), plotjoined=True)
2019-06-23 02:10:32 -0500 commented question How to obtain the eigenvector for the following graph?

try using e=t - (1/2)*Q

2019-06-23 02:08:27 -0500 edited question How to obtain the eigenvector for the following graph?

Here is some code:

Q=matrix(QQ,3 , 3, lambda x, y: 1)

My eigenvectors are not coming and sage is giving some error report. How to recover it?

2019-06-21 02:35:29 -0500 edited question Plotting Graphs with different size vertices

Hi, I'm trying to plot a graph where all vertices have a different size, depending on a value assigned to them, so a vertex with a high value would have a larger circumference.

I don't really know where to start. Can you help me?

2019-06-20 10:14:24 -0500 commented question Plotting Graphs with different size vertices

First sketch:

sage: G=Graph({1:[2],2:[3,4,5]})
sage: P=G.plot(save_pos=True)
sage: pos=G.get_pos()
sage: sum(circle(xy,0.33,color='red') for xy in pos.values())+P
2019-06-20 01:44:29 -0500 edited question Opening "old" Sage Notebooks in Jupyter: not UTF-8 encoded

I've decided to pay attention to the "Sage Notebook is Deprecated" message at the top of all of my Notebooks, and convert everything into Jupyter. So it seems that I'm got Jupyter running on my system (through Anaconda), but when I save all my SageMath notebooks (as .sws files, since that seems to happen by default), and open them in Jupyter, (I'm running Jupyter with "sage -n jupyter"), I get the message in the notebook that the file is not UTF-8 encoded, and nothing else (sorry, I can't for the life of me seem to cut and paste this exact message from the Jupyter notebook...).

I did a little searching and at least discovered this:

$ file -bi Embedded\ Torus\ in\ Invariant\ Coordinates\ \(S3\ Scale\ Factor\,\ Bump\).sws 
$ application/x-bzip2; charset=binary

So this file (and all my Sage Notebook Files) have "binary" listed as the character set. That seems bad to me - if it's a character set, shouldn't it be ASCII at least, or something?

Anyone know how I can get these notebooks into Jupyter? I can go back and save them as something different if I knew what I needed to do.

2019-06-18 06:24:25 -0500 commented answer Testing if the entries of a matrix of rational vectors are actually integers


sage: A.change_ring(ZZ)
2019-06-11 00:47:19 -0500 received badge  Necromancer (source)
2019-06-09 03:49:14 -0500 answered a question Efficient way to define many variables?

If you mean polynomial variables:

sage: R = PolynomialRing(QQ, x, 44)
sage: x = R.gens()
sage: x[33]
2019-06-09 03:46:43 -0500 answered a question Pretty print factorizations as fractions

Convert to the symbolic ring ?

sage: x = polygen(QQ, 'x')
sage: unicode_art((x**3+4)/(x**7-66))
(x^3 + 4)/(x^7 - 66)
sage: unicode_art(SR((x**3+4)/(x**7-66)))
 x  + 4
x  - 66

sage: unicode_art(SR(factor((x**3+4)/(x**4-1))))
         x  + 4         
                ⎛ 2    ⎞
(x - 1)⋅(x + 1)⋅⎝x  + 1⎠
2019-06-06 07:58:24 -0500 commented question positive values of polynomials

Et dans QuadraticForm ?

2019-06-05 13:06:29 -0500 commented question Explicitly clean all memory usage

using python2 or python3 ?

2019-06-03 07:26:52 -0500 edited question Trouble with spherical coordinates in sagemanifolds

I'm probably doing something obviously wrong, but I'd appreciate help with the following.

I load the following file

theManifold = Manifold(3, 'M', r'\mathcal{M}')
theOpenSet = theManifold.open_subset('theOpenSet')
CartesianChart.<x,y,z> = theOpenSet.chart(r'x y z')
g = theManifold.lorentzian_metric('g')
g[0,0] = 1
g[1,1] = 1
g[2,2] = 1
sphericalChart.<r,th,ph> = theOpenSet.chart(r'r th:(0,pi):\theta ph:(0,2*pi):\phi')

spherical_to_Cartesian = sphericalChart.transition_map(CartesianChart,[r*sin(th)*sin(ph),r*sin(th)*cos(ph),r*cos(th)])
Cartesian_to_spherical = spherical_to_Cartesian.inverse()

Sage then gives the error message "ValueError: no solution found; use set_inverse() to set the inverse manually".

If I replace the final two lines with

 Cartesian_to_spherical = CartesianChart.transition_map(sphericalChart[sqrt(x^2+y^2+z^2),arctan(z/sqrt(x^2+y^2)),arctan(y/x)])
 spherical_to_Cartesian = Cartesian_to_spherical.inverse()

then Sage gives the following unable to make sense of Maxima expression '[if((-pi/2<parg(_sage_var_xxxx0))and(-pi 2<parg(-_sage_var_xxxx0="" sqrt((4<em="">e^(2I_SAGE_VAR_xxxx1))/(e^(4I*_SA ... [dozens of lines of similar] ... tan(_SAGE_VAR_xxxx1)^2+1)],union())]' in Sage.

I am aware that Sagemanifolds has native commands for using spherical coordinates. I'm attempting to work on a more complicated manifold, and this is is a minimal working example to demonstrate my problems.

2019-06-01 05:24:03 -0500 commented question How to handle elements of two different Galois fields simultaneously?

Use different names..

2019-05-31 11:42:52 -0500 commented question How to grab the 'function' part of a differential form?

Contract with a vector field ?

2019-05-29 13:33:53 -0500 edited question How to perform modulus in polynomial rings..

The following code i wrote in in sage sheet

x = PolynomialRing(RationalField(), 'x').gen()
a = PolynomialRing(RationalField(), 'a').gen()
b = PolynomialRing(RationalField(), 'b').gen()
f =a* x/(x+1)
g = b*x**3/(x+1)
g1 = f%g
print g1

It is giving error. My main objective is to find quotient and remainder.Thanks in advance.

2019-05-27 02:26:09 -0500 received badge  Good Answer (source)
2019-05-26 08:57:34 -0500 answered a question How to show more results in sagemathcell?

Like that:

[1+2, 10+20, 100+200]
2019-05-25 00:42:24 -0500 received badge  Nice Answer (source)
2019-05-24 13:39:14 -0500 answered a question installing the kohel database

Tio find the correct package

sage --package list | grep kohel


sage -i database_kohel
2019-05-19 13:09:31 -0500 edited question SageMath Gap Kernel Compatibility

Hi, I'm having trouble getting the sagemath gap interface to work on my system. Here's some of the output I get when trying to use the all subgroups functionality.

sage: S5 = SymmetricGroup(5)
sage: S5
Symmetric group of order 5! as a permutation group
sage: sg = S5.conjugacy_classes_subgroups()
This workspace is not compatible with GAP kernel (4.10.0, present: 4.10.1).

I have GAP Version 4.10.1 and Sage 8.7 installed.

I've not seen any other people with this issue post about it before, any ideas on what I may be doing wrong?

2019-05-18 11:08:36 -0500 edited question is there anyway to import tkinter on sage ?

i want to organise my work on pretty interface using tkinter module, but it seems that is not obviously easy to do bcs all time i get error becs of importation of tkinter!!! any one had already deal with this issu, can help i'll be thankful. is there any other tool to build interfaces? this is the msg that i got

  `   ImportError                               Traceback (most recent call last)
<ipython-input-5-2602f712d6ec> in <module>()
----> 1 import tkinter

/opt/sagemath-8.6/local/lib/python2.7/site-packages/tkinter/ in <module>()
      4 if sys.version_info[0] < 3:
----> 5     from Tkinter import *
      6     from Tkinter import (_cnfmerge, _default_root, _flatten, _join, _setit,
      7                          _splitdict, _stringify, _support_default_root, _test,

/opt/sagemath-8.6/local/lib/python2.7/lib-tk/ in <module>()
     37     # Attempt to configure Tcl/Tk without requiring PATH
     38     import FixTk
---> 39 import _tkinter # If this fails your Python may not be configured for Tk
     40 tkinter = _tkinter # b/w compat for export
     41 TclError = _tkinter.TclError

ImportError: No module named _tkinter`
2019-05-16 04:24:18 -0500 commented question Discontinuous surface color by z-level

Color function must take values between 0 and 1.

def c(x,y):
     return float(y/(x^2 + y^2+0.005)) % 1
2019-05-14 11:31:48 -0500 received badge  Nice Answer (source)
2019-05-03 13:29:46 -0500 commented question Monomial coefficients in a PBW basis

Please post a minimal example of the code that you use, so that can see the exact objects that you look at.

2019-04-30 04:37:45 -0500 commented question tqdm's "total" parameter bug

Try with "10" instead of str(10)

2019-04-27 02:31:00 -0500 answered a question Scaling and tensor product for Lie Groups

Like this

sage: A3 = WeylCharacterRing("A3",style="coroots")
sage: z = A3(1,1,1)
sage: A3(2*z.highest_weight())
2019-04-27 02:29:19 -0500 edited question Scaling and tensor product for Lie Groups

I am new to any coding. I want to compute a tensor product of several scaled weights of a lie group and I can't get this to work.

Looking at the sage math pages for Weyl Character Rings, I figured out how to do tensor product decompositions, e.g. if you put in

A2 = WeylCharacterRing("A3",style="coroots")

then it gives you the decomposition of the above tensor product (where the weights (1,1,1), etc., are written in the fundamental weight basis).

I want to compute something like


where each of the weights is scaled by 2, but without having to manually scale the weights (so I can implement this in some more general code).

You can scale weights by entering e.g. A2(1,1,1).scale(2), and this gives you A2(2,2,2), BUT this only works for me when I add .ambient() to the end of the definition of A2 above. HOWEVER after I add .ambient(), the tensor products no longer work! (If I try to do a tensor product after adding the .ambient(), it just adds the vectors componentwise...)

If anyone is familiar with how to do this sort of thing, your help would be greatly appreciated! Thanks.

2019-04-24 15:18:42 -0500 commented question "from __future__ import print_function" fails on Sage scripts

Then just import what you need. The command "import_statements" is very useful to find the required imports.

2019-04-24 12:42:26 -0500 commented question "from __future__ import print_function" fails on Sage scripts

Just use .py files. Preparsing is not really useful once you are used to sage.

2019-04-24 07:05:54 -0500 commented question Persistent install problems

DId you install the prerequisites ?

2019-04-24 03:42:16 -0500 commented answer Defining a 'nice' Compositum

Please use python3 print syntax in your answers.

2019-04-18 02:46:39 -0500 commented question Computations in the ring of integers of a number field

Methods that appear in tab completion are not always implemented.

2019-04-16 00:53:05 -0500 commented question help with graphics_array magic, please
2019-04-11 08:20:22 -0500 received badge  Nice Answer (source)
2019-04-10 03:35:50 -0500 commented question Elliptic Integral Bug?

Typical problem with integration using maxima package abs_integrate.. Not the first one..

2019-04-10 02:19:29 -0500 edited question function parameters as sum limits

I am completely new to sage, so I am afraid that this should be a very standard well known issue. Sorry for that.

I need to define a function one of whose parameters is a limit of a sum. I tried:

d,n,i = var('d,n,i')
def N(d,n):
 if n==1:
        return 1
        return sum(N(d,i),i,1,n-1)

But sage complains with a RuntimeError. Why is that? I suppose that for some reason the parameter n from the function is not assigned to the variable limit n-1 in the sum. I this correct? How can I fix that?

2019-04-09 13:19:44 -0500 commented question function parameters as sum limits

Use this:

return sum(N(d,i) for i in range(1,n))

Your syntax is for symbolic sums only. And remove your first line.