# Defining own math rules

**URL:** <https://discourse.julialang.org/t/defining-own-math-rules/29010>\
**Category:** New to Julia\
**Created:** [September 20, 2019, 5:28pm UTC](https://discourse.julialang.org/t/defining-own-math-rules/29010 "2019-09-20T17:28:18Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [September 20, 2019, 7:28pm UTC](https://discourse.julialang.org/t/defining-own-math-rules/29010/5 "2019-09-20T19:28:32Z")

</div>

However, I have found that to get the behavior you want using my original `Leibniz` based script,

> [@Is it possible to multiply with a derivative operator?](https://discourse.julialang.org/t/is-it-possible-to-multiply-with-a-derivative-operator/28914/10):
>
> Alright, well currently you can use my prototype implementation from [Leibniz.jl](https://github.com/chakravala/Leibniz.jl) (which will not be needed in the future as the feature will be built into Grassmann.jl itself) using Leibniz, DirectSum, SymEngine import Leibniz: Monomial printindices(V,D) = (io=IOBuffer();DirectSum.printindices(io,V,D,true);String(take!(io))) Base.:\*(d::Monomial{V,G,D,0} where G,r::Basic) where {V,D} = diff(r,symbols(Symbol(printindices(V,D)))) Base.:\*(d::Monomial{V,1,D,1},r::Basic) where {V,D} = diff(r,symbols(S…

All you need to do is additionally define the operation

```Julia
Base.:*(r::Basic,d::Monomial{V,G,D,O}) where {V,G,D,O} = Monomial{V,G,D,O,Basic}(r)

```

then you will have the non-commutative property you desired… however, as I mentioned in my previous post this is not how things will work when I design the packages because I use differential forms… also I’m not sure if all of the other dispatch will work correctly with this, as I haven’t spent time testing it further. The implementation I build on further will be based on differential forms as I said in my previous post.

---

_[View the full topic](https://discourse.julialang.org/t/defining-own-math-rules/29010)._
