# Draw/plot a heart graph

Your challenge is to draw/plot one of the hearts below. The size must be at least 50x50 pixels (vector graphics is OK). You may choose which of the hearts you want to draw/plot. Axes, grid lines etc. are accepted. There must be at least 100 distinct coordinates/points on the graph. The heart can be filled with color if you want to.

The equations are either:

or

$y={cos(t)}^{0.5}\cdot|t|^{0.3}$

t is in the range [-1, 1].

or

or

$r=\frac{sin(t)\sqrt{|cos(t)|}}{sin(t)+\frac{7}{5}}-2sin(t)+2$

This is so the shortest code (in each language) in bytes wins. Please provide the output (or link to an online interpreter).

# TI-80 BASIC, 454341 39 bytes

LBL 1
RAND4-2->X
RAND4-2
IF (X²+ANS²-1)³<X²ANS³
PT-ON(X,ANS
GOTO 1


This took a while, and my battery is low so I didn't want to keep going.

I tried to use the second equation, but couldn't get it to work it actually turned out to be longer, so I just adapted the other answer I had.

EDIT: I just noticed the 50x50 pixel requirement, unfortunately the screen is only 47 pixels high so this isn't possible.

• creative indeed! – dalearn Feb 13 '17 at 17:13
• It's been a while, but can you replace IF (X²+ANS²-1)³-X²ANS³<0 with IF (X²+ANS²-1)³<X²ANS³? – wchargin Feb 15 '17 at 3:58
• Oh, I can't believe I didn't think of that! thanks – 12Me21 Feb 15 '17 at 13:04

## Perl, 86 bytes

$y=1-$_/25,say+map$y**3*($_*=$_/1e3)-($_+$y**2-1)**3>0?$|--?v60:3:$",-40..40for-6..50  Run with perl -E. Plots a filled ASCII heart, using the first equation. Note that the x-axis is stretched by a factor of ~1.265: this is to counteract the fact that terminal fonts are usually much bigger vertically than horizontally. Output:  3<3<3<3<3<3<3< 3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<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<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3 <3<3<3<3<3< 3<3<3<3 <3<3< 3  Explanation (since OP asked for it): condition :=$y**3*($_*=$_/1e3)-($_+$y**2-1)**3>0


This is simply the first equation, slightly rearranged to make it shorter. $y directly represents the y in the formula.$_ is initially proportional to x, but is multiply-assigned with itself ($_*=$_/1e3), making it proportional to x². Since x² is used twice in the formula, this saves a few bytes.

1e3 means 1000, and was picked because it’s short and the result looks good. ** is Perl’s power operator. I use >0 rather than ==0 because I want a filled heart.

flip_flop := $|--?v60:3  v60 is an abuse of the archaic version-string syntax to denote the character with ASCII code 60: '<'.$| is a magical variable that can only ever be 0 or 1. Decrementing when it’s already 0 sets it to 1. Decrementing when it’s 1 naturally sets it to 0. Thus, $|-- is often used as a flip-flop: each time it’s evaluated, it alternates between true and false. As a whole, this expression returns alternatively '<' and 3. inner_loop := <condition> ? <flip_flop> :$"


Nested ternaries. If condition is false (→ we’re outside the heart), evaluates to $", which is a magical variable that defaults to " " (a single space). If condition is true (→ we’re inside the heart), it evaluates flip_flop. outer_loop := say+map <inner_loop> ,-40..40  Evaluates inner_loop repeatedly, with$_ (Perl’s “default” variable) going from -40 to 40, in increments of 1. It collects the results of those evaluation in a temporary list, then prints them all, concatenated, ending with a new line.

$y=1-$_/25, <outer_loop> for-6..50


This runs outer_loop repeatedly, with $y going from 1.24 (1 - (-6 / 25)) to -1 (1 - 50 / 25), in decrements of 0.04. Note that y is divided by 25, while x² is divided by 1000, which is the same as dividing x by sqrt(1000). The ~1.265 factor I mentioned is sqrt(1000) / 25. • Huh, I guess it doesn't violate any rules... My favorite so far :) I'd love an explanation though :) – Stewie Griffin Feb 13 '17 at 17:01 • I'm confused about something. Why use ?v60 over, say, "<"? – Nic Hartley Feb 13 '17 at 21:44 • Same length, but easier to type. – Grimy Feb 14 '17 at 7:39 • A heart made from hearts. – TheWanderer Feb 14 '17 at 12:29 # Mathematica WolframAlpha, 171513 11 bytes Shaved off 2 bytes thanks to Martin Ender (1st heart curve -> heart curve 1) Shaved off another 2 bytes thanks to Martin Ender (heart curve 1 -> heartcurve1) This is probably cheating (the obvious solution), but here goes. heartcurve1  Try it here! I'm sure there's a way to shorten 1st, heart or curve such that Wolfram still accepts it. Well it's free of spaces now, maybe some sort of abbreviation for heart? Do I get bonus points for plotting 2 of them? heartcurves  Try that here! • heart curve 1 – Martin Ender Feb 13 '17 at 13:34 • Actually, heartcurve1 works. – Martin Ender Feb 13 '17 at 13:35 • @MartinEnder What in the world – Thunda Feb 13 '17 at 13:36 • first one of heartcurves looks more like a butt though – Mikhail V Feb 14 '17 at 22:17 • @MikhailV 0th heartcurve (cardoid) looks like a butt. – Thunda Feb 15 '17 at 8:31 ## Mathematica, 52 bytes RegionPlot[(x^2+y^2-1)^3-x^2y^3<0,{x,-2,2},{y,-2,2}]  We could save one more byte with ContourPlot but then the background gets a bit trippy: ContourPlot[(x^2+y^2-1)^3-x^2y^3,{x,-2,2},{y,-2,2}]  For one additional byte we could use the fourth formula and PolarPlot instead: PolarPlot[(x=Sin@t)Abs@Cos@t^.5/(x+7/5)-2x+2,{t,0,7}]  • "A bit trippy" is a bit of an understatement... – Mego Feb 13 '17 at 13:41 • ContourPlot triggers OCD so much. Aaaaaah! :D – KeyWeeUsr Feb 15 '17 at 9:19 # Casio fx-7700GH, 21 bytes sin θ √ Abs cos θ ÷ ( sin θ + 7 ÷ 5 ) - 2 sin θ + 2  Unnamed graph function to be entered into one of the polar coordinate graphing function slots, then does what it says on the tin. The graphing range must be manually set (unless it happens to fit to the current set range), I set it to Xmin=-2.75, Xmax=2.75, Ymin=-4, Ymax=1. Should work on other Casio Power Graphic Series calculators too, and quite possibly later Casio graphic calculators. (yep I'm pretty old and dusty) # MATLAB / Octave, 31 bytes ezplot('(x^2+y^2-1)^3-x^2*y^3')  ## Desmos, 20 16 15 bytes V 2: xx).3y=xx+yy-1 ( = xx)^.3y=xx+yy-1) V 1: xx+yy-1)3=xxy3 V 0: (x2+y2-1)3=x2y3 • you could use xx instead of x^2 – 12Me21 Feb 15 '17 at 14:47 • @12Me21, oh that's excellent, thanks! – Daniel Feb 15 '17 at 15:05 • Your byte count is wrong, you have an extra newline. – Rɪᴋᴇʀ Feb 16 '17 at 21:46 • @Riker, I don't see how it's wrong. Where is there a newline? – Daniel Feb 16 '17 at 21:47 • imgur.com/a/4eTyt V2 is 14 bytes – Rɪᴋᴇʀ Feb 16 '17 at 21:47 # SmileBASIC, 85 81 bytes X=RNDF()*4-2Y=RNDF()*4-2GPSET X*50+99,Y*50+99,-(-X*X*Y*Y*Y>POW(X*X+Y*Y-1,3))EXEC.  # MATL, 36 bytes 1e4t:w/EqXJX,JY,J|Yl**JX,X^J|.3^*&XG  Try it at MATL Online • Tfw MATL solution is longer than MATLAB :) – brainkz Feb 14 '17 at 11:00 # Python, 119 116 bytes from turtle import* from math import* t=1 while-t<1:a=abs(t);c=cos(t);goto(sin(t)*c*log(a)*99,c**.5*a**.3*99);t-=.01  Try it online $y={cos(t)}^{0.5}\cdot|t|^{0.3}$ ## SageMath, 66 bytes polar_plot(sin(x)*abs(cos(x))^.5/(sin(x)+7/5)-2*sin(x)+2,(0,2*pi))  Try it online Unfortunately, the long names of implicit_plot and parametric_plot (plus the need to define a variable other than the implicitly-defined x for the former) make the first three options much too long to be considered. Thanks to busukxuan and Andrea Lazzarotto for a byte • Does ^.5 work in place of **.5? – busukxuan Feb 14 '17 at 3:49 • @busukxuan Nope. Sage is built on Python, and ^ is XOR. – Mego Feb 14 '17 at 5:59 • But sage substitutes ^ with **. I was wondering if it was because it couldn't substitute correctly if followed by a . – busukxuan Feb 14 '17 at 6:03 • @busukxuan Sage uses Python's power notation (**). If you tried to use ^, you'd end up with a warning and an incorrect result. – Mego Feb 14 '17 at 11:14 • @AndreaLazzarotto Then apparently my memory is faulty. Thanks. – Mego Feb 14 '17 at 20:41 # C, 137 133 bytes p;float x,y,f;v(){for(p=4e3;p;x=(float)(p%99-50)/35,y=(float)(p/40-45)/40,f=x*x+y*y-1)putchar(p--%99?f*f*f-x*x*y*y*y<1e-3?35:32:10);}  http://codepad.org/zqqYUui8 Thanks @AlbertRenshaw, I also changed the 100s to 99s for 2 more bytes • +1; I like the use of v for the function, good flair. You can shave two bytes by replacing 4000 with 4e3 and replacing 0.001 with 1e-3 – Albert Renshaw Feb 15 '17 at 3:31 # Jelly, 31 bytes *3× ²+’*3<çị⁾* 25µNr÷21µ²ç@þUY  Try it online! or 35 bytes with a ♥, rather than * fill: change middle line to ²+’*3<ç×9829Ọ»⁶.  ♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥ ♥♥♥ ♥  ### How? Implements: over a 51 by 51 line feed separated grid of characters. *3× - Link 1: y, xSquared *3 - cube y × - multiply the result by xSquared ²+’*3<çị⁾* - Link 2: y, xSquared ² - square y + - add xSquared to the result ’ - subtract one *3 - cube the result < - less than? (1 if True, 0 if False) ç - the result of the last link (1) as a dyad: f(y, xSquared) ị - index into (1-based): ⁾* - the string "* " (there is a trailing space on this line) ×9829Ọ»⁶ - alternative ending of link 2 ×9829 - multiply (vectorises) by 9829 Ọ - cast to character (vectorises) (9829 is the ♥, 0 is the null-byte) » - maximum (vectorises) of that and: ⁶ - space character (ordinal of space is 32, greater than the null-byte, less than ♥) 25µNr÷21µ²ç@þUY - Main link: no arguments 25 - 25 µ - monadic chain separation call that i N - negate i r - inclusive range(negated i, i) -> [-25, -24, ..., 24, 25] ÷21 - divide by 21 (vectorises) -> [-1.1904761904761905, -1.1428571428571428, ..., 1.1428571428571428, 1.1904761904761905] µ - monadic chain separation call that r ² - square r (vectorises) (make the xSquared values, left to right) U - upend r (make the y values, top to bottom) þ - outer product using: ç@ - last link (2) as a dyad with reversed arguments: f(y, xSquared) Y - join with line feeds - implicit print  ## JavaScript (ES6), 151 147 bytes document.write<canvas id=c>;for(i=0;x=2-i/24,i<97;i++)for(j=0;y=2-j/24,z=x*x+y*y-1,j<97;j++)z*z*z-x*x*y*y*y<0&&c.getContext2d.fillRect(i,j,1,1) Edit: Saved 4 bytes thanks to @user2428118. ES7 version for 143 bytes: document.write<canvas id=c>;for(i=0;i<97;i++)for(x=2-i/24,j=0;j<97;j++)x*x*(y=2-j/24)**3-(x*x+y*y-1)**3>0&&c.getContext2d.fillRect(i,j,1,1) • how about y**3 instead of y*y*y ? – svarog Feb 14 '17 at 7:14 • @svarog Thus my note "Would be slightly shorter in ES7"... – Neil Feb 14 '17 at 8:36 • well, it works on chromium 55, so why not add an es7 version ? – svarog Feb 14 '17 at 9:14 • @svarog Because I don't have chromium 55 handy... – Neil Feb 14 '17 at 15:20 • @ThisSuitIsBlackNot It complained about undeclared variables when I tried. – Neil Feb 15 '17 at 18:03 ## Ruby, 80 bytes Show Ruby some love. -2.step(2,0.2){|y|-2.step(2,0.1){|x|$><<'. O'[(y*y-1+x*=x)**3+x*y**3<=>0]};puts}


### Output:

         OOOOO     OOOOO
.OOOOOOOOO.OOOOOOOOO.
OOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOO
.OOOOOOOOOOOOOOOOOOO.
OOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOO
OOOOOOOOOOO
OOOOO
.


with some empty lines above and below

# BBC BASIC, 80

Will finish golfing tomorrow.

ORIGIN99,99F.u=-56TO56x=u/50b=x^2^.33/2r=(b^2-x^2+1)^.5*50L.u,b*50-r,u,r+b*50N.


Draws a filled heart using the first equation, which we rearrange and take the cube root of (there are 3 cube roots of a real number, one real and 2 complex but we only interested in the real root here.) We then rearrange again to get a quadratic in y

x^2+y^2-1=(x^0.66)y

y^2-(x^0.66)y+x^2-1=0


Using the standard quadratic formula for expressions of the type ay^2+by+c=0, and taking advantage of the fact that a=1 we get

y = -b/2 +/- sqrt((b/2)^2-c)

y = -b/2 +/- sqrt((b/2)^2-x^2+1)


where -b/2 = (x^0.66)/2 (represented by b in the program.)

We simply scan through the values of x from left to right, drawing a vertical line between each pair of valid values for y to build up a solid shape.

ORIGIN99,99F.u=-56TO56x=u/50b=x^2^.33/2r=(b^2-x^2+1)^.5*50L.u,b*50-r,u,r+b*50N.


ungolfed

ORIGIN99,99
FORu=-56TO56
x=u/50
b=x^2^.33/2
r=(b^2-x^2+1)^.5*50
LINEu,b*50+r,u,b*50-r
NEXT


## Processing.js: 123 119 bytes

ungolfed:

t = 0;

void setup() {
size(99, 300);
}

void draw() {
point(59+99*sin(t)*cos(t)*log(t),350-400*sqrt(cos(t))*pow(t,0.3));
t+=0.01;
}


golfed:

t=0;void setup(){size(99,300);}void draw(){point(59+99*sin(t)*cos(t)*log(t),350-400*sqrt(cos(t))*pow(t,0.3));t+=0.01;}


this one is quite cheaty as it plots #2 from 0 to infinity instead of from -1 to 1 as shown in the picture to save on the two abs(t). But it's technically correct as there are more than 100 points.

130 bytes "correctier" one

t=-1;void setup(){size(99,300);}void draw(){point(59+99*sin(t)*cos(t)*log(abs(t)),350-400*sqrt(cos(t))*pow(abs(t),0.3));t+=0.01;}


try it online

note : there's probably a way to get 100 points on the default 100x100 canvas and shave the setup off.

• None of your snippets do anything for me on my local version of Processing (except for the second one which just draws 1 point) – Cows quack Feb 13 '17 at 15:34
• have you tried on sketchpad? ("try it online") you need to click "render sketch" – satibel Feb 13 '17 at 15:35
• But I think that would be called "Processing.JS" instead. For the snippet to work for me, you have to use float instead of int – Cows quack Feb 13 '17 at 15:37
• oops, forgot the .js, and thanks to that I saved 4 bytes by removing the useless int. – satibel Feb 13 '17 at 15:41

# TI-84 Basic, 40 38 bytes

Similar to @12Me21's answer & output, but for the TI-83/84 series instead.

While 1:2rand-1→A:2rand-1:If (A²+Ans²-1)³>A²Ans³:Pt-On(A,Ans:End

• Is using Ans actually smaller here? I thought Ans was 2 bytes. – 12Me21 Feb 13 '17 at 16:48
• @12Me21 No, it's the same size, and faster too. (For TI-83/84 at least, I don't know about TI-80). – Timtech Feb 13 '17 at 16:52