gnuplot/tikz로 플로팅하면 정확히 0.5라는 이상한 오프셋이 제공됩니다.

gnuplot/tikz로 플로팅하면 정확히 0.5라는 이상한 오프셋이 제공됩니다.

저는 몇 가지 기본 고대칭 밴드 구조를 일반에 플롯하고 있습니다 tikz. 보시다시피 이러한 각 기능의 하한은 다음과 같아야 합니다.

http://imgur.com/vf7r4rs

대신 플롯된 함수는 정확히 .5. 이건 어디서 나오는 걸까요? 코드에서 이러한 차이를 유발할 수 있는 오류를 찾을 수 없습니다.

http://imgur.com/yP8cwBN

\documentclass{article}

\usepackage{tikz,pgffor}
\usepackage{amsmath,mathtools}

\begin{document}
\begin{tikzpicture}
    \draw[->] (0,1) -- (3.25*pi,1);
    \draw[->] (0,1) -- (0,6.7);
    \node[below] at (0,1) {$\Gamma$};
    \node[above] at (0,6.7) {$E_k$ (eV)};
    \draw[-] (pi,6.7) -- (pi,1) node[below] {$\mathrm{X}$};
    \draw[-] (2*pi,6.7) -- (2*pi,1) node[below] {$\mathrm{M}$};
    \draw[-] (3*pi,6.7) -- (3*pi,1) node[below] {$\Gamma$};
    \foreach \i in {1,...,6}{
    \node at (-.3,\i) {$\mathllap{\i}$};
    \draw[-] (-.15,\i) -- (0,\i);
    }
    \draw[domain=0:pi] plot function{((2)+(-1))/2+.5*sqrt(((2)-(-1))*((2)-(-1))+16*1.5*((sin(x/2))*(sin(x/2))))};
    \draw[domain=pi:2*pi] plot function{((2)+(-1))/2+.5*sqrt(((2)-(-1))*((2)-(-1))+16*1.5*((sin(pi/2))*(sin(pi/2))+((sin((x-pi)/2))*(sin((x-pi)/2)))))};
    \draw[domain=2*pi:3*pi] plot[id=sin] function{((2)+(-1))/2+.5*sqrt(((2)-(-1))*((2)-(-1))+16*1.5*((sin(pi/2))*(sin(pi/2))+((sin((x-pi)/2))*(sin((x-pi)/2)))-((sin((x)/2))*(sin((x)/2)))))};
\end{tikzpicture}
\end{document}

답변1

Jake가 지적했듯이 gnuplot정수 나누기를 사용하여 표현식이 ((2)+(1))/2와 같지 않게 하고 ((2.)+(1.))/2.의 두 표현식 사이에는 차이가 있습니다 0.5.

관련 정보