# CAS Best Practices

**URL:** <https://discourse.julialang.org/t/cas-best-practices/58092>\
**Category:** Machine Learning\
**Tags:** symbolic\
**Created:** [March 27, 2021, 8:51pm UTC](https://discourse.julialang.org/t/cas-best-practices/58092 "2021-03-27T20:51:11Z")\
**Posts on this page:** 1\
**Showing post:** 69

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 4, 2021, 10:28pm UTC](https://discourse.julialang.org/t/cas-best-practices/58092/69 "2021-04-04T22:28:25Z")

</div>

```julia
julia> using Symbolics
julia> Term(sqrt,[2])
sqrt(2)

```

I don’t get why you’d work harder than that. You can build any expression to be lazily like that, or use `@register` on others.

> [@stevengj](#):
>
> This doesn’t work if `x` is an array — `zero(x) * x` will throw if `x` is not a square matrix. In the context of rings it is fine, of course, though it still won’t be equivalent to `x-x` for square matrices that may contain non-finite values.

I thought the reason for it was because the poster wanted “a zero in the type of `x`”:

> [@carette](#):
>
> I was warning that x−xx-x is tricky. It’s actually fairly safe to transform it to 0∗x0\*x . For one, that’s type-safe, in the sense that xx is still around, so you know the result’s type properly. (Polymorphic 00 is a major pain.)

In which case trying to get `0 * x` as they posted is an X-Y problem: just writing it as `zero(x)` is more direct and means what they actually meant using Base Julia functionality.

---

_[View the full topic](https://discourse.julialang.org/t/cas-best-practices/58092)._
