ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 29 Jun 2019 23:08:29 -0500Spanish numbers using LaTeXhttp://ask.sagemath.org/question/47018/spanish-numbers-using-latex/Dear SageMath community,
I am currently writing a LaTeX document in Spanish that relies heavily on sageTeX for computations. The rules for writing numbers in Spanish are a little different from English ones. For example, we are prohibited from using commas to separate every 1000 factor, instead using a small space, only if the number is longer than four digits; otherwise, no sign should be used. On the other hand, the decimal point is actually a decimal comma. For example,
- 1,000,000.25 should be written as 1 000 000,25
- 123,456,789.123456789 should be written as 123 456 789,123 456 789
- 4,000 should be written as 4000
Using sageTeX, SageMath's `latex` command, and LaTeX babel package, it is easy to replace the decimal point with a decimal comma. It is also easy to eliminate the commas for every 1000 factor. However, I haven't been able to put a small space instead.
I could use the `siunitx` LaTeX package, which has a command, `\num`, that does exactly this processing. However, it doesn't work with sageTeX's `\sage` command or any of it's environments. The only solution I can find is to apply the `\num` command directly to every number generated by SageMath via the `latex` command.
My problem is: I don't know how to do this, specially in cases where numbers are entries of a matrix, or the coefficients of a polynomial. So, **how could I apply the `\num` command to every number independently using the `latex` command?**
Thanks in advance for your answers! Any alternative approach is also welcomed.dsejasSat, 29 Jun 2019 23:08:29 -0500http://ask.sagemath.org/question/47018/Is it possible to change Polynomial Ring in the middle of a computation?http://ask.sagemath.org/question/42341/is-it-possible-to-change-polynomial-ring-in-the-middle-of-a-computation/ Hi, I'm trying to invert the "Pollaczek-Khinchine" Laplace transform when it is rational
This works for me at degree 2:
var('x,s')
Fx = (1/6*exp(-2*x)+5/6*exp(-6*x));rho=2/3
print('Hyperexponential claims:',Fx)
R.<s> = PolynomialRing(QQbar)#when all coefficients are not integer, use CC
FF = R.fraction_field()
L_F=laplace(Fx,x,s)#Laplace transform of F
#Compute Pollackek-Khinchine (PK) formula L_rui for the Laplace transform (LT) of ruin probability
m1=L_F(s=0)
fe=L_F/m1
Fe=(1-fe)/s
L_rui=rho*Fe/(1-rho*fe)
show(L_rui.simplify_full())
inverse_laplace(SR(L_rui),s,u)
but not at degree 3, since I do not know how to use partial_fraction_decomposition, and then to switch to RR numbers and then invert .
If I start in R.<s> = PolynomialRing(RR), for an already known LT, everything is fine. But, a certain simplification by s in PK formula will become impossible due to rounding errors, so I am forced to start with R.<s> = PolynomialRing(QQbar)
After obtaining the partial_fraction_decomposition, I must apply RR to all numbers , but I do not manage to do it. Without that conversion, inverse_laplace won't workflorinMon, 14 May 2018 12:03:38 -0500http://ask.sagemath.org/question/42341/Memory error mixing exact numbers and decimal oneshttp://ask.sagemath.org/question/36618/memory-error-mixing-exact-numbers-and-decimal-ones/ Hi,
I wonder why this code gives an error in Sage 7.5.1:
f(x)=3*sin(2*pi*(1.75-2*x))
if abs(f(0.7)) < 1e-12:
print 1
MemoryError: Not enough memory to calculate cyclotomic polynomial of 428914250225777franpenaTue, 14 Feb 2017 11:42:39 -0600http://ask.sagemath.org/question/36618/numpy.int64 vs. sage.rings.integer.Integerhttp://ask.sagemath.org/question/23366/numpyint64-vs-sageringsintegerinteger/ Hi experts!
I have a list (A) with many list generated by NetworkX. Each list have numpy.int64 numbers A=[A1,....,An], where Aj are lists of numpy.int64 integers numbers.
I want to compare this numpy.int64 numbers with sage.rings.integer.Integer numbers.
How can I do this?
Thanks a lot!mresimulatorThu, 10 Jul 2014 21:32:49 -0500http://ask.sagemath.org/question/23366/Digit Groupinghttp://ask.sagemath.org/question/10986/digit-grouping/Hello,
New to Sage--thanks to the developers--and am using it to analysis some large numbers.
Is there any way to have the resultant numbers be grouped for easy reading? Like 1,000,000 instead of 1000000?
Thank you.KChrisCMon, 03 Feb 2014 13:23:41 -0600http://ask.sagemath.org/question/10986/Artin decomposition for p-adic numbershttp://ask.sagemath.org/question/10663/artin-decomposition-for-p-adic-numbers/How can I decompose a p-adic number
... d_2 d_1 d_0. d_{-1} ... d_{-k}
into its integer part
d_2 d_1 d_0.
and fractional part
. d_{-1} ... d_{-k} ?
The does not seem to exist a kind of floor function.
Klaus ScheicherSat, 26 Oct 2013 21:06:49 -0500http://ask.sagemath.org/question/10663/Polynomial division mod nhttp://ask.sagemath.org/question/10175/polynomial-division-mod-n/Hi everyone,
Let's suppose that we are working with polynomials modulo n a composite number, for which we know the factorization (n=p*q).
If we know that f(x) can be divided by e.g. g(x), what is the most efficient way to calculate f(x)/g(x) in Z_n with Sage?
Thanks for your timecp_sageSun, 02 Jun 2013 14:37:25 -0500http://ask.sagemath.org/question/10175/