Ask Your Question
2

Nice naming of variables with subscript or superscript, avoiding variable names like phi_jm1_np1 ($\phi_{j-1}^{n+1}$)

asked 2013-04-06 10:46:25 +0100

boyfarrell gravatar image

updated 2013-04-06 10:47:13 +0100

In my worksheets I have many variables with subscripted/superscripted names like phi_jm1_np1, where the mathematical notation is simple, $\phi_{j-1}^{n+1}$. Is there a compact notation, or simply a better way, of dealing with subscripts and superscripts using sage?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-04-15 07:40:27 +0100

slelievre gravatar image

You might want to combine your variables into a tuple of tuples, or into a dictionary, and write

phi[j-1][n+1]

or

phi[j-1,n+1]
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

1 follower

Stats

Asked: 2013-04-06 10:46:25 +0100

Seen: 3,324 times

Last updated: Apr 15 '13