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 03:46:25 -0500

boyfarrell gravatar image

updated 2013-04-06 03:47:13 -0500

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 00:40:27 -0500

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 03:46:25 -0500

Seen: 996 times

Last updated: Apr 15 '13