-2
示例代碼:使用Python正則表達式來簡化乳膠形態的影響乳膠
%Chebyshev of second kind
\begin{equation}
\sum_{\ell \hiderel{=} 0}^n\frac{(\ChebyU{\ell}@{x} )^2}*{ \frac{\pi}{2} }*=\frac{ 2^n }{ \frac{\pi}{2} 2^n+1 }\frac{ \ChebyU{n+1}@{x} \ChebyU{n}@{y} - \ChebyU{n}@{x} \ChebyU{n+1}@{y} }{x-y}
\end{equation}
\frac{(\ChebyU{\ell}@{x})^2}*{\frac{\pi}{2}}
是我期待在這個特定的情況下分數。由於它是另一個分數的分母的一部分,我想用Python正則表達式將其從a/(b/c)
更改爲(ac)/b
。
輸出示例:
%Chebyshev of second kind
\begin{equation}
\sum_{\ell \hiderel{=} 0}^n\frac{(2 \ChebyU{\ell}@{x} )^2}{\pi}*=\frac{ 2^n }{ \frac{\pi}{2} 2^n+1 }\frac{ \ChebyU{n+1}@{x} \ChebyU{n}@{y} - \ChebyU{n}@{x} \ChebyU{n+1}@{y} }{x-y}
\end{equation}
最終結果:\frac{(2\ChebyU{\ell}@{x})^2}{\pi}
是,正則表達式應該導致部分
我怎麼會去用Python與正則表達式這樣做?
對於遲到的回覆感到抱歉,但是謝謝你的工作。 – zara 2015-06-15 15:19:59
不客氣:-) – 2015-06-15 15:26:11