Unicode polynomial equation: Difference between revisions

m
no edit summary
(julia example)
mNo edit summary
Line 403:
c = abs(c)
end
if esfrac == 0get(tofracs, c - trunc(c), "")
sint = printstring(Int(trunc(c)))
s = (sfrac == "") ? string(c) : (sint == "0" ? "" : sint) * sfrac
else
print(c == 1 && e != 0 ? "" : c, lp.varname, tosuper(e)s)
ende != 0 && print(lp.varname, tosuper(e))
firstterm = false
end
Line 423:
'⅖' => "$(2/5)", '⅗' => "$(3/5)", '⅘' => "$(4/5)", '⅙' => "(1/6)", '⅚' => "$(5/6)",
'⅛' => "$(1/8)", '⅜' => "$(3/8)", '⅝' => "$(5/8)", '⅞' => "$(7/8)", '↉' => "$(0/3)"])
const tofracs = Dict(0.25 => '¼', 0.5 => '½', 0.75 => '¾', 0.2 => '⅕')
allfrac = join(vcat(collect(keys(fracs))), "|")
 
Line 515 ⟶ 516:
0x⁷ + 10x + 10x + x⁵ - 2x⁴ + 42x³ + 20x + 1 => x⁵ - 2.0x⁴ + 42.0x³ + 40.0x + 1.0
1E0x⁵ - 2,000,000.e-6x⁴ + 4.2⏨1x³ + .40e+2x + 1 => x⁵ - 2.0x⁴ + 42.0x³ + 40.0x + 1.0
x⁵ - x⁴⁄2 + 405x³⁄4 + 403x⁄4 + 5⁄2 => x⁵ - 0.5x⁴½x⁴ + 101.25x¼x³ + 100.75x¾x + 2.5½
x⁵ - ½x⁴ + 101¼x³ + 100¾x + 2½ => x⁵ - 0.5x⁴½x⁴ + 101.25x¼x³ + 100.75x¾x + 2.5½
</pre>
 
4,102

edits