On 20/10/2021 12:36, Oscar Benjamin wrote:
On Tue, 19 Oct 2021 at 20:55, David Bailey<d...@dbailey.co.uk>  wrote:
Dear group,

First I would like to say how good it was to discover that the online
SymPy documentation now supports copy/paste operations without
constantly switching to SymPyLive. I think this will make the
documentation considerably more user friendly.
I'm not sure what has changed there...

Thanks for replying Oscar. You are right! When I went to the SymPy documentation to prepare the second part of this email I found it behaved in the same old way - maybe the live shell was down last night. The problem is that if you click into a block of SymPy code with the intention of cutting and pasting its contents, it fires up the live shell when you don't want it - at least using Firefox on Windows 10. To cut and paste you have to use a trick - clicking outside the block with the green background and dragging into the block from there. Since there is a dark green tag above each section to invoke the live shell, all that is needed is to disable special trapping the left mouse click.

My question is what construct should I use to get variables with
subscripts, and maybe superscripts. I thought at first that indexed
objects were the way to go, but they seem rather obscure. E.g. think of
indexing through the Bessel functions - J0, J1,J2 etc.

Ideally I'd like to loop over the index/indices and also see the
subscripts positioned below the main symbol when using Latex output
I'm not completely sure what you want here but is this it:

In [19]: symbols('x:10')
Out[19]: (x₀, x₁, x₂, x₃, x₄, x₅, x₆, x₇, x₈, x₉)

IndexedBase is for the situation where you want the index to be symbolic e.g.:

In [27]: xi = IndexedBase('x')

In [28]: n, m = symbols('n, m')

In [29]: Sum(xi[n], (n, 1, m))

It was the second facility that I was looking for. What fooled me was that in the documentation:

https://docs.sympy.org/latest/modules/tensor/indexed.html

The index variables are created specially:

i, j = symbols('i j', cls=Idx) However it would seem you can index with any integer variable. What does the Idx class contribute? David



--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/d7dfab2d-9789-c46f-8b72-94d2722ca635%40dbailey.co.uk.

Reply via email to