I am interested in a function which would stop Mathematica reducing fraction.
If my input is 50/100
, Mathematica outputs 1/2
, I want it to output 50/100
. Any nice function which does this?
I need this because I want to define a recursive function with this behavior:
f[0]=50/100
f[n_]:=(Numerator[f[n-1]]+1)/(Denominator[f[n-1]]+1)
I want to obtain f[1]=51/101
, not f[1]=2/3
, which I get.
A more complicated example:
f[0]=50/100
f[n_]:=If[Mod[n,2]==0,(Numerator[f[n-1]+1])/n,Numerator[f[n-1]/(Denominator[f[n-1]]+1)
This gets really annoying if I store 50/100 as {50,100}.
f[0]={50,100}
? (and there is an "edit" button right below your question, I think it would be nice to include the example) $\endgroup$ – Pinguin Dirk Sep 25 '13 at 19:55