How to draw a circle in root?

I want to draw a circle by a function, like sqrt(1-xx), how should I write the code?
This is my code and the plot I have drawn:


but when I add sqrt to the function:sqrt(1-x
x), then It willbe a warning,like that

And I also met this question in other code, what should I do to fix it?

Use TEllipse.

You could use a parametric function x(t), y(t) and build a TGraph instead:

(Or use a TGraphPolar ROOT: TGraphPolar Class Reference)

Can you post the code you are running which reproduces your problem ? Screen Shots are not convenient…

Hi,
as already suggested TEllipse is the best solution.
Concerning your code the problem is that you are using the range (-2,2) and when x is larger than 1 or smaller than -1 the sqrt is not defined.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.