If I understand correctly, in Julia m = [[1,2],[3,4]] is a two-dimensional vector with each vector of two elements. And this fact won't change after the operation of sympify
ms = sympy.sympify(m) size(ms)
The output will still be (2,), as expected.
However, if I create a file test.txt with just one line [[1,2],[3,4]] and run
using SymPy open("test.txt") do io while ! eof(io) m = readline(io) println(m) ms = sympy.sympify(m) println(ms) end end
The output will be
[[1,2],[3,4]] Sym[1 2; 3 4]
Namely, now ms suddenly changes to a two-by-two matrix! I really cannot understand this (since the dimension of m after readline stays to be (2,) as before). Could someone explain this for me?
https://stackoverflow.com/questions/66994043/strange-dimension-change-of-a-nested-array-after-readline-and-sympify-operation April 08, 2021 at 05:00AM
没有评论:
发表评论