跳到正文
DEV Community· TheOmniKit·· 13 小時前AI 評分34

theomnikit.com 新增八款瀏覽器計算器及檔案工具,並展示計算過程

Eight new browser calculators and converters, with the math shown

AI 導讀

theomnikit.com 於 11月22日新增八款可在瀏覽器執行的工具,包括四款數學計算器及四款檔案工具。計算器頁面列出公式及演算例子,作者以 Python 3 核對輸出;八款工具均在瀏覽器執行。

正文

On 22 November I added eight tools to theomnikit.com, my site of small tools that run in the browser: four maths calculators (area, probability, triangle and z-score) and four file tools (EPUB to PDF, ODT to PDF, a voice changer and a vocal remover).

I wrote this with AI help and checked each tool page myself. For each calculator I took the worked example its page prints, ran the same formula in Python 3, and pasted the real output under it. For the four file tools I only repeat what each page says it does.

Area Calculator

The Area Calculator gives the area and perimeter of 9 flat shapes and the volume and surface area of 8 solids, with each formula worked. You pick the unit (mm, cm, m, km, inches, feet or yards), and for shapes with π you choose the exact π or 22/7, the value school books use.

The page's own example: a circle of radius 7 cm is 154 cm² with π = 22/7 and 153.938 cm² with the exact π. Its table also lists a 60° sector of radius 21 cm as 231 cm².

from fractions import Fraction as F
from math import pi
print(F(22, 7) * 7**2)                  # circle r = 7, pi = 22/7
print(round(pi * 7**2, 3))              # circle r = 7, exact pi
print(F(60, 360) * F(22, 7) * 21**2)    # sector r = 21, 60 degrees
154
153.938
231

Probability Calculator

The Probability Calculator handles two events (A and B, A or B, A given B), repeated tries (exactly or at least k of n) and counting (nCr and nPr). Answers come as exact fractions with the working, and you can type a probability as a decimal, a fraction or a percentage.

The page's examples: at least one six in 4 rolls of a die is 1 − (5/6)⁴ = 671/1296, about 0.5177, and exactly 5 heads in 10 tosses of a fair coin is 63/256.

from fractions import Fraction as F
from math import comb
p = 1 - F(5, 6)**4                      # at least one six in 4 rolls
print(p, round(float(p), 4))
print(comb(10, 5) * F(1, 2)**10)        # exactly 5 heads in 10 tosses
671/1296 0.5177
63/256

Triangle Calculator

The Triangle Calculator solves any triangle from three sides, two sides and an angle, or two angles and a side, and has a right-triangle mode for Pythagoras. It shows the law of cosines, the law of sines, Heron's formula or Pythagoras line by line, and gives the area, perimeter, heights and radii.

The page's example: sides 5, 6 and 7 give angles of 44.42°, 57.12° and 78.46°, and Heron's formula gives an area of 6√6, about 14.70.

from math import acos, degrees, sqrt
a, b, c = 5, 6, 7
A = degrees(acos((b*b + c*c - a*a) / (2*b*c)))
B = degrees(acos((a*a + c*c - b*b) / (2*a*c)))
s = (a + b + c) / 2
print(f"{A:.2f} {B:.2f} {180 - A - B:.2f}")
print(f"{sqrt(s*(s-a)*(s-b)*(s-c)):.2f} {6*sqrt(6):.2f}")
44.42 57.12 78.46
14.70 14.70

Z-Score Calculator

The Z-Score Calculator finds a z-score from a value, mean and standard deviation, the area to the left, to the right or between two values, the two-tailed p-value, and the z for a given probability (1.96 for 95%). The page says Φ comes from the complementary error function, Φ(z) = ½·erfc(−z/√2), and my check uses the same.

The page's examples: 85 with mean 70 and SD 10 gives z = 1.5, with 93.32% of a normal population below it; the area between 60 and 80 is 0.68269; and the area left of 1.96 is 0.97500.

from math import erfc, sqrt
Phi = lambda z: 0.5 * erfc(-z / sqrt(2))
z = (85 - 70) / 10
print(z, f"{Phi(z):.5f}")
print(f"{Phi(1) - Phi(-1):.5f} {Phi(1.96):.5f}")
1.5 0.93319
0.68269 0.97500

All four pages match Python to the decimals they show.

EPUB to PDF

EPUB to PDF turns a DRM-free EPUB e-book into a PDF. The page says it unpacks the book in your browser and lays the chapters out in reading order, each chapter on a new page, with a title page. Headings, paragraphs, lists, bold, italic and simple tables are kept; pictures and the book's own fonts are not. You choose A4 or Letter, the margins and the font size. Books up to 100 MB work, and nothing is uploaded.

ODT to PDF

ODT to PDF turns an OpenDocument text file into a PDF. The page says it reads .odt, .ott or flat .fodt files from LibreOffice, OpenOffice or Google Docs in your browser. Headings, paragraphs, lists, tables, bold, italic and page breaks are kept; pictures, text boxes and footnote text are not. Files up to 50 MB work, and nothing is uploaded.

Voice Changer

The Voice Changer turns a recording into one of 8 voices in one tap: Robot, Chipmunk (7 semitones up), Deep, Monster, Alien, Telephone (300 to 3,400 Hz), Walkie-talkie or Echo. The page says the length stays the same, so a voice-over still fits its video (its table lists a 2.52 s tail for Echo), and the file never leaves your browser. You compare the before and after players, then download the result as a WAV file.

Vocal Remover

The Vocal Remover makes a karaoke version of a stereo song by cancelling whatever is mixed in the centre, where the lead vocal almost always sits. The page calls it a classic phase cancel, not AI. It keeps the bass below 120 Hz, tells you what share of the song is in the centre before you start, and uploads nothing. The page also says backing vocals panned to the sides stay, and a faint echo of the voice often stays too.

That's the batch

All eight run in the browser. If a calculator number looks wrong to you, leave your input in the comments and I will check it.

來源:DEV Community · dev.to