Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
1

Tuples or for loops

asked 11 years ago

Blackadder gravatar image

updated 10 years ago

FrédéricC gravatar image

Hi everybody, I would like to compute the L-function of an elliptic curve of the form y2=x3d2x for multiple values of d at s=1. I was hoping to use an n-tuple

d=(1,3,5,7,...,n)

with the hope that I could then do

E=EllipticCurve([0,0,0,-(d^2),0])
L = E.lseries().dokchitser()
L(1)

such that at every stage the data would be in a vector/n-tuple form, but this is not possible. Does anyone know how I can make this method work? With a for-loop perhaps? Thanks in advance for your help!

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 11 years ago

Volker Braun gravatar image

List comprehensions are usually clearer than map/lambda where applicable:

[EllipticCurve([0,0,0,-d^2,0]).lseries().dokchitser()(1) for d in range(1, n+1, 2)]
Preview: (hide)
link

Comments

This is exactly what I was looking for thank you so much Volker!!

Blackadder gravatar imageBlackadder ( 11 years ago )
1

answered 11 years ago

ppurka gravatar image

updated 11 years ago

Use the map and lambda operators.

dlist = range(1, n+1, 2)
map(lambda d: EllipticCurve([0,0,0,-(d^2),0]).lseries().dokchitser()(1), dlist)

If it gets too complicated, then use a python function instead of the lambda so that the code retains readability.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 967 times

Last updated: Aug 06 '13