# [✓] Keep x/y (Divide[x,y]) from turning into Times[x, Power[y,-1]]?

Posted 1 year ago
1381 Views
|
4 Replies
|
4 Total Likes
|
 I would like to have a way to keep x/y in the Divide[x,y] notation, but it seems to go immediately to the standard form qTimes[x, Power[y,-1]] There does not seem to be any attribute that controls this as there is for properties such as commutative and associative, etc. Similarly, you have FullForm[2/(3x)] as Times[2, Times[Rational[1, 3], Power[x, -1]]] when I might want to distinguish between 2/(3x) and (2/3)(1/x) etc. I know this is normally a feature, not a bug, but there are times when I'd like to have more control over conversion to standard form. Is there any way to do this?? Much thanks. - Elaine
4 Replies
Sort By:
Posted 1 year ago
 It depends on what you want to do with it. You may use Inactive[Divide][x, y], or define your own operator, with its rules:  Format[myDivide[x_, y_]] := DisplayForm@FractionBox[x, y] 
Posted 1 year ago
 I guess you should make your own Divide with it's own rules: ClearAll[MyDivide] MyDivide[x_, y_] MyDivide[a_, b_] ^:= MyDivide[x a, y b] MyDivide[x_, y_] + MyDivide[a_, b_] ^:= MyDivide[b x + a y, b y] Format[MyDivide[x_, y_]] := DisplayForm[FractionBox[x, y]] You can now define your own definitions for multiply and plus et cetera, see example above…