Smooth the graph $\chi(t)=\sen(\pi t)\exp\left(\dfrac{-1}{\sen^2(\pi t)}\right)$

asymptotegraphicsintegralplottikz-pgf

I am graphing these two functions $$\chi(t)=\sin(\pi t)\exp\left(\dfrac{-1}{\sin^2(\pi t)}\right)$$ and $\rho(t)=\sqrt{\frac{1}{A}\int_0^{t+1}\chi(x)dx}$, where $A=\int_0^1 \chi(x)dx$.

enter image description here

I only succeeded in graphing the first one but I don't get anything smooth, I know that the function $\chi$ is not defined in the integers but it can be fixed by putting $\chi(x)=0$ when x is integer (I don't know how to graph all the function).

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw[-stealth] (-2.5,0) -- (2.5,0) node[below]{$t$};;
\foreach \X in {-2,-1,1,2} {\draw (\X,0.1) -- (\X,-0.1) node[below]{$\X$}; };
\draw[-stealth] (0,-1) -- (0,1) node[left]{$\chi(t)$};

\draw[smooth,domain = -2:2, color=blue] plot(\x,{exp(-1/(sin(deg(\x*pi)))^2)*sin(deg(\x*pi))});
\end{tikzpicture}
\end{document}

Plot:
enter image description here

As you can see in my code I tried to graph it and the error arises from the points of discontinuity that I mentioned above. I would like it to be graphed without errors and also to be smoother, for example look compared to geogebra.

enter image description here

Regarding the second function I have no idea how to graph an integral, I saw some related questions but when compiling I did not get any results. I am sorry if there are errors, I am something new graphing in LaTeX.

Update: I have obtained the $chi(t)$ function, but the code is very long, and for the sake of not distorting the original question, I will put my solution in an answer. Bearing in mind that even though I don't get the $\rpho(t)$ graph, I'm sorry if what I'm doing is wrong.

Best Answer

A try with Asymptote.

Compile on http://asymptote.ualberta.ca/.

Note that test=64 is a lucky number for my computer.

import graph;
size(300,200,false);

real chi(real t)
{
  real a=sin(pi*t);
  return (a != 0) ? a*exp(-1/a^2) : 0;
}
real rho(real t)
{
  return sqrt(simpson(chi,0,t+1)/simpson(chi,0,1));
}

int test=64;
guide g1=graph(chi,0,3.5,300,Spline);
guide g2=graph(rho,0,3.5,test,Spline);
draw(Label("$\chi(t)$",Relative(.4),black),g1,red+0.7bp);
draw(Label("$\rho(t)$",Relative(.12),LeftSide,black),g2,blue+1bp);

xaxis(Label("$x$",position=EndPoint, align=NE), xmin=-0.3, xmax=3.5,
      Ticks(scale(.85)*Label(), NoZero, endlabel=false, Step=0.5,
            end=false, Size=.8mm, pTick=black),
      Arrow);
yaxis(Label("$y$",position=EndPoint, align=NE), ymin=-0.4, ymax=1.2,
      Ticks(scale(.85)*Label(), NoZero, endlabel=false, Step=0.2,
            end=false, Size=.8mm, pTick=black),
      Arrow);

enter image description here