Generic functions with irrationals that work with Symbolics / ModelingToolkit

The oftype code above works for me, but wouldn’t work for most cases, so I’m not sure what the PR should be. A slightly more general/useful version might be

Base.convert(::Type{Num}, y::Irrational) = Symbolics.Term(identity, y)

But I think that’s still not what most people would want. From the discussion here (and maybe here), it looks like people want to be able to do something like Num(π) and get the sensible thing, but surely it would be too much to do Num(y::Irrational) = Term(identity, y), since that wouldn’t actually result in a Num, right?

I’m happy to do a PR if it helps move in a positive direction, but I feel like this problem calls for more thought and more knowledge of the inner workings than I have.

[But if Term(identity, y) is actually used, it might be worth adding a special case to show_term to just show the argument if the operation is identity, because \mathrm{identity}(\pi) is pretty ugly and could be confusing.]