Please I am trying to achieve this:
Question
Subtract Mixed Numbers with Formulas using the "IF Conditional statement" to prevent same selection of both denominators.
The ideal question should like this (if the condition works):
Variables used are:
wn1 = first whole number = 8, tn1 = first numerator = 2, bn1 = first denominator = 4, wn2 = second whole number = 5, tn2 = second numerator = 3 and bn2 = second denominator = 5.
Random Variable: wn1= {3,4,5, 6}; k = {32:46:2}; wnk = {1, -1, 2, -2}; tn1 = {1, 2}; tn2 = {1, 2, 3}; bnk = {1, 2}
Global Variable: bn1 = tn1 + 1;
bn2 = tn2 + bnk;
bn2 = (bn2=bn1) ? (bn2+1) : bn2; #(Prevent denominators to be the same)
bn1 = (bn1=bn2) ? (bn1+1) : bn1; #(Prevent denominators to be the same)
tn2 = (tn1/bn1=tn2/bn2) ? (tn2+1) : tn2; #(This is to prevent fractional parts to be the same, else answer will be whole number)
wn2 = wn1 + wnk; wn1 = (wn1 <= wn2+2) ? (wn1+4) : wn1; #(This is to prevent first whole number to be always greater than the second whole number, so that there is no negative answer. This works!)
im1 = (wn1*bn1)+tn1; im2 = (wn2*bn2)+tn2; #step1. change all to improper fractions
cm = lcm(bn1, bn2); # find lcm of both denominators
cf1= (cm/bn1)*im1; cf2= (cm/bn2)*im2; # combining fraction step 1;
imfa=(cm/bn1)*im1 - (cm/bn2)*im2;
wa = floor(imfa/cm); ta = imfa-(cm*wa); cf=gcd(ta,cm); ta = ta/cf; ba = cm/cf
However, I still get mixed numbers like the below, this not giving accurate result:

I also attach the XML file.
Any help would be greatly appreciated.
Thanks.
Dipo.