Ask Your Question

Peter Luschny's profile - activity

2020-11-08 21:12:52 -0600 received badge  Popular Question (source)
2020-10-30 10:03:25 -0600 received badge  Notable Question (source)
2020-10-01 11:04:02 -0600 received badge  Popular Question (source)
2020-05-07 09:11:38 -0600 received badge  Nice Question (source)
2020-05-06 08:23:44 -0600 asked a question How to compute the alternating Hurwitz zeta function?

Hi all!

What is the best way to compute the alternating Hurwitz zeta function with Sage?

Sage has an implementation of the Hurwitz zeta function, hurwitz_zeta(s,x), where s and x are complex, but not for the alternating Hurwitz zeta function.

There is the formula https://dlmf.nist.gov/25.11#E35 albeit with significant restrictions on the domain of s and x.

Which is a reliable way to implement hurwitz_alt_zeta(s,x) for general complex s and x, based on Sage functions?

2020-04-07 10:19:05 -0600 received badge  Popular Question (source)
2020-02-23 21:48:20 -0600 received badge  Notable Question (source)
2019-10-27 21:59:42 -0600 received badge  Self-Learner (source)
2019-10-20 17:07:22 -0600 answered a question Hypergeometric Bug?

The reason given in the documentation cited in the comment above is debatable. Read this section in DLMF https://dlmf.nist.gov/15.2#ii which deals with a similar case and says: "Because of the analytic properties [...] it is usually legitimate to take limits in formulas involving functions that are undefined for certain values of the parameters."

For instance Maple gives the same values as Maxima.

2019-10-20 13:11:38 -0600 answered a question How do I write and implement a program in Sage for Windows?

Perhaps it is this what you want: After the installation of SageMath you will see a button "SageMath Notebook" on your desktop. Click, your default browser opens what is "Jupyter's home", click the button "New", choose SageMath, a new notebook opens and than you can write and save your programs without using the Console.

This will look similar to https://github.com/davidlowryduda/not...

2019-10-20 06:50:10 -0600 answered a question An analog to Pari's serlaplace

Here a potential solution:

def as_ogf(f, prec):
    S.<z> = PowerSeriesRing(ZZ)
    pari.set_series_precision(prec)
    C = pari("serlaplace(" + str(f(x)) + ")")
    return S(C)

f(x) = ((3*x + 8)*sinh(2*x) + (2*x^2 + 16*(x + 1))*cosh(2*x))/16    
as_ogf(f, 4) returns 1 + 2*z + 5*z^2 + 16*z^3 + 28*z^4 and is of the required type.

It seems to me it would be worthwhile to include such a function in Sage.

EDIT: After an edit this now works also with

f(x) = (3*x + 8)*sinh(2*x)/4; as_ogf(f, 4)

and returns 4z + 3z^2 + 16z^3 + 24z^4 + O(z^5), as desired.

2019-10-20 04:21:38 -0600 asked a question An analog to Pari's serlaplace

With PARI I can do this:

f(x) = ((3*x + 8)*sinh(2*x) + (2*x^2 + 16*(x + 1))*cosh(2*x))/16;
serlaplace(f('x + O('x^5)))

PARI returns 1 + 2x + 5x^2 + 16x^3 + 28x^4 + O(x^5).

How to achieve this with Sage? Note that I want the returned value to live in the 'Power Series Ring' over the 'Integer Ring'.

def serlaplace(f, prec):
    t = taylor(f, x, 0, prec)
    C = [c[0] for c in t.coefficients()]
    R.<u> = PowerSeriesRing(QQ)
    S.<z> = PowerSeriesRing(ZZ)
    return S(R(C).egf_to_ogf())

f(x) = ((3*x + 8)*sinh(2*x) + (2*x^2 + 16*(x + 1))*cosh(2*x))/16    
serlaplace(f, 4) returns 1 + 2*z + 5*z^2 + 16*z^3 + 28*z^4.

The question is: Is there a more direct, more efficient way to achieve this?

2019-10-10 04:44:46 -0600 received badge  Popular Question (source)
2019-09-05 10:30:42 -0600 received badge  Famous Question (source)
2019-04-30 11:43:49 -0600 received badge  Popular Question (source)
2019-03-12 14:01:32 -0600 received badge  Notable Question (source)
2019-01-19 14:41:33 -0600 received badge  Famous Question (source)
2018-10-26 06:02:06 -0600 received badge  Nice Question (source)
2018-10-22 18:46:40 -0600 received badge  Famous Question (source)
2018-10-04 13:53:06 -0600 received badge  Famous Question (source)
2018-04-19 05:49:03 -0600 received badge  Popular Question (source)
2017-10-31 11:46:59 -0600 received badge  Famous Question (source)
2017-10-27 19:37:50 -0600 received badge  Notable Question (source)
2017-10-27 19:37:50 -0600 received badge  Popular Question (source)
2017-10-13 09:34:04 -0600 received badge  Notable Question (source)
2017-08-15 16:39:21 -0600 received badge  Popular Question (source)
2017-08-11 12:56:28 -0600 asked a question Behavior of symbolic_sum changed?

Consider

from sage.calculus.calculus import symbolic_sum
n = var('n')
print 1/(1 + symbolic_sum(factorial(n) * x^n, n, 1, oo))

Answer of Sage 7.4:

1/(x*hypergeometric((1, 2), (), x) + 1)

Answer of Sage 8.0:

ValueError: Computation failed since Maxima requested 
additional constraints; ....
2017-08-06 04:22:02 -0600 received badge  Popular Question (source)
2017-07-29 13:43:13 -0600 received badge  Notable Question (source)
2017-05-09 07:38:11 -0600 received badge  Notable Question (source)
2017-05-09 07:38:11 -0600 received badge  Popular Question (source)
2017-04-27 08:18:10 -0600 received badge  Good Question (source)
2017-04-26 15:07:14 -0600 marked best answer How to compute Riordan arrays?

Riordan arrays are an important tool in the study of sequences. See the examples on the OEIS Wiki. With Maple the computation of Riordan arrays is straightforward, here an example of an exponential Riordan array:

Riordan := (d,h,n,k) -> coeftayl(d*h^k,x=0,n)*n!/k!:
A131222 := (n,k) -> Riordan(1,log((1-x)/(1-2*x)),n,k):
seq(print(seq(A131222(n,k),k=0..n)),n=0..5);

1
0,   1
0,   3,   1
0,  14,   9,   1
0,  90,  83,  18,  1
0, 744, 870, 275, 30, 1

It is not clear to me how Riordan arrays are computed efficiently with Sage. Any hints are appreciated.

2017-04-26 15:07:14 -0600 received badge  Good Answer (source)
2017-04-10 21:39:51 -0600 received badge  Popular Question (source)
2017-04-09 11:25:53 -0600 received badge  Famous Question (source)
2017-03-24 20:13:47 -0600 received badge  Popular Question (source)
2017-03-17 18:47:39 -0600 received badge  Famous Question (source)
2017-03-06 21:46:47 -0600 received badge  Popular Question (source)
2017-03-06 21:46:47 -0600 received badge  Notable Question (source)