Ask Your Question

mmarco's profile - activity

2022-02-22 13:27:51 +0200 received badge  Famous Question (source)
2021-10-06 12:44:31 +0200 received badge  Famous Question (source)
2020-08-25 18:57:42 +0200 commented answer Modifying packages/libraries source code

If the changes you make also affect the interface of the library (that is, the name or parameters of the exposed functions), you might need to also replace the corresponding header file in the local/include directory of your sage install, and then modify the file src/sage/libs/braiding.pyxand rebuild the sage library with sage -b

2020-08-25 18:45:02 +0200 answered a question Modifying packages/libraries source code

Hi

I am the maintainer of libbraiding. If the changes you want to make are relevant, you can try to make a pull request with them and I might merge them and release a new version.

If you just want to try some things in your machine, maybe the simplest way is to compile libbraiding with your changes with the usual cycle:

autoreconf --install
./configure
make

and then use the generated files in the lib/.libs directory to replace the corresponding ones in the /local/lib/ directroy of your sage installation.

2019-01-12 13:20:31 +0200 answered a question braid closures

You can conjugate the braid so there are no unused strands anynore. In order to prevent the simplification, you can use two expressions of the same braid.

In your example:

cb1 = B([1,2,1]) cb2 = B([-2,-1,-2])

mybraid = B([1])

myconjbraid = cb1mybraidcb2

myconjbraid produces the same link as mybraid, but since it has no unused strands, it will contain also the trivial components.

2017-03-09 02:31:34 +0200 received badge  Notable Question (source)
2016-08-18 23:09:40 +0200 received badge  Popular Question (source)
2016-06-15 22:09:03 +0200 received badge  Great Answer (source)
2015-11-16 21:20:01 +0200 received badge  Notable Question (source)
2015-10-28 10:46:46 +0200 received badge  Self-Learner (source)
2015-03-26 16:14:20 +0200 received badge  Famous Question (source)
2015-01-15 15:50:45 +0200 received badge  Commentator
2015-01-15 15:50:45 +0200 commented answer Decompose polynomial by other irreducible polynomial

Oh, sorry, i understood that you meant the $a_i$ to be constants.

So what you want are basically the remainders of the division of $f$ by $v$, $v^2$, $v^3$ and so on.

2015-01-15 14:16:36 +0200 answered a question Decompose polynomial by other irreducible polynomial

What you want to do is not always possible (for instance, if $f$ has lower degree than $v$). But when there exists an answer, what you want is just an inverse image of the polynomial $f$ by the map that sends $x$ to $v(x)$.

this can be done using elimination techniques:

sage: R.<x,t> = QQ[]
sage: v = x^2 + x + 1
sage: f = x^4 + 2*x^3 + 6*x^2 + 5*x + 2
sage: I = R.ideal([t - v, f])
sage: L = I.elimination_ideal(x)
sage: L
Ideal (t^2 + 3*t - 2) of Multivariate Polynomial Ring in x, t over Rational Field
sage: L.gen(0)(t=v) == f
True

In this case there was a solution. When there is not, you will get some polynomial whose image is a multiple of what you wanted.

2014-12-30 12:47:01 +0200 received badge  Popular Question (source)
2014-12-09 20:21:05 +0200 answered a question How can I plot points given by code?

I think the function you are looking for is list_plot.

2014-12-08 22:05:10 +0200 received badge  Good Answer (source)
2014-12-08 15:17:05 +0200 received badge  Nice Answer (source)
2014-12-08 12:35:42 +0200 answered a question What's wrong with Лобачевский function?

If what you are interested in is computing values of this function, you can use numerical integration instead of symbolic:

sage: el = lambda theta: -numerical_integral(log(abs(2*sin(u))), 0, theta)[0]
sage: plot(el, 0, pi)
2014-12-04 16:02:12 +0200 received badge  Popular Question (source)
2014-11-28 20:37:57 +0200 answered a question All Ideals of Ring

There is not a single command to achieve that, but in this particular case you can do the following:

sage: k = GF(5)
sage: M = MatrixSpace(k,2,2)
sage: units = [m for m in M if m.is_invertible()]
sage: nonunits = [m for m in M if not m.is_invertible()]
sage: len(units)
480
sage: len(nonunits)
145

Since every ideal must be generated by some nonunits, but also changing a generator by a unit times it does not change the ideal, let's check how many essentially distinct generators can we have:

sage: associated = []
sage: for m in nonunits:
....:     if not True in [a*m in associated for a in units]:
....:         associated.append(m)
....:         
sage: associated
[
[0 0]  [1 0]  [0 1]  [1 1]  [2 1]  [1 2]  [4 1]
[0 0], [0 0], [0 0], [0 0], [0 0], [0 0], [0 0]
]

That is, you only want to check for subsets of that set as possible generators of your ideals. But it is clear that two of those elements actually generate the other four, so you just need to check for ideals generated by up to two generators.

You have the trivial ideal, the other 6 principal ideals generated by the other elements in associated, and the only thing you need to check is if the ideal generated by two of them is the total one. It is easy to see that it is, but in case you don't notice at first sight you can just check it directly:

sage: for (a,b) in Tuples(units,2):
....:     if (a*associated[1] + b*associated[2]).is_invertible():
....:         print a
....:         print b
....:         break
....:     
[0 1]
[1 0]
[1 0]
[0 1]

There you are: only six nontrivial ideals, that happen to be principal.

2014-09-05 16:35:06 +0200 received badge  Enthusiast
2014-08-27 00:45:24 +0200 received badge  Good Answer (source)
2014-08-26 18:16:43 +0200 received badge  Nice Answer (source)
2014-08-26 09:54:37 +0200 received badge  Necromancer (source)
2014-08-25 21:47:35 +0200 answered a question Knot Theory and Sage?

Amit Jamadagni has been working on a knot theory module in this year's GSoC program, under my mentoring. The result is a Link class with some basic functionality (mainly conversion between different representations of a link, and computation of some invariants). It still needs polishing, but i expect we can have something ready to be merged in sage in the following weeks.

From that, there would still be a lot of work to do to improve it, but the basic infrastructure would be there.

https://www.google-melange.com/gsoc/p...

2014-07-23 20:50:50 +0200 received badge  Necromancer (source)
2014-06-29 04:41:44 +0200 answered a question File imports for polynomial rings in sage

Rename your file to my.sage

Then, when you run sage my.sage it will be automatically preparsed. A my.py with all the needed extra python code will be produced and loaded automatically.

2014-01-10 07:45:57 +0200 answered a question Symbolic simplificaction without commutativity

In your particular example, you are doing the computation on the free algebra on ax,ay,az,b over the polynomial ring on px,py,pz,m.

sage: R.<px,py,pz,m>=QQ[]
sage: F.<ax,ay,az,b>=FreeAlgebra(R)
sage: (ax*px+ay*py+az*pz+m*b)^2
px^2*ax^2 + px*py*ax*ay + px*pz*ax*az + px*m*ax*b + px*py*ay*ax + py^2*ay^2 + py*pz*ay*az + py*m*ay*b + px*pz*az*ax + py*pz*az*ay + pz^2*az^2 + pz*m*az*b + px*m*b*ax + py*m*b*ay + pz*m*b*az + m^2*b^2
2013-10-01 18:38:30 +0200 received badge  Popular Question (source)
2013-01-14 14:38:39 +0200 received badge  Good Question (source)
2012-10-18 04:16:32 +0200 received badge  Notable Question (source)
2012-09-15 07:58:01 +0200 received badge  Taxonomist
2012-06-08 09:45:41 +0200 received badge  Nice Answer (source)
2012-06-06 08:50:11 +0200 answered a question how can I use parralelism in SAGE?

A very simple way to use paralelism is provided by the @parallel decorator.

Just write a function that does what you want,with the decorator at the beginning. Then you can pass it a list of entries, and the output will be an iterator with the answers.

Example:

sage: @parallel
....: def f(a):
....:     return a^2
....: 
sage: r=f([1,2,3,4])
sage: r.next()
(((1,), {}), 1)
sage: r.next()
(((2,), {}), 4)
sage: r.next()
(((3,), {}), 9)
sage: r.next()
(((4,), {}), 16)
sage: r.next()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
2012-05-23 09:59:48 +0200 answered a question how to make sage5.0 work in ubuntu 11.04

You can download the source code and follow the instructions to compile it. It may sound scary, but it's actually quite easy (basically you need to install a few packages, uncompress the source tar file, and type 'make'). The readme file contains the details.

2012-05-03 10:12:10 +0200 commented answer Is it possible to download the ovi file in smaller parts?

There are torrent clients that you don't need to install. For example, at www.bitlet.org you have a torrent downloader in a java applet run in the browser.

2012-03-03 10:53:11 +0200 received badge  Good Answer (source)
2012-02-08 15:59:13 +0200 received badge  Popular Question (source)
2012-01-28 05:05:22 +0200 commented question Octave graphs and sounds in the notebook

They are all kind of the same question. The situation is this: i administer a sage server for educational purposes. One of the teachers wants to use Octave. In particular, he wants to do image and sound manipulations. I want to know if there is a way to do it in the server.

2012-01-23 11:49:11 +0200 asked a question Octave graphs and sounds in the notebook

Is there a way to see the graphs when running octave from the sage notebook? And play the sounds?

When running sage locally things work reasonably, but how can they work when running sage in a remote server?

2012-01-05 09:42:07 +0200 received badge  Nice Answer (source)
2011-12-22 10:22:22 +0200 commented answer How do I understand the result of symbolic integrals

Is there any work on rewriting the whole integration functions in sage?

2011-12-10 20:31:35 +0200 commented answer determine consistency of nonlinear system of equations

Just a comment for completeness: the groebner basis aproach is the right way to go... if we care about solutions in a field that is algebraically closed. If we are trying to discuss if a system of equations has real solutions, its a much harder problem.

2011-12-09 10:07:27 +0200 asked a question modifying an active notebook

Using the sagenb.notebook.nbotebook.Notebook class one can edit different properties of a given notebook. The changes are suposed to be saved using the .save() procedure. But if the notebook is active, this procedire doesn't work.

Is there a way to do modifications to an actove notebook without stopping it?

2011-11-09 06:13:53 +0200 received badge  Citizen Patrol (source)
2011-11-09 06:13:41 +0200 received badge  Critic (source)
2011-11-03 10:26:31 +0200 commented answer Idea behind not evaluating symbolic equations

maybe adding a "is_true" procedure or similar for this kind of objects would be a good idea?

2011-09-30 11:07:19 +0200 answered a question reducing ideal wrt another ideal

You can do the following:

R.ideal([f.reduce(J.groebner_basis()) for f in I.gens()])

That is basically what singular does: reduce the generators of I w.r.t. J.