# graphing a cat



## Keroma12 (Dec 17, 2010)

My friend said I couldn't graph a cat with a single equation. It turns out they were wrong 

Here's the equation:


Spoiler



(-810000*x^12*y+9597600*x^10*y^3+986400*x^10*y^2+8447400*x^10*y+48571760*x^8*y^5-12259360*x^8*y^4-111219000*x^8*y^3+2383640*x^8*y^2-14580385*x^8*y+79872704*x^6*y^7-51395904*x^6*y^6-361020096*x^6*y^5-38304128*x^6*y^4+207369756*x^6*y^3-25558524*x^6*y^2+18616706*x^6*y+58829824*x^4*y^9-76537856*x^4*y^8-345700736*x^4*y^7-2083968*x^4*y^6+402754288*x^4*y^5+356618592*x^4*y^4-326825200*x^4*y^3+27076704*x^4*y^2-7086673*x^4*y+19480576*x^2*y^11-47824896*x^2*y^10-103776256*x^2*y^9+73700352*x^2*y^8+196304064*x^2*y^7+836761536*x^2*y^6+457822496*x^2*y^5-425902848*x^2*y^4+125773036*x^2*y^3+5509764*x^2*y^2+803736*x^2*y+2359296*y^13-9437184*y^12+5603328*y^11+33767424*y^10-92371968*y^9+5170176*y^8+88063488*y^7-117190656*y^6-198180288*y^5-88156224*y^4-12859776*y^3)*((4*x^2+8*x+4*y^2+3)^(1/2)*(4*x^2-8*x+4*y^2+3)^(1/2)-(4*x^2+8*x+4*y^2+3)^(1/2)*(4*x^2-8*x+4*y^2+3)^(1/2)+1)*((16*x^4+32*x^2*y^2-8*x^2+16*y^4-8*y^2+1)^(1/2)+4*x^2+4*y^2-1)*((64*x^4+256*x^3+128*x^2*y^2-256*x^2*y+496*x^2+256*x*y^2-512*x*y+480*x+64*y^4-256*y^3+496*y^2-480*y+225)^(1/2)+8*x^2+16*x+8*y^2-16*y+15)*((64*x^4-256*x^3+128*x^2*y^2-256*x^2*y+496*x^2-256*x*y^2+512*x*y-480*x+64*y^4-256*y^3+496*y^2-480*y+225)^(1/2)+8*x^2-16*x+8*y^2-16*y+15)*((7-2*y)^(1/2)*(7-2*x)^(1/2)*(2*x+7)^(1/2)-(7-2*y)^(1/2)*(7-2*x)^(1/2)*(2*x+7)^(1/2)+1)*(36*(x^2+2*x+1)^(1/2)-20*(2*x^2+4*x+2)^(1/2)+10*(2)^(1/2)+3-6*y)*(36*(x^2-2*x+1)^(1/2)-20*(2*x^2-4*x+2)^(1/2)+10*(2)^(1/2)+3-6*y)*(36*(x^2+4*x+4)^(1/2)-10*(5*x^2+20*x+20)^(1/2)+5*(5)^(1/2)+3-6*y)*(36*(x^2-4*x+4)^(1/2)-10*(5*x^2-20*x+20)^(1/2)+5*(5)^(1/2)+3-6*y)*((27*(x^2+4*x+4)^(1/2)+27*x+57+5*(5)^(1/2)-6*y)^(1/2)-(27*(x^2+4*x+4)^(1/2)+27*x+57+5*(5)^(1/2)-6*y)^(1/2)+1)*((27*(x^2-4*x+4)^(1/2)-27*x+57+5*(5)^(1/2)-6*y)^(1/2)-(27*(x^2-4*x+4)^(1/2)-27*x+57+5*(5)^(1/2)-6*y)^(1/2)+1)*((27*(x^2+2*x+1)^(1/2)-21*x-18+10*(2)^(1/2)-6*y)^(1/2)-(27*(x^2+2*x+1)^(1/2)-21*x-18+10*(2)^(1/2)-6*y)^(1/2)+1)*((27*(x^2-2*x+1)^(1/2)+21*x-18+10*(2)^(1/2)-6*y)^(1/2)-(27*(x^2-2*x+1)^(1/2)+21*x-18+10*(2)^(1/2)-6*y)^(1/2)+1)=0



It's tough to find a calculator that will graph this unfortunately 

See 7th post <-- Here's the picture. I didn't crop this at all, this is exactly how it came out. Although the software was bad at filling in solid areas


----------



## Logan (Dec 17, 2010)

picture?


----------



## Keroma12 (Dec 17, 2010)

Logan said:


> picture?


 
I'm having trouble uploading a picture, I should have one up soon.


----------



## ben1996123 (Dec 17, 2010)

Ok, so... what I want to know is... how the f*** did you figure out this equation!?


----------



## y3k9 (Dec 17, 2010)

Ohhhhh, can you break it up into separate equations so it can be graphed on ti 84+?


----------



## CubesOfTheWorld (Dec 17, 2010)

Can't follow the link.


----------



## Keroma12 (Dec 17, 2010)

does this work?


----------



## Toad (Dec 17, 2010)

Haha that's win!


----------



## Sa967St (Dec 17, 2010)

So awesome. I'm curious as to how you figured out the equation too.


----------



## Keroma12 (Dec 17, 2010)

It starts with the idea of a a quadratic in a way. If you have x^2-4x+3=0, then (x-3)(x-1)=0, so x-3=0 and x-1=0, therefore x=1 and x=3 are both solutions. So I just work backwards. If I want to graph the line y=2x+3 and the circle x^2+y^2=4 at the same time, I go 2x+3-y=0 and x^2+y^2-4=0. So (2x+3-y)(x^2+y^2-4)=0. This equation will graph both the line and the circle in one go. So I draw a bunch of circles and elipses and lines to start for the cat.

However, I don't want the whiskers to be everywhere, only for a short line segment. So I have to 'cover them up'. Say you have y=x, which is y-x=0. If I multiply the left side by 1, nothing will happen, right? (1)(y-x)=0 is the same thing. So (A-A+1)(x-y)=0 will also be the same thing, because the As will cancel, always. However, if I make A=sqrt of x, it becomes (sqrtx-sqrtx+1)(x-y)=0. This is the same line y=x, except whenever x<0, you will be taking the sqrt of a negative number, which means that those values of x are not allowed. This makes the domain x>=0. So this equation graphs the part of the line that is in quadrant I only. Basically, you can make these restrictions any shape you want, ie 'covering up' the area inside a circle.

That's the basic idea. What should I graph next?


----------



## StachuK1992 (Dec 17, 2010)

Graph a Rubik's Cube, of course!


----------



## cmhardw (Dec 17, 2010)

Wow, Keroma that is really innovative! I love the method you used to come up with it, as well as the result! Can't wait to see some more of your graphs!


----------



## Keroma12 (Dec 17, 2010)

StachuK1992 said:


> Graph a Rubik's Cube, of course!


 
Of course I'd already thought of that, however I'm not really sure how I'd add color. Another variable? If so, how does that work anyway!? If anybody can tell me how to do this, I'd gladly graph a cube.



cmhardw said:


> Wow, Keroma that is really innovative! I love the method you used to come up with it, as well as the result! Can't wait to see some more of your graphs!


 
Thanks 
I just got bored with the stuff we're doing in school, then gradually came up with these techniques over the course of the last few months. The whole challenge is to do stuff with a single equation. The main problem is that if you cut off the domain for one shape on the graph, you also cut off the domain for other shapes in the graph at the same time. I have never seen anything else even close to this, but even so I doubt my ideas are original.

Oh and I forgot to mention how I made the nose and eyes solid. Say the nose was x^2+y^2=1, and you want to fill it in. Well what you want is x^2+y^2<=1, or x^2+y^2-1<=0. Which means |x^2+y^2-1| = -(x^2+y^2-1). |absolute value of course| ie |-4|=4. Anyway you just set it equal to zero as always: |x^2+y^2-1|+x^2+y^2-1=0. This will graph you a solid circle.

I just realized that I could take this into the 3rd dimension...


----------



## qqwref (Dec 17, 2010)

Very cool, and pretty crazy. What software would you use to graph something like this? I tried typing it into a program I have but I got tired after the first line.

PS: Remember your solid color trick? You could use that to set the domains of certain parts, without using square roots and possibly affecting the domain of the whole function. Watch this:
|x^2+y^2-1|+(x^2+y^2-1) <- 0 inside the circle, positive off the circle
x-y+1 = 0 <- a line
|x-y+1| <- 0 on the line, positive off the line
|x^2+y^2-1|+(x^2+y^2-1)+|x-y+1|=0 <- only true inside the circle AND on the line

PPS: You could graph the Rubik's Cube with 4 (or 7) different graphs, each one of a different color, with one being the lines and the other 3 (or 6 if you draw a scrambled one) being the stickers. I dunno if your graphing program supports that many differently colored functions though.


----------



## spdqbr (Dec 17, 2010)

I know I've seen a site somewhere that will generate an equation for you given a graph. Still hunting for it. In the mean time, this is why you shouldn't graph a cat!

Edit:
Found the one I was thinking of, unfortunately it does not allow for arbitrary pictures. Unfortunately...


----------



## Keroma12 (Dec 17, 2010)

I downloaded this program called 'graph', it was the only thing I could find that would graph this. That's a good idea, opens lots of possibilities!

I knew somebody would have already done this stuff somewhere already. It's really interesting.


----------



## qqwref (Dec 17, 2010)

I'm wondering how much we can do with how little... so far we know:
- We can graph a line, circle, curve, etc. using p(x) = 0.
- We can fill the inside of a closed curve, or fill in one side of a curve, using |p(x)|-p(x) = 0, or sqrt(p(x)^2)-p(x) = 0. Fill the other side by changing that minus to a plus.
- We can find the intersection of a(x) = 0 and b(x) = 0 by writing |a(x)|+|b(x)| = 0, or a(x)^2+b(x)^2 = 0.
- We can find the union of a(x) = 0 and b(x) = 0 by writing a(x)*b(x) = 0.
- Depending on the program, using an expression like sqrt(p(x))^2 will eliminate any part of the xy plane where p(x) < 0.
Anything I'm missing?


----------



## Cool Frog (Dec 17, 2010)

Graph an Alot of graph? This is amazingly impressive.


----------



## souljahsu (Dec 17, 2010)

This is amazing.


----------



## qqwref (Dec 17, 2010)

qqwref said:


> - We can find the intersection of a(x) = 0 and b(x) = 0 by writing |a(x)|+|b(x)| = 0, or a(x)^2+b(x)^2 = 0.


This can be more general. The intersection of a(x) = 0 and b(x) = 0 is a(x)+b(x) = 0, as long as a(x) and b(x) are never negative (on the real plane).

One trick from the inverse graphing calculator: |x-a|+|x-b|-|a-b| is equal to 0 when a<=x<=b; otherwise it's positive. So this is another way to make line segments (by intersecting this with a function defining a line).

Another interesting idea: you can make shading using a sine function. An example function of shading inside a square:
sin^2(20y+20x) + |x-1| + |x-3| + |y-1| + |y-3| - 4 = 0
Some crosshatch shading:
sin^2(20y+20x)sin^2(20y-20x) + |x-1| + |x-3| + |y-1| + |y-3| - 4 = 0


cmowla: I looked at that rose picture but I honestly don't see anything rose-like in it. The other one looks pretty cool though.


----------



## Keroma12 (Dec 18, 2010)

You're really good at this  I'd be interested to take a look at something you might graph.

I'm going to put this aside for a while to start learning M2 for 3BLD now.


----------



## Julian (Dec 18, 2010)

For the different colours of a Rubik's Cube, how about using different gradients, i.e., using different combinations of black and white dots to give the illusion of different shades of grey?


----------



## Kapusta (Dec 19, 2010)

http://xkcd.com/26/


----------

