Ask Your Question

Marco Caliari's profile - activity

2018-03-17 12:03:53 +0100 received badge  Nice Question (source)
2018-03-16 15:34:27 +0100 received badge  Organizer (source)
2018-03-16 13:39:00 +0100 asked a question Assumptions on symbolic functions

I have a symbolic function f = function('f')(x). Is there a way to assume it is real and get abs(exp(I*f)) = 1?

2018-02-08 13:42:16 +0100 commented answer Sage 8.1 eats memory until system freeze

Thanks for the code optimization. But the problem remains: a working code in 7.5.1 makes 8.1 to use more and more memory. I think this is a regression. Shall I open a bug report?

2018-02-07 11:16:09 +0100 asked a question Sage 8.1 eats memory until system freeze

Hi, I have a quite long code (which uses arbitrary precision real numbers) which runs perfectly on Sage 7.5.1 (ppa for Mint 17.3 - Ubuntu 14.04). On Sage 8.1 (sage-8.1-Ubuntu_14.04-x86_64.tar.bz2) it starts to eat the memory until it freezes the system. I would like to help in debugging. Is there something that I can try/run/test? I can also upload the code, if necessary.

Finally, I have a minimal working code

def test(m,c,precision):
    M = 3*m
    RRR = RealField(prec = precision)
    coef02 = [RRR(1/i) for i in [1..M+1]]
    g = coef02[M]
    for i in [M-1..2,step=-1]: # Horner
        g = x*g+coef02[i]
    ME = 32
    disk = [exp (2*pi.n(precision)*I*i/ME) for i in range(ME)]
    gamma = abs(c)/2
    ellipse = [(gamma*(w+c^2/(4*gamma^2)/w)) for w in disk]
    epsilon1 = max([abs(g(x=z)) for z in ellipse])
    return
m = 40
for c in [1/2..10,step=1/2]:
    for ell in [1..10]:
        test(m,c,165)

If I run this in 7.5.1, I see (in top) the memory percentage stable around 2.5. If I run in 8.1, it grows up to 7.3 before code termination. If I increase the length of the loops, memory usage continues to grow.

2017-08-29 13:40:52 +0100 commented answer Pade approximation

Hi, is it possible to go back to a power series? If I give

sage: f.taylor(x,0,12).power_series(QQ).pade(3,3).taylor(x,0,12)

I get the error: AttributeError: 'FractionFieldElement_1poly_field' object has no attribute 'taylor'

2017-04-20 00:29:47 +0100 received badge  Popular Question (source)
2017-04-20 00:29:47 +0100 received badge  Notable Question (source)
2016-08-02 04:16:50 +0100 received badge  Nice Question (source)
2016-07-29 15:03:41 +0100 received badge  Self-Learner (source)
2016-07-29 15:03:41 +0100 received badge  Teacher (source)
2016-07-29 14:09:33 +0100 asked a question Pass arguments to an octave call

Hi, given, say, a = [1,2,3,4], is it possible to pass this vector to an octave call, like octave('a+1')? Of course, this last does not work.

2016-07-29 14:04:51 +0100 answered a question More digits from octave

Hi, I found myself a solution, for instance:

a=Matrix(RR,octave('sprintf("%.16e ",rand(1,4))'))
2016-07-22 14:56:39 +0100 commented answer More digits from octave

Sorry, try this instead a=octave('0.123456789'). I chose pi just to be short. I get a=0.123457, lost two digits.

2016-07-22 12:39:08 +0100 asked a question More digits from octave

Hi, how can I get all the 15/16 digits from a command like pi=octave('pi')?

2016-07-22 12:37:53 +0100 asked a question More digits from octave

Hi, how can I get all the 15/16 digits from a command like pi = octave('pi')?

2014-07-14 10:34:12 +0100 commented answer taylor expansion with arbritary precision numbers

Thanks, it works, And in order to get the coefficients? f.series(x,5).coefficients() seems to me in double precision.

2014-07-11 08:58:26 +0100 asked a question taylor expansion with arbritary precision numbers

Hi,

if I define a function with arbritary precision numbers (e.g., f=0.123456789123456789*log(1+x)) and then compute its Taylor expansion (f.taylor(x,0,5)) it seems to me that the coefficients are given in double precision, whereas if I compute them (e.g., by derivative(f,x,5)(x=0)/factorial(5)) they are in original precision. First of all, am I right or is it only a visualisation difference? If I'm right, is it possible to compute the Taylor expansion with the original precision?

Cheers,

Marco

2013-11-07 08:03:25 +0100 received badge  Supporter (source)
2013-11-07 03:50:53 +0100 commented answer Continued fraction of pi by hand

Thank you for the explanation. I see that this question was tagged "confirmed_bug". Is there a place where I can follow what happens to this bug? Any maintainer working on it?

2013-11-06 07:38:43 +0100 answered a question Continued fraction of pi by hand

Thanks for the quick answer. I extended the precision


R=RealIntervalField(100)
n=28
x=range(n+1);a=range(n)
x[0]=R(pi).upper()
for i in range(n):
    a[i] = int(x[i])
    x[i+1]=1/(x[i]-a[i])
    print(a[i])

but now a[28] is wrong (compared to continued_fraction). So 100 bits is not enough. How I discover it?

2013-11-06 06:54:16 +0100 received badge  Student (source)
2013-11-06 04:58:11 +0100 received badge  Editor (source)
2013-11-06 04:41:54 +0100 asked a question Continued fraction of pi by hand

Hello, I'm a newbie in Sage. I tried to compute (sagenb.org) the continued fraction of pi by hand with the following commands

n=15
x=range(n+1);a=range(n)
x[0]=pi
for i in range(n):
    a[i] = int(x[i])
    x[i+1]=1/(x[i]-a[i])
    print(a[i])

the answer (14 terms) is correct, but then I get

Traceback (click to the left of this block for traceback)
...
ValueError: Calling floor() on infinity or NaN

Am I doing something wrong?

Cheers