我陷入了 pgfmath 模組的問題。當嘗試計算以下函數值時,列印的結果始終為零。我猜問題是 pgfmaths 共域下溢,數學引擎切斷了小值。
這是我在簡介中試圖解釋的一個最小範例:
\documentclass[tikz]{standalone}
\usepackage[fleqn]{amsmath}
% physical constants:
\pgfmathdeclarefunction{m0}{0}{%
\pgfmathparse{4*pi*1e-7}%
}
\pgfmathdeclarefunction{K}{0}{%
\pgfmathparse{m0*pi/4}%
}
\pgfmathdeclarefunction{c1}{0}{% c1 = K/1.45
\pgfmathparse{K/1.45}%
}
\pgfmathdeclarefunction{c2}{1}{% c2(gamma) = c1/gamma^2
\pgfmathparse{c1/(#1)^2}%
}
\pgfmathdeclarefunction{c3}{2}{% c3(gamma,lambda)
\pgfmathparse{K/((#1)*((#2)+0.45))}%
}
\pgfmathdeclarefunction{DL_rel}{2}{% DL_rel(lambda, gamma)
\pgfmathparse{(2*sqrt((580*#1+261)*#2^3)+40*#1+18)/(29*#2^3-20*#1-9)}%
}
% the problematic pgfmath-function
\pgfmathdeclarefunction{N1}{5}{% N1(soluition, Lmin, gamma, lambda, d1)
\pgfmathsetmacro\numa{(DL_rel(#4,#3)*#2)/2+#2}%
\pgfmathsetmacro\numb{sqrt(\numa^2-c1*c3(#3,#4))/(4*c2(#3)^2)}%
\pgfmathsetmacro\denom{2*c1*#5}%
\pgfmathparse{(#1 -1) ?%
(sqrt((\numa + \numb)/\denom))%
:%
(sqrt((\numa - \numb)/\denom))%
}%
}
\begin{document}
This is the equation im trying to solve:
\begin{equation} \label{eq:N1}
N_{1_{1,2}} =\sqrt{
\frac{\frac{\Delta L}{2} +L_{min} \pm \sqrt{\left(\frac{\Delta L}{2} + L_{min}\right)^2 - \frac{c_1 c_3}{4\cdot c_2^2}\cdot \Delta L^2}}
{2\cdot c_1 d_1}
}
\end{equation}
This should print out its solution:
\begin{equation*}
N_{1_{1,2}} =
\left\{ \begin{array}{l}
\pgfmathparse{N1(1, 4e-4, 1.2, 0.466, 0.115)}\pgfmathresult\\
\pgfmathparse{N1(2, 4e-4, 1.2, 0.466, 0.115)}\pgfmathresult
\end{array}\right.
\end{equation*}
\end{document}
我已經花了很長時間才走到這一步,如果我停在這裡並在不同的應用程式中完成所有數學運算,那將是非常令人沮喪的。
也許有人可以解決我的問題。
無論如何,我想用這篇文章來表達感謝!到目前為止,這是學習 Latex 的好地方,大家做得很好!
答案1
更新以再次堅持數值不穩定性
這是來自日誌輸出,使用gamma=1.2
、lambda=0.466
和Lmin=4e-6
,它們是原始操作中的值。使用,觀察到類似但不同的結果gamma=1.2
。lambda=0.44
4: -1.00000e-13
5: 0
6: 0
7: 0
8: 0
9: 0
10: 2.00000e-19
11: 1.00000e-20
12: 2.00000e-21
13: 1.00000e-22
14: 1.00000e-23
15: 1.00000e-24
16: 0
17: 0
18: 0
19: 0
20: 1.00000e-29
21: 1.00000e-30
22: 0
23: 0
24: 1.00000e-33
25: 1.00000e-34
26: 0
27: 2.00000e-36
28: 0
29: 0
30: 0
31: -1.00000e-40
32: 2.00000e-41
33: 0
34: 2.00000e-43
35: 0
36: 1.00000e-45
37: 1.00000e-46
38: 0
39: -1.00000e-48
40: 0
41: 0
42: -1.00000e-51
43: 1.00000e-52
44: 1.00000e-53
45: 1.00000e-54
46: 0
47: 1.00000e-56
48: 1.00000e-57
49: 0
50: 1.00000e-59
51: 2.00000e-60
52: 0
53: 0
54: 2.00000e-63
55: 1.00000e-64
56: 2.00000e-65
57: 0
58: 0
59: 1.00000e-68
60: 1.00000e-69
61: 0
62: -1.00000e-71
63: 0
64: -1.00000e-73
65: 0
66: 0
67: 1.00000e-76
68: 0
69: 0
70: -1.00000e-79
71: 1.00000e-80
72: 0
73: 0
74: 0
75: 0
76: 0
77: 0
78: -1.00000e-87
79: 1.00000e-88
80: 1.00000e-89
81: 1.00000e-90
82: 1.00000e-91
83: 1.00000e-92
84: 1.00000e-93
85: 0
86: 0
87: 0
88: 1.00000e-97
89: 1.00000e-98
90: 1.00000e-99
91: 0
92: 1.00000e-101
注意:我已將常數設為K
value1
以跳過 的計算Pi
。這會修改此處的結果,因為舍入浮點運算並不完全相同。
產生上述內容的原始碼。
\documentclass{article}
\usepackage{xintexpr}% tested with 1.2e release
%\xintverbosetrue
\usepackage[fleqn]{amsmath}
\begin{document}
This is the equation im trying to solve:
\begin{equation} \label{eq:N1}
N_{1_{1,2}} =\sqrt{
\frac{\frac{\Delta L}{2} +L_{min} \pm \sqrt{\left(\frac{\Delta L}{2} + L_{min}\right)^2 - \frac{c_1 c_3}{4\cdot c_2^2}\cdot \Delta L^2}}
{2\cdot c_1 d_1}
}
\end{equation}
The $\Delta L/L_{min}$, $c_1$, $c_2$, $c_3$ are functions of some parameters
($L_{min}$ is only an overall scaling) and these functions are set-up in such
a way that actually the square root at the numerator of the fraction vanishes
exactly, independently of the values of the parameters. Numerically though it
may be found non zero and this will then induce a catastrophic drop in
precision in the final result. And it may even happen that it will be found
negative, thus potentially raising an error in the complete evaluation.
See the compilation log for this problematic $\left(\frac{\Delta L}{2} +
L_{min}\right)^2 - \frac{c_1 c_3}{4\cdot c_2^2}\cdot \Delta L^2$ evaluated
with the float precision set to various values. You will see it turns negative
at times.
% \xintdeffloatvar pi:=
% 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
\xintFor* #1 in {\xintSeq{4}{92}}\do
{
\xintDigits := #1;
% constants
% \xintdeffloatvar m0:= 4pi*1e-7;
% \xintdeffloatvar K := m0*pi/4;
\xintdeffloatvar K := 1;
\xintdeffloatvar c1:= K/1.45;
% functions
\xintdeffloatfunc c2(u) := c1/u^2;
\xintdeffloatfunc c3(u,v):= K/(u(v+0.45));
% attention arguments like in OP-update, permuted compared to the OP-original
\xintdeffloatfunc DL_rel(u,v):= (2sqrt((580v+261)u^3)+40v+18)/(29u^3-20v-9);
\xintdeffloatfunc DL(t,u,v) := DL_rel(u,v)*t;
% Notice that t=Lmin acts only as an overall scaling factor.
\xintdeffloatfunc numbsquared(t,u,v):=
subs((Z/2+t)^2-c1*c3(u,v)/(4*c2(u)^2)*Z^2, Z=DL(t,u,v));
\typeout{#1: \xintthefloatexpr [6] numbsquared (4e-6, 1.2, 0.466)\relax }
}
\end{document}
我也用楓葉進行了測試。再次設定K
為1
.
numbsquared := proc (N)
local m0, K, c1, c2, c3, DL_rel, DL, localnumbsquared;
Digits:=N;
# m0 := 4*Pi*1e-7;
# K := m0*Pi/4;
K := 1;
c1 := K/1.45;
c2 := u->c1/u^2;
c3 := (u,v)->K/(u*(v+0.45));
DL_rel := (u,v)->(2*sqrt((580*v+261)*u^3)+40*v+18)/(29*u^3-20*v-9);
DL := (t,u,v)->DL_rel(u,v)*t;
localnumbsquared := (t,u,v)->subs(Z=DL(t,u,v),(Z/2+t)^2-c1*c3(u,v)/(4*c2(u)^2)*Z^2);
return localnumbsquared(4e-6, 1.2, 0.466)
end proc:
for N from 4 to 92 do printf("%2d, %e\n", N, numbsquared(N)) end do;
結果類型相同,但既有巧合,又有差異。
4, 0.000000e+00
5, 0.000000e+00
6, 0.000000e+00
7, 0.000000e+00
8, 0.000000e+00
9, 1.000000e-18
10, 2.000000e-19
11, 1.000000e-20
12, -1.000000e-21
13, 1.000000e-22
14, -1.000000e-23
15, 1.000000e-24
16, 0.000000e+00
17, 0.000000e+00
18, 0.000000e+00
19, 0.000000e+00
20, 1.000000e-29
21, 1.000000e-30
22, 0.000000e+00
23, 1.000000e-32
24, -1.000000e-33
25, 1.000000e-34
26, 0.000000e+00
27, 2.000000e-36
28, 1.000000e-37
29, 0.000000e+00
30, 0.000000e+00
31, -1.000000e-40
32, 2.000000e-41
33, 0.000000e+00
34, 2.000000e-43
35, -1.000000e-44
36, 1.000000e-45
37, 1.000000e-46
38, 0.000000e+00
39, -1.000000e-48
40, 0.000000e+00
41, 0.000000e+00
42, -1.000000e-51
43, 1.000000e-52
44, -1.000000e-53
45, 1.000000e-54
46, 0.000000e+00
47, -1.000000e-56
48, 1.000000e-57
49, 0.000000e+00
50, 1.000000e-59
51, 0.000000e+00
52, 0.000000e+00
53, 0.000000e+00
54, 2.000000e-63
55, 1.000000e-64
56, 0.000000e+00
57, 0.000000e+00
58, 0.000000e+00
59, 1.000000e-68
60, 1.000000e-69
61, 0.000000e+00
62, -1.000000e-71
63, 0.000000e+00
64, -1.000000e-73
65, 0.000000e+00
66, 0.000000e+00
67, 1.000000e-76
68, -2.000000e-77
69, -1.000000e-78
70, -1.000000e-79
71, 1.000000e-80
72, 0.000000e+00
73, 0.000000e+00
74, 0.000000e+00
75, 0.000000e+00
76, 0.000000e+00
77, 0.000000e+00
78, 0.000000e+00
79, 1.000000e-88
80, -1.000000e-89
81, -1.000000e-90
82, 1.000000e-91
83, 0.000000e+00
84, -1.000000e-93
85, 0.000000e+00
86, 0.000000e+00
87, 0.000000e+00
88, -1.000000e-97
89, -2.000000e-98
90, 1.000000e-99
91, -2.000000e-100
92, 1.000000e-101
更新以評論有趣的數位好奇心/不穩定性
OP 的第一個版本要求N1(1, 4e-6, 1.2, 0.466, 0.115)
,如下所示。顯然\numb
在這種情況下 是零。但根據浮點精度,它可能會發現或不為零。僅\numa
關於1e-5
最終結果的精度可能會大幅降低小但非零的值\numb
。
我xint
與、、精度數字進行了比較maple
並獲得了類似的結果(僅在最後一位數字不同)(使用楓樹需要時間,更多測試正在進行中)。因為,我從小數開始進行測試,然後先乘以減少到規定的值。因此我運行了下面的程式碼16
20
24
Pi
xint
94
1.0
\xintDigits
\xintDigits := 16; % or 20, 24, 28, ...
\xintdeffloatvar pi:= 1.*3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
在楓葉方面,Pi
直到決賽為止都被視為一個符號evalf
。
xint
以下是浮點精度越來越高的一側的結果:
8.038962683509860
8.0389626847662074875
8.03896268352242165100730
8.038962683509858157707745289
8.0389626835098594140570752438847
8.03896268350985817027123858823346261
8.038962683509858157707745288681429203705
8.0389626835098581577090016380113844070447859
8.03896268350985815770775785217472875573691848736
(這是針對 的解決方案\numa+\numb
)。注意16
數字結果如何好多了比那個有20
數字的! !甚至是相當好比數字的那個24
! (但不如28
數字)。這是因為在16
數字處, xint 和 maple 都\numb
為零,但3e-15
在20
數字處大約為零,這會導致總和出現很大誤差,就像\numa
大約 一樣1e-5
。
有了92
精確的數字,人們就可以用數字\numb
來發現3e-51
。如果精確值為零,這意味著它會破壞大約46
其中的結果數字...
憑藉92
精確的數字,Maple\numb
發現
> evalf(Q(4e-6, 1.2, 0.466, 0.115));
0.3162277660168379331998893544432718533719555139325216826857504852792594438\
-50
6392382213442481084 10
並xint
獲得
3.1622776601683793319988935444327185337195551393252168268575048527925944386392382213442481084e-51
你可以看到它匹配到最後。;-)
更新我真是個傻瓜啊!多少年後才認識
10
????的平方根請注意,上面的本質上是...的平方根1e-101
,原因看起來很簡單,\numb
就是差異的平方根,並且不知何故,這種差異而不是被發現為零,結果是1e-101
由於最後的捨入誤差,每個術語的第92 位數字,可能是1e-10
!!!是的,這應該可以解釋所有等級N
的浮點精度。我想有時差異為零,有時則為1e-(9+N)
。例如,N=20
可以預期差異為1e-29
,因此大約3e-15
為平方根確切地 觀察到什麼。奇怪的是,這些數字似乎從來沒有給出-1e-(9+N)
會因平方根誤差而產生差異的差異。
隨著回傳值隨著精確度的增加而減小,也許我可以相信確切的值為零(我沒有做代數)。如果確切的值確實為零,則將上面的值添加或減去0.000010117182975...
大約 46 個有效數字後會破壞它,破壞 92 位元浮點計算以獲得它...
非常令人驚訝! (但請閱讀上面引用的區塊)
與任何其他數學引擎進行比較時應考慮到這一點:由於減法中可能發生災難性的取消,該公式在數值上不穩定。
原答案
這是使用另一個數學引擎的方法。它只知道平方根,但這已經足夠了。請注意,在給定的範例中\numb
結果恰好為零。
\documentclass[tikz]{standalone}
\usepackage{xintexpr}% tested with 1.2e release
\usepackage[fleqn]{amsmath}
% constants
\xintdeffloatvar pi:= 3.14159265358979323846;
\xintdeffloatvar m0:= 4pi*1e-7;
\xintdeffloatvar K := m0*pi/4;
\xintdeffloatvar c1:= K/1.45;
% functions
\xintdeffloatfunc c2(x) := c1/x^2;
\xintdeffloatfunc c3(x,y):= K/(x(y+0.45));
\xintdeffloatfunc DL_rel(u,v):=
(2*sqrt((580*u+261)*v^3)+40*u+18)/(29*v^3-20*u-9);
% This is allowed by xint parser also (tacit multiplications):
% \xintdeffloatfunc DL_rel(u,v):= (2sqrt((580u+261)v^3)+40u+18)/(29v^3-20u-9);
% Of course we could simplify here by defining more intermediate functions.
% We could define "numa" and "numb" functions, and set them up as functions
% of an already computed "DL_rel" which serves in both.
% It is possible to use the "subs(expression, x=...)" syntax.
% Limitation is that the dummy parameter must be a single letter.
% Also, the inner-most subs will have the last defined thing, and the
% outer-most subs the first defined thing.
\xintdeffloatfunc N1(a,t,u,v,w):=
subs(subs(subs(subs(
if(a=1, sqrt((P+Q)/D), sqrt((P-Q)/D)),
% debugging because something is strange with Q = \numb which is zero
% (P, sqrt(c1*c3(u,v))/c2(u)*X ),
% well after all it was CORRECT that Q was zero with these numerics
Q = sqrt(P^2-c1*c3(u,v)/(c2(u)^2)*X^2)% =\numb,
),
P = X+t % P=\numa, and I think t is Lmin
),
X = DL_rel(v,u)*t/2 % X= DeltaL/2
),
D = 2c1*w % D=\denom
)% must use single letters in subs
;%
\begin{document}
This is the equation im trying to solve:
\begin{equation} \label{eq:N1}
N_{1_{1,2}} =\sqrt{
\frac{\frac{\Delta L}{2} +L_{min} \pm \sqrt{\left(\frac{\Delta L}{2} + L_{min}\right)^2 - \frac{c_1 c_3}{4\cdot c_2^2}\cdot \Delta L^2}}
{2\cdot c_1 d_1}
}
\end{equation}
This should print out its solution:
\begin{equation*}
N_{1_{1,2}} =
\left\{ \begin{array}{l}
\xintthefloatexpr N1(1, 4e-6, 1.2, 0.466, 0.115)\relax\\
\xintthefloatexpr N1(2, 4e-6, 1.2, 0.466, 0.115)\relax
\end{array}\right.
\end{equation*}
\end{document}
在這個例子中,兩個解決方案是相同的,因為\numb
消失...
請注意,解是可擴展計算的。這對某些人來說很重要(傻瓜......)。
如果您想要更精確,請從以下開始:
\xintDigits := 32;
\xintdeffloatvar pi:= 3.141592653589793238462643383279503;
答案2
您可以嘗試走這條lualatex
路線,然後在 中獲得所有數學精度lua
,所以pgf
根本不需要。以下可能會顯示錯誤的答案,但這並不是由於 的數學能力lua
,更可能只是所需公式的相當倉促的翻譯:
\documentclass[preview,border=5]{standalone}
\usepackage[fleqn]{amsmath}
\usepackage{luacode}
\begin{luacode*}
pi = math.pi
sqrt = math.sqrt
m0 = 4 * pi * 1e-7
K = m0 * pi / 4
c1 = K / 1.45
c2 = function (x) return c1 / (x^2); end
c3 = function (x, y) return K / (x * (y + 0.45)); end
DLrel = function (x, y)
return (2 * sqrt((580 * x + 261) * y^3) + 40 * x + 18) /
(29 * y^3 - 20 * x - 9)
end
N1 = function (s, Lmin, g, l, d1)
dL = DLrel(l, g) * Lmin
nm = dL / 2 + Lmin
rt = (nm^2 - c1 * c3(g, l) * 0.25 * c2(g)^-2 * dL^2)
dn = 2 * c1 * d1
s = -(s % 2) * 2 + 1
return sqrt((nm + s * sqrt(rt)) / dn)
end
\end{luacode*}
\def\luaprint#1{\directlua{tex.print(#1)}}
\begin{document}
\begin{equation*}
N_{1_{1,2}} = \left\{
\begin{array}{l}
\luaprint{N1(1, 4e-4, 1.2, 0.44, 0.115)}
\\
\luaprint{N1(2, 4e-4, 1.2, 0.44, 0.115)}
\end{array}\right.
\end{equation*}
\end{document}
答案3
更新1:pgfmath + fpu
我今天玩了一下XINT
,但由於缺乏數學函數,我又回到了我的pgfmath
方法。稍後我還需要嵌入一些公式,對於這些公式,我需要三角函數等。馬克暗示要使用\usetikzlibrary{fpu}
更高的精度,經過一些調整後,我終於讓它工作了。
到目前為止,這是我的程式碼:
\documentclass[tikz]{standalone}
\usepackage[fleqn]{amsmath}
\usetikzlibrary{fpu}
% physical constants:
\pgfmathdeclarefunction{m0}{0}{%
\pgfmathparse{4*pi*1e-7}%
}
\pgfmathdeclarefunction{K}{0}{%
\pgfmathparse{m0*pi/4}%
}
\pgfmathdeclarefunction{c1}{0}{% c1 = K/1.45
\pgfmathparse{K/1.45}%
}
\pgfmathdeclarefunction{c2}{1}{% c2(gamma) = c1/gamma^2
\pgfmathparse{c1/(#1)^2}%
}
\pgfmathdeclarefunction{c3}{2}{% c3(gamma,lambda)
\pgfmathparse{K/((#1)*((#2)+0.45))}%
}
\pgfmathdeclarefunction{DL_rel}{2}{% DL_rel(gamma, lambda)
\pgfmathparse{(2*sqrt((580*#2+261)*#1^3)+40*#2+18)/(29*#1^3-20*#2-9)}%
}
% the problematic pgfmath-function
% #1 #2 #3 #4 #5
\pgfmathdeclarefunction{N1}{5}{% N1(soluition, Lmin, gamma, lambda, d1)
\pgfmathsetmacro\DL{(DL_rel(#3,#4)*#2)}%
\pgfmathsetmacro\numa{\DL/2+#2}%
\pgfmathsetmacro\numb{sqrt(\numa^2 - c1*c3(#3,#4)/(4*c2(#3)^2)*\DL^2)}%
\pgfmathsetmacro\denom{2*c1*#5}%
\pgfmathfloatparse{(#1 == 1) ?%
(sqrt((\numa + \numb)/\denom))%
:%
(sqrt((\numa - \numb)/\denom))%
}%
}
\begin{document}
\pgfkeys{/pgf/fpu=true}
\pgfmathparse{N1(1, 4e-6, 1.2, 0.44, 0.115)}\pgfmathprintnumber[sci, precision=2]{\pgfmathresult}\\
\pgfkeys{/pgf/fpu=false}
This is the equation im trying to solve:
\begin{equation} \label{eq:N1}
N_{1_{1,2}} =\sqrt{
\frac{\frac{\Delta L}{2} +L_{min} \pm \sqrt{\left(\frac{\Delta L}{2} + L_{min}\right)^2 - \frac{c_1 c_3}{4\cdot c_2^2}\cdot \Delta L^2}}
{2\cdot c_1 d_1}
}
\end{equation}
This should print out its solution:
\pgfkeys{/pgf/fpu=true}
\begin{equation*}
N_{1_{1,2}} =
\left\{ \begin{array}{l}
\pgfmathparse{N1(1, 4e-6, 1.2, 0.44, 0.115)}\pgfmathprintnumber[fixed, precision=2]{\pgfmathresult}\\
\pgfmathparse{N1(2, 4e-6, 1.2, 0.44, 0.115)}\pgfmathprintnumber[fixed, precision=2]{\pgfmathresult}
\end{array}\right.
\end{equation*}
\pgfkeys{/pgf/fpu=false}
\end{document}
但我不確定結果的精度。與 jfbus 解和 wxMaxima 的輸出相比,分子中的平方根現在不再為零,儘管它非常小(e-18)。即使差異非常小,我對 pgfmaths 的整體精度很感興趣。因為我計劃稍後在編譯時在 Latex 中完成所有數學計算,我會看到我在之後的每一次計算中自我質疑。
總而言之,你們認為將 pgfmath 用於此類應用程式是個好主意嗎?有人做過類似的事情嗎?
順便說一句,我現在已用於\pgfmathsetmacro
保存稍後需要的結果。有沒有更好的解決方案,或者這是常見的方法?
更新2:LuaTeX + luacode
到目前為止,一切都很好。我知道放棄了我的pgfmath
方法,因為它不準確,現在專注於 Marks luaTeX 版本。
該解決方案為我提供了一種將計算解決方案嵌入公式和文本中的好方法。但為了讓這些東西真正有用,我需要讓它在pgfplot
環境中運作。這是一個例子:
\documentclass[preview,border=5]{standalone}
\usepackage[fleqn]{amsmath}
\usepackage{luacode}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{luacode*}
-- test
pi = math.pi
sqrt = math.sqrt
m0 = 4 * pi * 1e-7
K = m0 * pi / 4
c1 = K / 1.45
c2 = function (g) return c1 / (g^2); end
c3 = function (g, l) return K / (g * (l + 0.45)); end
DLrel = function (g, l)
return (2 * sqrt((580 * l + 261) * g^3) + 40 * l + 18) /
(29 * g^3 - 20 * l - 9)
end
DLrel_lmd = function (l) return DLrel(sqrt(l^2+1),l); end
N1 = function (s, Lmin, g, l, d1)
dL = DLrel(g, l) * Lmin
nm = dL / 2 + Lmin
rt = (nm^2 - c1 * c3(g, l) * 0.25 * c2(g)^-2 * dL^2)
dn = 2 * c1 * d1
s = -(s % 2) * 2 + 1
return sqrt((nm + s * sqrt(rt)) / dn)
end
print = function (d,s)
if d == 0 then
format = "%d"
else
format = "%." .. d .. "f"
end
tex.sprint(string.format(format,s));
end
\end{luacode*}
\newcommand{\lp}[2][16]{\directlua{print(#1,#2)}}
\begin{document}
now i can do calculations in lua and print them out in formulas:
\begin{equation*}
N_{1_{1,2}} = \left\{
\begin{array}{l}
\lp[4]{N1(1, 4e-6, 1.2, 0.446, 0.115)}
\\
\lp[4]{N1(2, 4e-6, 1.2, 0.446, 0.115)}
\end{array}\right.
\end{equation*}
Some serious research done here..\\
..oh some new values i came across, i can embed them in my text:\\
\begin{luacode}
now = 42.42424242424242
\end{luacode}
\( now = \lp[4]{now}\)
as you can see in this fancy plot:
\begin{tikzpicture}
\begin{axis}[
width=0.5\linewidth,
height=10cm,
xmin=0, xmax=180,
ymin=0, ymax=50,
xlabel=$time$,
ylabel=Questions accouring while learning LaTeX,
]
\addplot[
thick,
blue,
domain=0:180,
samples=200,
]{42*sin(x)}; % This value should be taken from lua
\addplot[
red,
only marks
] coordinates {
(90, 42) % This value should be taken from lua
}
[yshift=10pt, xshift = 10pt]
node[pos=0] {$now = 42$}; % This value should be taken from lua
\end{axis}
\end{tikzpicture}
\end{document}