public static double DoubleValue(MyFrac f1) { double b = 0; b = (double)f1.nom / f1.denom; return(b); }
public static MyFrac GetRGR115LeftSum(int n) { MyFrac res = new MyFrac(1, 1); for (int i = 2; i <= n; i++) { res = Multiply(res, Minus(new MyFrac(1, 1), new MyFrac(1, i * i))); } return(res); }
public static MyFrac GetRGR113LeftSum(int n) { MyFrac objS = new MyFrac(1, 1 * 3); for (int i = 2; i <= n; i++) { MyFrac obj = new MyFrac(1, (2 * i - 1) * (2 * i + 1)); objS = Plus(objS, obj); } return(objS); }
public static MyFrac Divide(MyFrac f1, MyFrac f2) { return(new MyFrac(f1.nom * f2.denom, f1.denom * f2.nom)); }
public static MyFrac Multiply(MyFrac f1, MyFrac f2) { return(new MyFrac(f1.nom * f2.nom, f1.denom * f2.denom)); }
public static MyFrac Minus(MyFrac f1, MyFrac f2) { return(new MyFrac(f1.nom * f2.denom - f1.denom * f2.nom, f1.denom * f2.denom)); }