Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Define a as a *function* ofi`. Possible use :

a = function("a")
d = var("d")
j, k = var("j, k", domain="integer")
S = sum(a(j)*d, j, 1, k+1)

HTH,

Define a as a as function of a *function* ofii`. . Possible use :

a = function("a")
d = var("d")
# I don't like to scratch Sage's predefined identifiers...
j, k = var("j, k", domain="integer")
S = sum(a(j)*d, j, 1, k+1)

HTH,

Define a as a function of i. Possible use :

a = function("a")
d = var("d")
# I don't like to scratch Sage's predefined identifiers...
j, k = var("j, k", domain="integer")
S = sum(a(j)*d, j, 1, k+1)

EDIT : If you want to fiddle with output cosmetics, you might try :

a = function("a", nargs=1,
                   print_func=lambda self, *args: r"%s[%s]"%(self, args[0]),
                   print_latex_func=lambda self, *args: r"%s_{%s}"%(self, args[0]))
d = SR.var("d")
j, k = SR.var("j, k", domain="integer")

which allows for :

sage: sum(a(j)d(), j, 0, k + 1) dsum(a[j], j, 0, k + 1)

and latex(sum(a(j)*d(), j, 0, k + 1)) gets interpreted as expected (but ask.sagemath.org's Mathjax is currently unable to display it...).

HTH,

Define a as a function of i. Possible use :

a = function("a")
d = var("d")
# I don't like to scratch Sage's predefined identifiers...
j, k = var("j, k", domain="integer")
S = sum(a(j)*d, j, 1, k+1)

EDIT : If you want to fiddle with output cosmetics, you might try :

a = function("a", nargs=1,
                   print_func=lambda self, *args: r"%s[%s]"%(self, args[0]),
                   print_latex_func=lambda self, *args: r"%s_{%s}"%(self, args[0]))
d = SR.var("d")
j, k = SR.var("j, k", domain="integer")

which allows for :

sage: sum(a(j)d(), sum(a(j)*d(), j, 0, k + 1)
dsum(a[j], d*sum(a[j], j, 0, k + 1)

1)

and latex(sum(a(j)*d(), j, 0, k + 1)) gets interpreted as expected (but ask.sagemath.org's Mathjax is currently unable to display it...).

HTH,

Define a as a function of i. Possible use :

a = function("a")
d = var("d")
# I don't like to scratch Sage's predefined identifiers...
j, k = var("j, k", domain="integer")
S = sum(a(j)*d, j, 1, k+1)

EDIT : If you want to fiddle with output cosmetics, you might try :

a = function("a", nargs=1,
                   print_func=lambda self, *args: r"%s[%s]"%(self, args[0]),
                   print_latex_func=lambda self, *args: r"%s_{%s}"%(self, args[0]))
d = SR.var("d")
j, k = SR.var("j, k", domain="integer")

which allows for :

sage: sum(a(j)*d(), j, 0, k + 1)
d*sum(a[j], j, 0, k + 1)

and latex(sum(a(j)*d(), j, 0, k + 1)) gets interpreted as expected (but ask.sagemath.org's Mathjax is currently unable to display it...).

$$d {\sum_{j=0}^{k + 1} a_{j}}$$

HTH,

Define a as a function of i. Possible use :

a = function("a")
d = var("d")
# I don't like to scratch Sage's predefined identifiers...
j, k = var("j, k", domain="integer")
S = sum(a(j)*d, j, 1, k+1)

EDIT : If you want to fiddle with output cosmetics, you might try :

a = function("a", nargs=1,
                   print_func=lambda self, *args: r"%s[%s]"%(self, args[0]),
                   print_latex_func=lambda self, *args: r"%s_{%s}"%(self, args[0]))
d = SR.var("d")
j, k = SR.var("j, k", domain="integer")

which allows for :

sage: sum(a(j)*d(), j, 0, k + 1)
d*sum(a[j], j, 0, k + 1)

and latex(sum(a(j)*d(), j, 0, k + 1)) gets interpreted as expected (but ask.sagemath.org's Mathjax is currently unable to display it...).:

$$d {\sum_{j=0}^{k + 1} a_{j}}$$

HTH,