TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to plot a function like this

enter image description here

f(x)= (sin(x)^2)*(cos((x/2)^2)) on a tiny bandwidth around 180 degrees

on various tools like PyXPlot, Asymptote and GNUPlot, I'm not expert in any of these but all tools give me almost the same result, the result is inaccurate as at x=180, y=0.I tried to plot with more samples but with no success.

share|improve this question
Many plot programs use radians as default for sine and cosine - in which case your function is not 0 at x=180 - notice the period of your fuction in the above picture corresponds to this. Some programs provide a sind function instead for degrees, otherwise you have to scale x by Pi/180. – Andrew Swann Mar 3 '13 at 11:51
Welcome to TeX.sx! I would use pst-plot. – Marco Daniel Mar 3 '13 at 11:56
up vote 3 down vote accepted

run with xelatex



enter image description here

share|improve this answer

Run with any compiler:


    axis lines*=middle,
\addplot [thick, smooth]  {(sin(x)^2)*(cos((x/2)^2))};
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.