|
MathMLを使用してWebブラウザー上で数式を美麗に表示します。
#220
球の体積・表面積の公式をWebブラウザー上で表示させます。
OPTION ARITHMETIC RATIONAL
OPEN #1:NAME "球の体積.html"
ERASE #1
PRINT #1:"<!DOCTYPE html>"
PRINT #1:"<html>"
PRINT #1:"<head>"
PRINT #1:" <title>球の体積</title>"
PRINT #1:" <script async src=";CHR$(34);"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML";CHR$(34);"></script>"
PRINT #1:"</head>"
PRINT #1:"<body>"
PRINT #1:"<h1>球の体積</h1>"
FOR N=2 TO 100
LET S=1
FOR I=N TO 2 STEP-2
LET S=S*I
NEXT I
LET L=GCD(S,2^((N+MOD(N,2))/2))
LET LL=GCD(S,N*2^((N+MOD(N,2))/2))
PRINT #1:"<math>"
PRINT #1:"<mtext>";N;"次元の球の体積</mtext>"
PRINT #1:"</math>"
PRINT #1:" "
PRINT #1:"<math>"
PRINT #1:"<msub>"
PRINT #1:" <mi>V</mi>"
PRINT #1:" <mn>";N;"</mn>"
PRINT #1:"</msub>"
PRINT #1:"<mo>=</mo>"
IF S/L=1 THEN
IF 2^((N+MOD(N,2))/2)/L>1 THEN PRINT #1:" <mn>";STR$(2^((N+MOD(N,2))/2)/L);"</mn>"
ELSE
PRINT #1:"<mfrac>"
PRINT #1:" <mn>";STR$(2^((N+MOD(N,2))/2)/L);"</mn>"
PRINT #1:" <mn>";STR$(S/L);"</mn>"
PRINT #1:"</mfrac>"
END IF
PRINT #1:"<msup>"
PRINT #1:" <mi>π</mi>"
IF (N-MOD(N,2))/2>1 THEN PRINT #1:" <mn>";STR$((N-MOD(N,2))/2);"</mn>"
PRINT #1:"</msup>"
PRINT #1:"<msup>"
PRINT #1:" <mi>r</mi>"
IF N>1 THEN PRINT #1:" <mn>";STR$(N);"</mn>"
PRINT #1:"</msup>"
PRINT #1:"</math>"
PRINT #1:CHR$(60);CHR$(98);CHR$(114);CHR$(62)
PRINT #1:CHR$(60);CHR$(98);CHR$(114);CHR$(62)
PRINT #1:"<math>"
PRINT #1:"<mtext>";N;"次元の球の表面積</mtext>"
PRINT #1:"</math>"
PRINT #1:CHR$(60);CHR$(98);CHR$(114);CHR$(62)
PRINT #1:"<math>"
PRINT #1:"<msub>"
PRINT #1:" <mi>S</mi>"
PRINT #1:" <mn>";N;"</mn>"
PRINT #1:"</msub>"
PRINT #1:"<mo>=</mo>"
IF S/LL=1 THEN
IF N*2^((N+MOD(N,2))/2)/LL>1 THEN PRINT #1:"<mn>";STR$(N*2^((N+MOD(N,2))/2)/LL);"</mn>"
ELSE
PRINT #1:"<mfrac>"
PRINT #1:"<mn>";STR$(N*2^((N+MOD(N,2))/2)/LL);"</mn>"
PRINT #1:"<mn>";STR$(S/LL);"</mn>"
PRINT #1:"</mfrac>"
END IF
PRINT #1:"<msup>"
PRINT #1:"<mi>π</mi>"
IF (N-MOD(N,2))/2>1 THEN PRINT #1:"<mn>";STR$((N-MOD(N,2))/2);"</mn>"
PRINT #1:"</msup>"
PRINT #1:"<msup>"
PRINT #1:" <mi>r</mi>"
IF N-1>1 THEN PRINT #1:" <mn>";STR$(N-1);"</mn>"
PRINT #1:"</msup>"
PRINT #1:"</math>"
PRINT #1:CHR$(60);CHR$(98);CHR$(114);CHR$(62)
PRINT #1:CHR$(60);CHR$(98);CHR$(114);CHR$(62)
NEXT N
PRINT #1:"</body>"
PRINT #1:"</html>"
CLOSE #1
END
|
|