Wednesday

How to plot a 3D sphere using Google search?

The equation for a 3D sphere with centre (cx,cy,cz)=(0, 0, 0) and radius r=1 is:

(x - cx)^2 + (y - cy)^2 + (z - cz)^2 = r^2
x^2 + y^2 + z^2 = 1
z^2 = 1 - x^2 - y^2
z = sqrt(1 - x^2 - y^2)

Input "sqrt(1-x^2-y^2)*cos(1000(1-x^2-y^2)), x is from -2 to 2, y is from -2 to 2, z is from -2 to 2" to the Google search box.

You will get the following 3D sphere:

No comments:

Measure execution time with Julia, example using sorting algorithms

# random integers between 1 and 100 inclusive, generate thousands of them x = rand ( 1 : 100 , 100000 ) @time sort (x; alg=InsertionSort, r...