# Fast sympy vectorization on julia Arrays

**URL:** https://discourse.julialang.org/t/fast-sympy-vectorization-on-julia-arrays/49318
**Category:** General Usage
**Tags:** function, symbolic
**Created:** [October 30, 2020, 5:05pm UTC](https://discourse.julialang.org/t/fast-sympy-vectorization-on-julia-arrays/49318 "2020-10-30T17:05:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![CorbinFoucart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/corbinfoucart/32/14729_2.png) [@CorbinFoucart](https://discourse.julialang.org/u/CorbinFoucart)
#### Post date: [October 30, 2020, 5:05pm UTC](https://discourse.julialang.org/t/fast-sympy-vectorization-on-julia-arrays/49318/1 "2020-10-30T17:05:31Z")

</div>

I have a python library I’ve built on `sympy` and specifically `sympy.vector` which does vector calculus computations (divergence, gradient, curl, laplacians, etc) for calculations related to PDEs. Sympy provides methods that build vectorized functions that can evaluate symbolic expressions on `np.ndarray` objects (for example, evaluating the exact divergence over a 3d array with shape (domain, node, coordinate)).

I see that `Sympy.jl` allows interaction with Sympy through julia, but is there an analogy to `sympy.vectorize` which would allow me to evaluate symbolic expressions on Julia arrays?

---

<div class="post-metadata">

### Author: ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)
#### Post date: [October 30, 2020, 6:52pm UTC](https://discourse.julialang.org/t/fast-sympy-vectorization-on-julia-arrays/49318/2 "2020-10-30T18:52:10Z")

</div>

The setup in SymPy uses:

```julia
pytype_mapping(sympy_matrices.Matrix, Array{Sym})

```

which instructs PyCall to convert (mutable) matrices into arrays of symbolic variables. However, immutable matrices are not converted this way and remain as refrences to the underlying sympy object. So possibly two things to try: use `ImmutableMatrix` or add ` `pytype\_mapping`directive for`ndarray`
