I'm trying to implement the dual unit $\epsilon$ defined by $\epsilon^2 = 0$ into Mathematica but I'm having trouble defining $\epsilon^n = 0$ for $n\geq 2$.
In this answer they simply use dualE /: Power[dualE, 2] := 0 which works well for $n=2$ but not for any other $n\geq 2$.
I've tried
dualE /: Power[dualE, n] := If[n>=2, 0, dualE^n]
but then I just get $\epsilon^n = \epsilon^n$ for any $n$. I can also define the function
Nilpotent[dualE, n] := If[n>=2, 0, Power[dualE, n]]
which then gives Nilpotent[dualE, n] = 0 for $n\geq 2$, but if I try
dualE /: Power[dualE, n] := Nilpotent[dualE, n]
this still doesn't give the desired result for $\epsilon^{n\geq 2}$!
As a last ditch effort I tried Table[dualE /: power[dualE, n] := 0, {n, 2, 100}]; which at least gives $\epsilon^n = 0$ for $2\leq n \leq 100$ but still evaluates to $\epsilon^n$ for any non-integer values of $n$.
There must be a way to define $\epsilon^{n\geq2}=0$ and $\epsilon^{n<2}=\epsilon^n$ properly so any help would be much appreciated!