-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathformula_pi_dynamic.i
More file actions
35 lines (25 loc) · 1.78 KB
/
formula_pi_dynamic.i
File metadata and controls
35 lines (25 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
::my.include("../integral/common/includes/integral/doc-base.i", DV_DIR_EXE);
::my.include("../integral/common/includes/integral/doc-table.i", DV_DIR_EXE);
::my.include("../integral/common/includes/integral/doc-math.i", DV_DIR_EXE);
function CDTDocumentBasic::Make(level, page_w, page_h)
{
SetMathParams({Autoformat = 1, Placeholders = 0});
UpdateBaseFormat({FontSize = 120, Align = DE_ALIGN_CENTER}); // Set font size to 120 mm and center
local sq = {}; /* this will be a dynamic array of squares */
local label = "Formula " + (level + 1) + ": ";
/* 2 innermost squares */
sq[0] <- Sqrt(Run() + 2 + Sum + Ellipsis + Sum + Sub("b", 2) + Mul + Sqrt(Run() + 2 + Sum + "sin" + Brack(Frac(Run() + Pi + Mul + Sub("b", 1), 4))));
/* additional squares */
for (local i = 1, j = level; i <= level; i++, j--) sq[i] <- Sqrt(Run() + 2 + Sum + Sub("b", "n" + Diff + j) + Mul + sq[i - 1]);
local formula = Run() + Pi + Eq + LimitInf("n") + Sp + Frac(Sup(2, "n" + Sum + 1), Run() + 2 + Diff + Sub("b", 1)) + Mul + Brack(Frac(Sub("b", "n"), 2) + Mul + sq[level]) + Sp + "/;\r" + label + Sub("b", "n") + Eq + 1 + And + Sub("b", "n" + Diff + 1) + Eq + -1 + And + "(" + Sub("b", "k") + Eq + 1 + And + 2 + LTEq + "k" + LTEq + "n" + Diff + 2 + And + "k" + Element + Integers + ")" + And + Sub("b", 1) + Element + Reals + And + -2 + LTEq + Sub("b", 1) + LTEq + 2;
TextArea(0, 100, 100, page_w - 200, page_h - 200, formula);
}
local format = ::my.app.GetQueryVar("format", DX_FORMAT_SVG).tointeger();
local level = ::my.app.GetQueryVar("level", 5).tointeger();
local zoom = 0.2;
local page_w = 7000, page_h = 1000;
local doc = CDTDocumentBasic("fontmaps/stix-1.inf");
doc.Make(level, page_w, page_h);
doc.Cleanup();
::my.app.ReZoom(zoom);
::my.app.Export(format, page_w * zoom, page_h * zoom);