# \[ANN\] SymbolicUtils.jl -- Groundwork for a symbolic ecosystem in Julia

**URL:** <https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455>\
**Category:** Package Announcements\
**Tags:** announcement\
**Created:** [April 29, 2020, 10:56pm UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455 "2020-04-29T22:56:36Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [August 13, 2020, 8:53am UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/21 "2020-08-13T08:53:01Z")

</div>

> [@fkguo](#):
>
> then `0a` gives `0 * a` , but `0b` gives the following error:

This is because `0b1011` is syntax for creating an unsigned integer from binary. You need to explicitely write `0*b` in this case.

---

<div class="post-metadata">

**Author:** ![fkguo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fkguo/32/16866_2.png) [@fkguo](https://discourse.julialang.org/u/fkguo)\
**Post date:** [August 13, 2020, 8:55am UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/22 "2020-08-13T08:55:23Z")

</div>

Thanks.

> [@fkguo](#):
>
> In version `v0.4.3` , `@syms a; 0* a` gives zero, while in the new version `v0.5.0` , it gives `0 * a` . How can I force it to be zero?

figured out this can be done using `r = @rule (0 * ~a) => 0; r(0*a)` gives zero. But would it be better to give zero automatically in this case?

---

<div class="post-metadata">

**Author:** ![shashi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shashi/32/1824_2.png) [@shashi](https://discourse.julialang.org/u/shashi)\
**Post date:** [August 13, 2020, 12:51pm UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/23 "2020-08-13T12:51:28Z")

</div>

On v0.5.0 we stopped simplifying expressions to print them.

> `@syms a; 0* a` gives zero

It wasn’t actually returning zero but printing zero rather confusingly.

You can call `simplify(0*a)` to get 0.

---

<div class="post-metadata">

**Author:** ![fkguo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fkguo/32/16866_2.png) [@fkguo](https://discourse.julialang.org/u/fkguo)\
**Post date:** [August 13, 2020, 1:30pm UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/24 "2020-08-13T13:30:57Z")

</div>

> [@shashi](#):
>
> You can call `simplify(0*a)` to get 0.

got it. many thanks. but would it be better to automatically simplify such a case?

---

<div class="post-metadata">

**Author:** ![shashi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shashi/32/1824_2.png) [@shashi](https://discourse.julialang.org/u/shashi)\
**Post date:** [August 13, 2020, 1:34pm UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/25 "2020-08-13T13:34:34Z")

</div>

You could define that yes, but it would be a kludge. We would have to define many methods and check that one of the inputs is a number and is zero.

---

<div class="post-metadata">

**Author:** ![shashi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shashi/32/1824_2.png) [@shashi](https://discourse.julialang.org/u/shashi)\
**Post date:** [February 9, 2021, 7:56am UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/26 "2021-02-09T07:56:55Z")

</div>

Now we do automatically simplify this and a number of other common cases. `simplify` itself is rarely needed now :}

---

<div class="post-metadata">

**Author:** ![fkguo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fkguo/32/16866_2.png) [@fkguo](https://discourse.julialang.org/u/fkguo)\
**Post date:** [February 9, 2021, 8:10am UTC](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455/27 "2021-02-09T08:10:10Z")

</div>

That’s great! Thanks.

[Previous page](https://discourse.julialang.org/t/ann-symbolicutils-jl-groundwork-for-a-symbolic-ecosystem-in-julia/38455.md?page=1)
