Ask Your Question
0

Running PARI/GP and Sage

asked 2011-06-30 04:35:14 +0200

anonymous user

Anonymous

Suppose I have a function a(i) in PARI/GP code. To evaluate something like a(5) in sage code I write pari('a[5]'). However, running the for loop on pari('a[i]') doesn't seem to work. Is there a work around for this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-06-30 12:15:47 +0200

Running

for i in range(n):
    pari('a[i]')

won't work since 'a[i]' is a string. Try something like this instead:

for i in range(n):
    pari('a[%d]' %(i))

This will actually substitute the values i takes on into the string expressions you want to evaluate.

edit flag offensive delete link more

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: 2011-06-30 04:35:14 +0200

Seen: 339 times

Last updated: Jun 30 '11