Mathematics of MOS: Difference between revisions

ArrowHead294 (talk | contribs)
ArrowHead294 (talk | contribs)
Line 171: Line 171:
if r>1 then RETURN(medi([u[1]/r, u[2]/r])) fi;
if r>1 then RETURN(medi([u[1]/r, u[2]/r])) fi;
q := '''penult'''(u[1]/u[2]);
q := '''penult'''(u[1]/u[2]);
if q > u[1]/u[2] then RETURN((numer(q)+denom(q))/(u[1]+u[2])) fi;
if q > u[1]/u[2] then RETURN((numer(q)+denom(q))/(u[1]+u[2])) fi;
(u[1]+u[2]-numer(q)-denom(q))/(u[1]+u[2]) end:
(u[1]+u[2]-numer(q)-denom(q))/(u[1]+u[2]) end:


Line 180: Line 180:
w := n/denom(q);
w := n/denom(q);
u := '''fareypair'''(q);
u := '''fareypair'''(q);
if g<u[1] or g>u[2] or g=q then RETURN('false') fi;
if g&lt;u[1] or g&gt;u[2] or g=q then RETURN('false') fi;
if g<q then RETURN([w*denom(u[1]), w*denom(u[2])]) fi;
if g&lt;q then RETURN([w*denom(u[1]), w*denom(u[2])]) fi;
[w*denom(u[2]), w*denom(u[1])] end:
[w*denom(u[2]), w*denom(u[1])] end:


Line 245: Line 245:
w := n[nops(n)];
w := n[nops(n)];
if type(x, rational) and modp(denom(x), 2)=0 then RETURN(w) fi;
if type(x, rational) and modp(denom(x), 2)=0 then RETURN(w) fi;
evalf(w) end:
evalf(w) end:</pre>
</pre>


== Proofs ==
== Proofs ==