æè¿è©±é¡ã®å½¢å¼çåªç´æ° (FPS) ã§ããæè¿ã¨è¨ãã¤ã¤ 4 å¹´ãããåããæµè¡ãå§ãã¦ããæ°ããã¾ããå½æã¯ãæ¯é¢æ°ãã¨å¼ãã§ãã人ãå¤ãã£ãæ°ããã¾ãã
ä»åã¯ãFPS ã§èå¯ããã¦ãã¦ã$\frac{\dd}{\dd x}y = f(y)$ ãªã FPS $y(x)$ ã«å¯¾ã㦠$y(x)\bmod x^n$ ãæ±ããããªããã¨ãªã£ãã¨ãã®è©±ããã¾ãã
å°å ¥
ãã¨ãã°ãèå¯ã®çµæãæ±ããã $y$ ã $y^2 + 2xyy' - y' = 0$, $y(0) = 1$ ã¨ãªãããããã¨ãããã£ãã¨ãã¾ã*1ã
åºå¦
ãã㯠Catalan æ°ã§ãã$C(x) = 1 + xC(x)^2$ ãªã®ã§ã$y = 1 + xy^2$ ã§ã$y' = y^2 + 2xyy'$ ã§ãã
ããããã¨ã㯠Wolfram|Alpha 大å çã«èãã°ããã§ããã
y^2 + 2xyy' - y' = 0, y(0) = 1
$$y(x) = - \frac{\sqrt{1-4x}-1}{2x}$$
ã¨çãã¦ãããã®ã§ãããæ±ããã°ããã§ããããããã§ãï¼ï¼ï¼ï¼ï¼ã
ããã§ãããã®ã§ããããå®éã« $y(x)$ ãé½ã«æ±ãã¦ããã® FPS ãæ±ãããã¨ããã¹ããããè¸ã¾ãã«æ±ããæ¹æ³ã®ç´¹ä»ã§ãã ããå¿ è¦ããããã¨ã¨ãã¦ã¯ã
- èå¯ã¹ããã㧠$y' = f(y)$ ãªã $f(y)$ ãæ±ãã¦ãã
- å¤é å¼ $y$ ã¨æ´æ° $n$ ã«å¯¾ããé¢æ° $(y, n) \mapsto f(y) \bmod x^n$ ãå®è£ ãã
- å¤é å¼ $y$ ã¨æ´æ° $n$ ã«å¯¾ããé¢æ° $(y, n) \mapsto \frac{\dd}{\dd y} f(y) \bmod x^n$ ãå®è£ ãã
ä¸è¨ã®ä¾ã§ããã°ã$f(y) = y^2\cdot(1-2xy)^{-1}$ 㨠$\frac{\dd}{\dd y} f(y) = 2y(1-xy)\cdot(1-2xy)^{-2}$ ã§ã*2ã
$f(y) \bmod x^n$ 㨠$\frac{\dd}{\dd y} f(y) \bmod x^n$ ãæ±ããããã®è¨ç®éã $F(n)$ãé·ã $n$ ã®ç³ã¿è¾¼ã¿ã®è¨ç®éã $M(n)$ ã¨ããã¨ãå ¨ä½ã§ $O(F(n)+M(n))$ æéã§è¨ç®ã§ãã¾ããããããè¨å®ã 㨠$O(n\log(n))$ ã¨ãã§ããããã
解説
ããã«æ¸ãã¾ããã
fode
ã¨ããåå㯠first-order ordinary differential equation ããæ¥ã¦ããã¨æãã¾ãããªã³ã¯å
ã® References ã«ããè«æï¼âSeries solutions of algebraic and differential equations: a comparison of linear and quadratic algebraic convergenceâ ã®æ¹ï¼ããæåãã¾ããã
åé¡ä¾
ãã¿ãã¬ãå«ã¿ã¾ã
解説ãèªãã¨ã$S'(x) = S^2(x) + 1$ ããã³ $T'(x) = T(x)\tan(x)$ ãæºãã $S(x)$, $T(x)$ ãæ±ããããããã¨ããããã¾ããåææ¡ä»¶ã¯ $S(0) = 0$, $T(0) = 1$ ã§ãã
$f(S) = S^2+1$, $g(T) = T\tan(x)$ ã¨ããã¨ã$\frac{\dd}{\dd S} f(S) = 2S$ 㨠$\frac{\dd}{\dd T} g(T) = \tan(x)$ ã¨ãããã®ã§ãä¸è¨ãå®è£ ããã°ããã§ãã
$\tan(f(x))$ ã® FPS ã Newton æ³ã§æ±ãããã¾ãããããã¯ãããã§ã¯ $\tan(x)$ ããè¨ç®ããã°ããã®ã§ãæå㪠$\sin(x) = \frac{x^1}{1!} - \frac{x^3}{3!} + \cdots$ 㨠$\cos(x) = \frac{x^0}{0!} - \frac{x^2}{2!} + \cdots$ ãã $\sin(x)\cdot \cos(x)^{-1}$ ã¨ãã¦æ±ãã¦ãããã§ãããã
Note: ããä¸è¬ã«ã¯ãä¸ãããã $f(x)$, $g(x)$ ã«å¯¾ã㦠$e^{f(x)+ig(x)} = u(x)+iv(x)$ ã®å½¢å¼ã® $u(x)$, $v(x)$ ãæ±ãããããããã®ã§ã$u(x) = \cos(g(x))$, $v(x) = \sin(g(x))$ ãªã©ã¨ãªãã$\tan(g(x)) = u(x)\cdot v(x)^{-1}$ ã®ããã«ãªãã§ãããã
ææ
å¾®åæ¹ç¨å¼ãæãæ以å¤ã§è§£ãããããã°ä½¿ããã«æ¸ãã®ã§ããã¾ãå¿ è¦ãªãããããã¾ããã å¾®åæ¹ç¨å¼ã解ãããã® Newton æ³ã®ä¸ã§ã$\exp$ ã®è¨ç®ï¼Newton æ³ã使ãï¼ãéå ã®è¨ç®ï¼Newton æ³ã使ãï¼ããç©ã®è¨ç®ï¼FFT ã使ãï¼ãªã©ãè¡ã£ã¦ããé¢ä¿ã§ãå®æ°åãéããªã£ã¦ãã¾ãã¾ãã ããã㯠Catalan æ°ã®ä¾ã®ããã«ãä¸è¬é ãæã§åºãã¦ããã° $O(n)$ æéã§è§£ããå ´åãããã®ã§ããªã¼ãã¼ã¬ãã«ã§ã®å¦¥åã«ãªããã¨ãããã¾ãã
ã¨ã¯ãããæã§æ¥µå¤ãæ±ããã«ä¸åæ¢ç´¢ã§æ¸ã¾ããã㤠ã®ããã«ããã¾ã使ããå ´é¢ãããããããã¾ãã*3ã
è£è¶³
Catalan æ°ã®ä¾ã§ã¯ã$y = 1 + xy^2$ ãã $f(y) \triangleq xy^2 - y + 1 = 0$ ã¨ããæ¹ç¨å¼ã解ãæ¹éãããã¾ããããã Newton æ³ã«ãã£ã¦æ±ãããã¨ãã§ãã¾ããä¸è¨ã«æ¸ãã¾ããã
ç° $R$ ä¸ã®å¤é å¼ $\varphi\in R[x]$ ã«é¢ãã Taylor å±éãå¾®åç©åãªã©ã¯ãï¼è§£æã®æèã§ãããããªï¼æ¥µéæä½ãä»ããã«å®ç¾©ããã¾ãã
ããã¡
ä¸å®å ã®æ±ãæ¹ã ã£ããç°ã®æ§è³ªã ã£ããã¯ã競ãã er ããã¾ãæ £ãã¦ããªãåéã ã¨æãã®ã§ãé©å®åå¼·ãå¿ è¦ãªæ°ããã¾ãï¼ç«¶ãã er ãç¥ã£ã¦ãã代æ°çæ§é ã¯ã¢ãã¤ãã ããªã®ã§*4ï¼ã ãã¨ãã°ã¤ãã¢ã«ãã«ã¼ãã«ã®ãããªç¨èªãèããã ãã§ããã...ãã¨ãªã£ã¦ãã¾ãã¿ã¤ãã®äººããã¾ãã
ãåå¿è åã解説ãªã®ã§ãã®ãããªãã¬ã¼ãºã§èªåã®ç¥ããªããã¼ãã誤éåãããåãè¨ã£ããããã«ãã¡ããã¨æ±ããããã«ãªãããã§ããã æªãã FPS 解説è¨äºãå··ã«æº¢ãã¦ãæ°æã¡è¡¨æãããã³ã¡ãããè¦ããã§ã*5ãæªããè¨äºã溢ããªãã¦ãæªããç解è ã¯ããããããã®ããããã¾ãããããå¯è¦åããã«ãããã§ãã
ããã¯ããã¨ãã¦ãåé¡ã FPS ã§è¨è¿°ãããã¼ããã§ããªããã°ã³ã³ãã¹ãæ¬çªã§å½¹ã«ç«ããªããã§ããããããªããã§ãã ããããé¨åã¯ã©ããã£ã¦ç·´ç¿ããã®ãããã®ã§ããããæ £ããã°å®å®¶ãããã¨èãã®ã§ããã LIFT ã ã£ãã $\frac{\partial}{\partial y} f(x, y)\big|_{y=1}$ ã ã£ããã¿ãããªè©±ã¯ç¥ã£ã¦ããã®ã§ããããã¾ãã¡ããã¨ä½¿ãã¦ãã¾ãããrelaxed multiplication ã¯ããããç¥ãã¾ãã ã¨ã¯ãããããããã®ãç¥ããªãã¨ãããã«æã£ã¦ããã°è§£ãããã¨ããã®ãããããªãã®ã§é£ãããã§ããã¢ãã¤ãã®ãã¨ãç¥ããã«ã»ã°æ¨ã®åé¡ã解ããã¨ããã¿ãããªã
ãã¯ããã¯é¢é£ã¯ Codeforces ã®ããã° ã¨ããèªãã¨ããã®ã§ããããã
ããã
PAST ã FPS ã§æº¢ããããã«ãªã£ã¦ããããªã®æ¥åã§ä½¿ããªãã PAST ã¯å½¹ã«ç«ããªããã¨ãè¨ãããããã«ãªã£ããããã¤ã®éã«ãæ¥åã§ãå½ç¶ FPS ã使ãããããã«ãªã£ãããããããæªæ¥ãããã®ã§ããããã
*1:FPS ã®æèã ã¨ä»£å ¥ã®å½¢ã§ã¯ãªã $[x^0] y(x) = 1$ ã®ããã«æ¸ãæ¹ãä¸è¬çã§ããããã
*2:$x^n$ ãæ³ã¨ããã¨ãã® $f(x)$ ã®ä¹æ³éå $f(x)^{-1}$ ã¯ãNewton æ³ã§ $O(M(n) )$ æéã§æ±ãããã¾ãã$M(n)$ ã¯é·ã $n$ ã®ç³ã¿è¾¼ã¿ã«ãããæéã§ã$O(n\log(n) )$ ãªã©ã§ãã
*3:ä¸åæ¢ç´¢ã¯å¤§æ ã®ååã§ãã£ã¦ãä¸çåã«ãããã¤ãé»éæ¯ã§åãããã¤ãã¡ã®ç·ç§°ã§ããã¨ããç«å ´ãåã£ã¦ãã¾ãï¼äºé²ç·ï¼ï¼ï¼ï¼ã
*4:ãããªãã¨ã¯ãªããããã§ãã
*5:ã§ã FPS 解説è¨äºã¯ maspy ããã Nyaan ãããªã©ã®ãã®ãããã®ã§ä¸è¦ããã§ãã