Ask Your Question

rws's profile - activity

2021-01-27 10:55:48 -0600 received badge  Necromancer (source)
2021-01-03 14:22:37 -0600 received badge  Notable Question (source)
2020-04-16 09:57:31 -0600 received badge  Nice Answer (source)
2019-12-11 14:36:16 -0600 received badge  Famous Question (source)
2019-05-09 03:08:21 -0600 received badge  Nice Question (source)
2018-12-24 08:32:46 -0600 received badge  Notable Question (source)
2018-12-03 10:47:34 -0600 received badge  Good Answer (source)
2018-03-26 03:23:31 -0600 received badge  Notable Question (source)
2017-10-19 12:26:12 -0600 received badge  Popular Question (source)
2017-08-24 10:56:46 -0600 received badge  Nice Answer (source)
2017-08-24 01:34:04 -0600 answered a question collect variables buried in an expression

It sometimes helps to expand and factor:

sage: s
1/4*(2*D*Nb*Pmean - (D*H*alpha + D*H)*c)/((alpha + 1)*c)
sage: s.expand()
-1/4*D*H*alpha/(alpha + 1) - 1/4*D*H/(alpha + 1) + 1/2*D*Nb*Pmean/((alpha + 1)*c)
sage: _.factor()
-1/4*(H*alpha*c - 2*Nb*Pmean + H*c)*D/((alpha + 1)*c)
sage: _.partial_fraction()
1/4*(2*Nb*Pmean - (H*alpha + H)*c)*D/((alpha + 1)*c)
2017-08-24 01:21:27 -0600 commented answer Sage not returning roots of polynomimal

sage: print([SQ[i*2][0].minpoly().degree() for i in range(16)]) [32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32]

2017-08-23 08:50:31 -0600 received badge  Popular Question (source)
2017-06-11 03:04:59 -0600 received badge  Popular Question (source)
2017-04-29 17:52:00 -0600 received badge  Nice Answer (source)
2017-02-11 06:52:42 -0600 received badge  Nice Answer (source)
2016-11-08 10:43:16 -0600 commented question What is the problem with that integral ?

Simplification: sin(atan(y)) = y/sqrt(1+y^2) could be applied.

2016-11-04 17:32:57 -0600 received badge  Nice Answer (source)
2016-11-04 09:43:20 -0600 answered a question Use cumulative distribution functions

Using the actual function I get a fine plot via:

sage: CDFlogn(x,nu,sigma) = 1/2*(1+erf((log(x)-nu)/(sigma*sqrt(2))))
sage: plot(CDFlogn(x,1.5,.6),0,10)
Launched png viewer for Graphics object consisting of 1 graphics primitive

sage: CDFlogn(x,1.5,.6)
1/2*erf(-0.833333333333333*sqrt(2)*(-log(x) + 1.50000000000000)) + 1/2
sage: CDFlogn(4,1.5,.6)
1/2*erf(-0.833333333333333*sqrt(2)*(-log(4) + 1.50000000000000)) + 1/2
sage: CDFlogn(4,1.5,.6).n()

For example:

2016-11-04 09:23:56 -0600 commented answer Use cumulative distribution functions

Then at the moment you need to create your function in mathematical terms. Please see and rate my answer.

2016-04-03 00:19:24 -0600 commented question Memory saturation when I test equalities in symbolic ring.

Or before. I also cannot confirm with 7.2.beta2

2016-03-08 14:04:58 -0600 received badge  Nice Answer (source)
2016-01-27 08:13:42 -0600 received badge  Necromancer (source)
2015-10-24 09:24:08 -0600 commented answer qepcad failing to replicate examples

qepcad did install here on 6.10.p1 after I set my MAKE to make -j1.

2015-10-19 01:38:53 -0600 answered a question does SAGE compute Pi using Chudnovsky algorithm?

Sage uses the mpfr library to compute pi to arbitrary precision. The mpfr algorithm apparently has a limit of 646456992 digits. Please refer to

Not sure if that is up-to-date, however.

2015-10-15 01:35:31 -0600 answered a question sage doesn't evaluate

Use simplify_full:

sage: f(x) = sum(k,k,0,x)
sage: f
x |--> 1/2*x^2 + 1/2*x
sage: f(x) = sum(binomial(10,k),k, 0,x)
sage: f
x |--> sum(binomial(10, k), k, 0, x)
sage: f(2)
sum(binomial(10, k), k, 0, 2)
sage: f(2).simplify_full()
2015-10-14 08:52:53 -0600 commented answer Plot doesn't seem to evaluate my function

That's a bug that already has a fix which just needs to be reviewed:

2015-10-04 08:00:02 -0600 answered a question simplify_rational gives different results

Your proj is ab.dot_product(n)/n.norm()^2*n so your tt*n.norm() is ab.dot_product(n)/n.norm()^2 * n.norm() which is different from proj.norm() because the norm() in tt*n.norm() only applies to n. You made the same mistake when you equaled (tt*n.norm()).simplify_rational() and tt*n.norm().simplify_rational(). Here in the latter the simplify_rational() only applies to n.norm().

Operator precedence in Sage closely follows the same in Python (but in C++ for example the dot would have behaved the same way).

2015-10-04 03:26:53 -0600 commented question Multivariate Laurent series

This is right.Multivariate Laurent series are not implemented in Sage at the moment.

2015-09-27 09:39:58 -0600 commented answer simplify sqrt(x/y^2)*y

A fix should be possible with pynac-0.4.x (pynac is part of Sage); pynac git master already does sqrt(x^2) --> x for x>0 as side effect of other changes.

2015-09-26 01:48:38 -0600 received badge  Nice Answer (source)
2015-09-25 02:16:08 -0600 commented answer Understanding the 'solve()' result with braces and brackets ("([{x:z},{x:y}],[1,1])")

The y:z can be deduced from the other two, but I have no idea how the results come up specifically.

2015-09-21 02:50:22 -0600 commented answer simplify sqrt(x/y^2)*y

Miguel, note that sqrt(x^2) != x for x<0.

2015-09-15 08:20:27 -0600 commented question High memory usage when substituting variables

Maybe is related. In any case the output of get_memory_usage() increases too.

2015-09-15 08:05:15 -0600 commented question High memory usage when substituting variables

I confirm the steady increase. This is not reduced by gc.collect(). Maybe it is a Singular issue (Singular is used by Sage in case of multivariate polynomials).

2015-09-15 07:41:34 -0600 answered a question Understanding the 'solve()' result with braces and brackets ("([{x:z},{x:y}],[1,1])")

The result consists of two lists: [{x: z}, {x: y}] and [1, 1]. Each list is a possible result that solves the equation. The first list is a Python dictionary (which by definition has no order but gives the values that specific variables will need to satisfy the equation); the second is a list (which simply gives the needed values for the variables in the order the vars were given as argument. Substitution confirms:

sage: P.subs(x==z)
0 == 0
sage: P.subs(x==y)
0 == 0
sage: P.subs(x==1,y==1)
0 == 0
2015-09-09 01:17:18 -0600 answered a question Forcing Symbolic Variables to Always be Real

First, with the newest versions of Sage the domain you create a variable with is propagated to the assumption database so you can say:

var('R r L omega k s', domain='real')

I am not sure how you get to the output you give, I got:

sage: Z(s,L) = s * L
sage: Z.diff(s)
(s, L) |--> L
sage: Z
(s, L) |--> L*s
sage: Z(R,r,L,k,omega,s) = R + I * omega * L + ((s * omega**2 * L**2 * k**2) * (r - I * omega * L)) / (r**2 + omega**2 * s **2 * L**2)
sage: Z.diff(s)
(R, r, L, k, omega, s) |--> -2*(-I*L*omega + r)*L^4*k^2*omega^4*s^2/(L^2*omega^2*s^2 + r^2)^2 + (-I*L*omega + r)*L^2*k^2*omega^2/(L^2*omega^2*s^2 + r^2)
sage: Z
(R, r, L, k, omega, s) |--> (-I*L*omega + r)*L^2*k^2*omega^2*s/(L^2*omega^2*s^2 + r^2) + I*L*omega + R

Also, you say that the derivative should be zero. But that's only the case if s is a constant, no?

2015-08-27 02:01:40 -0600 answered a question Inverses of matrices of Laurent polynomials

This is defined behaviour of the general inverse, as far as I understand from the code. For example,

 sage: parent(~1)
 Rational Field

The definition of Matrix_generic_dense.__invert__() explicitly states

Return this inverse of this matrix, as a matrix over the fraction field.

sage: R.fraction_field()
Fraction Field of Univariate Polynomial Ring in t over Integer Ring

I'm not an algebraist so no comment on that but, with symbolics you would stay in the ring, so symbolics seems to be good for something, contrary to many a belief.

sage: mat = matrix([[x^2]])
sage: mati = mat.inverse(); mati
sage: mati[0,0].parent()
Symbolic Ring
2015-08-21 08:41:52 -0600 received badge  Nice Answer (source)