Closed xiang-yu closed 10 months ago
julia> @syms x, y julia> xx = zeros(2,2) julia> xx[1, 1] = x*y ERROR: PyError (ccall(#= /Users/lixi307/.julia/packages/PyCall/ygXW2/src/conversions.jl:59 =# @pysym(:PyFloat_AsDouble), Cdouble, (PyPtr,), po)) <class 'TypeError'> TypeError('Cannot convert expression to float')
If I define "xx" in type "Any" xx = Array{Any}(undef, 2,2) julia> xx[1, 1] = x*y x⋅y
However, I need a zeros instead of "undef". How to initialise a zero symbolic array using SymPy.jl?
You should use zeros(Sym,2,2):
zeros(Sym,2,2)
julia> @syms x, y (x, y) julia> xx = zeros(Sym,2,2); julia> xx[1, 1] = x*y x⋅y
Thanks. It works well.
This issue can be closed.
julia> @syms x, y julia> xx = zeros(2,2) julia> xx[1, 1] = x*y ERROR: PyError (ccall(#= /Users/lixi307/.julia/packages/PyCall/ygXW2/src/conversions.jl:59 =# @pysym(:PyFloat_AsDouble), Cdouble, (PyPtr,), po)) <class 'TypeError'> TypeError('Cannot convert expression to float')
If I define "xx" in type "Any" xx = Array{Any}(undef, 2,2) julia> xx[1, 1] = x*y x⋅y
However, I need a zeros instead of "undef". How to initialise a zero symbolic array using SymPy.jl?