# 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:** 63

<div class="post-metadata">

**Author:** ![oscarbenjamin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscarbenjamin/32/22868_2.png) [@oscarbenjamin](https://discourse.julialang.org/u/oscarbenjamin)\
**Post date:** [April 4, 2021, 10:02am UTC](https://discourse.julialang.org/t/cas-best-practices/58092/63 "2021-04-04T10:02:28Z")

</div>

Okay I see why the Nemo and Flint timings are so similar: Nemo just uses Flint for the calculation. This is what I meant by speed ultimately being determined by the lower-level libraries.

> [@jzr](#):
>
> If I understand right, @oscarbenjamin and @carette are both saying it should stay as `x - x` until explicitly evaluated with `simplify()` / `evaluate()` /etc?

Yes, that is what I would do if I was making a new CAS. Not just `x - x` and also `x/x`. Also `y + x` would not automatically canonicalise to `x + y`. Functions like `cos(0)` should stay as `cos(0)`. This is about both performance and usability. Many of the things that people want to use a CAS for are not necessarily about computing anything: they just want to be able to manipulate expressions in a controlled way.

In SymPy you can do that with `cos(0, evaluate=False)` and `Add(y, x, evaluate=False)`. Using `evaluate=False` is a kludge though that tries to repair the damage caused by automatic evaluation retrospectively. It can never fully work because evaluation needs to default to False from the foundations. Any kind of automatic evaluation once introduced is very hard to remove because future code comes to depend on it.

How in Symbolics.jl do I create the expression `cos(0)` or `sin(pi)` or even `sqrt(2)`?

---

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