# Subs for Matrices in SymEngine

**URL:** <https://discourse.julialang.org/t/subs-for-matrices-in-symengine/35566>\
**Category:** General Usage\
**Created:** [March 5, 2020, 9:29am UTC](https://discourse.julialang.org/t/subs-for-matrices-in-symengine/35566 "2020-03-05T09:29:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@rajesh](https://discourse.julialang.org/u/rajesh)\
**Post date:** [March 5, 2020, 9:29am UTC](https://discourse.julialang.org/t/subs-for-matrices-in-symengine/35566/1 "2020-03-05T09:29:04Z")

</div>

Hi,

I am using SymEngine but unable to substitute values when the symbols are in a matrix.  
My code is as follows:

a,b,c = symbols(“a b c”)  
e1 = Array{Symbol,1}  
e1 = [a^2, b^2, c^2]  
e2 = subs(e1, a=\>2, b=\>1, c=\>3)

The error I get is:

no method matching subs(::Array{Basic,1}, ::Pair{Basic,Int64}, ::Pair{Basic,Int64}, ::Pair{Basic,Int64})

Somehow the type Symbols changes to Basic and prevents substitution.  
Thanks for the help!

---

<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:** [March 5, 2020, 11:34am UTC](https://discourse.julialang.org/t/subs-for-matrices-in-symengine/35566/2 "2020-03-05T11:34:16Z")

</div>

> [@rajesh](#):
>
> a,b,c = symbols(“a b c”)  
> e1 = Array{Symbol,1}  
> e1 = [a^2, b^2, c^2]  
> e2 = subs(e1, a=\>2, b=\>1, c=\>3)

Use broadcasting: `subs.(e1, a=>2, b=>1, c=>3)`. (For older versions of Julia you might need to inhibit broadcasting through the pair. The syntax `a .=> 2` will prevent that among other options.)

---

<div class="post-metadata">

**Author:** ![rajesh](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@rajesh](https://discourse.julialang.org/u/rajesh)\
**Post date:** [March 5, 2020, 11:47am UTC](https://discourse.julialang.org/t/subs-for-matrices-in-symengine/35566/3 "2020-03-05T11:47:27Z")

</div>

Thanks a lot! Works!
