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

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

4 Likes

Thanks.

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?

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.

2 Likes

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

1 Like

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.

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

7 Likes

That’s great! Thanks.

1 Like