# gundamlh's profile - activity

2019-04-18 16:08:01 -0500 marked best answer lcm and gcd of polynomials over the irrationals

Dear all,

I want to calculate the least common multiple of a list of polynomials with coefficients defined over RR or RDF in SAGE. Is it possible?

sage: R.<s> = PolynomialRing(RDF); R
Univariate Polynomial Ring in s over Real Double Field
sage: H = matrix(1,2, [(s+5)**2, s]); H
[s^2 + 10.0*s + 25.0                   s]
sage: lcm(H[0,0], H[0,1])
TypeError: Singular error:
? not implemented
? error occurred in or before poly.lib::lcm line 852:            q=gcd(p,i[k]);
? leaving poly.lib::lcm
skipping text from ; error at token )


2018-03-14 03:53:19 -0500 marked best answer Polynomial coefficient vector to symbolic polynomial

matlab: poly2sym([1 3 2])
ans =
x^2 + 3*x + 2


I couldn't find a similar function in SAGE. Fortunately this small function is quite easy, consisting of only one loop.

2016-08-28 13:30:33 -0500 marked best answer Smith-McMillan Form of a polynomial matrix
sage: s = var('s')
sage: G = matrix([[1,-1],[s^2+s-4,2*s^2-s-8],[s^2-4, 2*s^2-8]])


G is a symbolic matrix, each entry of which is a polynomial of variable s.

# How can we calculate the Smith McMillan Form of the matrix G?

NOTE: G.smith_form() doesn't work.

2015-03-26 22:12:31 -0500 marked best answer plot grids in a figure

Dear all,

I want to plot grids in my plot.

I couldn't find any keyword like 'grid' in the help document of 'plot()' <function sage.plot.plot.plot="">, and hence I tried NUMERICAL PLOTTING:

sage: from pylab import *
sage: t = arange(0.0, 2.0, 0.01)
sage: s = sin(2*pi*t)
sage: P = plot(t, s, linewidth=1.0)
sage: xl = xlabel('time (s)')
sage: yl = ylabel('voltage (mV)')
sage: t = title('About as simple as it gets, folks')
sage: grid(True)
sage: savefig(os.path.join(SAGE_TMP, 'sage.png'))
sage: P
[<matplotlib.lines.Line2D at 0x7e0a050>] # stored in RAM?


but nothing came out... OK, how can I check if SAGE can call Matplotlib in my OS (openSuSE 12.3) correctly? I have installed and updated 'matplotlib' for Python 2.7 via YaST2.

2015-03-26 22:12:31 -0500 marked best answer Optimization toolboxes under SAGE

Can we use SAGE to solve some optimization problems? Can we import optimization toolboxes such as YALMIP, MPT, CVX, TOMLAB in SAGE?

2015-03-26 22:12:30 -0500 marked best answer symbolic matrix norm

Matlab has symbolic matrix norm, does Sage also have a command to compute the norm of a symbolic matrix?

2015-03-26 22:12:30 -0500 marked best answer singular value decomposition

I want to use SVD directly in Sage, is it possible?

from http://wiki.sagemath.org/interact/lin..., I know that, we can...

sage: from scipy import linalg

sage: U,s,Vh = linalg.svd(A) # A is a fixed matrix, e.g., A = [1, 2; 3, 4]

sage: symbolic_expression(list(zero_vector(k)))
# many thanks to @tmonteil