Hacker News new | past | comments | ask | show | jobs | submit login
x*sin(y) (google.com)
329 points by callum85 on April 17, 2015 | hide | past | favorite | 87 comments



Search in Google following for Batman:

  2 sqrt(-abs(abs(x)-1)*abs(3-abs(x))/((abs(x)-1)*(3-abs(x))))(1+abs(abs(x)-3)/(abs(x)-3))sqrt(1-(x/7)^2)+(5+0.97(abs(x-.5)+abs(x+.5))-3(abs(x-.75)+abs(x+.75)))(1+abs(1-abs(x))/(1-abs(x))),-3sqrt(1-(x/7)^2)sqrt(abs(abs(x)-4)/(abs(x)-4)),abs(x/2)-0.0913722(x^2)-3+sqrt(1-(abs(abs(x)-2)-1)^2),(2.71052+(1.5-.5abs(x))-1.35526sqrt(4-(abs(x)-1)^2))sqrt(abs(abs(x)-1)/(abs(x)-1))+0.9
link to the same: http://bit.ly/1G0rLgk


Wolfram Alpha does a pretty amazing job of taking an existing graphic and turning back into a graph-able equation... eg:

http://www.wolframalpha.com/input/?i=graph+looks+like+batman

http://www.wolframalpha.com/input/?i=graph+looks+like+bart+s...


I feel like these are special cased, searching for: graph looks like <object> with any random object turns up junk.

Edit: then again it does work with Obama but not with Richard Nixon.



How can one come up with the exact equation to match such an exact drawing? i'm impressed. is it just tons of trial and errors?


Any continuous function can be described as a sum of sinus-functions with different amplitude and frequencies, given that the maximum frequency is limited. Finding these amplitudes can be done quite easily using something called discrete fourier transform. A lot of audio and imaging technology is based on this theory, jpeg compression for example, and almost any audio and signal-processing.


The downside is that very few mathematically interesting functions have limited frequency. While this is not a problem for signal processing, as our senses usually cannot sense the difference, in math it's very easy to see the difference even if you cut off at really high frequencies: http://upload.wikimedia.org/wikipedia/commons/d/d4/Synthesis...

In other words, if one tried to do the Batman curve using Fourier transform, the formula to get sub-pixel consistency would be extremely long.


This is easily solved in practice by segmentation. Images are segmented in blocks, and each small block can be well approximated by a low frequency content, but block boundaries can contain discontinuities. If you look at the wolfram alpha source, that's exactly how those images are constructed -- they are combinations low frequency segments, most likely obtained through fourier analysis.

Another trick used in frequency domain compression is they don't impose a hard cut-off of frequencies (truncation); instead they specify weights according to image quality, and lower are assigned to high frequencies, and those weights control the precision of each frequency.

All this works because real signals happen to be concentrated in certain frequencies, with a few discontinuities in between.


You don't need to do fourier transforms to do this. You can do it yourself and it is quite fun actually. It has been 13 years since I last did it but here is how you start:

1. Have a set of interesting graphs. sin(x), tan(x), log(x), e^x, 1/x, polynomials, hyperbola, sqrt(x)

2. Learn the effects of replacing x with f(x) -> sin(f(x)), log(f(x)), e^f(x). This is IMHO the most fun part. How will sin(1/x) look like? How will log(mod(sqrt(x))) look like?

3. Have a set of 'tricks'. What is the difference between sin(x) and sin(x) - A (ans. it moves the whole graph downward on y-scale). How to create mirror? (ans. take modulus). How to enlarge a graph? (ans. multiply with a constant).

4. Tackle the actual problem, edge by edge.


You can practice that by trying to hit your opponent in Graphwar: http://graphwar.com/play.html


How To Draw Einstein's Face Parametrically http://www.i-programmer.info/projects/119-graphics-and-games...


It's not the plot we deserved but the plot we needed.


Now I challenge you to drop in the Eye of Sauron :)


Wolfram Alpha didn't recognise "Eye of Sauron":

https://www.wolframalpha.com/input/?i=graph+looks+like+Sauro...


Hahaha, this made. my. day.


This was posted here around Valentines day last year

https://www.google.co.uk/search?hl=en&q=5+%2B+%28-sqrt%281-x...


Only works in Chrome.


Works here.

user-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0


It, uh, works in IE.


WFM in Firefox 37.0.1 on Arch Linux.


Works perfectly in Firefox 36.0.1 on Ubuntu


The link doesn't work for me (Firefox). I have to hit Enter in the search box for it to work.


Compare the submitted URL:

    https://www.google.com/?q=x*sin(y)
with:

    https://www.google.com/search?q=x*sin(y)
The resource is still the index page, not /search for the search results page; the query is simply prepopulated.


Chrome here, with the same issue.


I guess, we're flooding the maths-render servers.


lol, I think you're overestimating HN traffic just a bit here.

Adding a hash solves the double enter https://www.google.com/?#q=x*sin(y)


lol, I think he's underestimating the Google server power a bit there

:)


Not sure exactly how it works but if you disconnect from the internet you can still change the x and y ranges and have it redraw so the render is client side.


It uses client-side rendering, WebGL I think.


Quite disappointing on an iPad as well. Just an empty page with some vague error message.


Anyone else feeling left out?

I poked the link on my phone and just got search results (safari). Same thing in mobile chrome even after "request the desktop site". It wasn't until I got to work and saw all of the comments that I figured out what was going on.


iOS (iPhone at least) Safari: go to https://www.google.com/search?q=x*sin(y), tap the address bar, scroll up, and tap Request Desktop Site.


If you're on android chrome, try switching to desktop mode and then press enter if it still doesn't show up. Worked for me.


Same here, Chrome/Ipad :|




now we just need to 3d print those


Or hyperbolic paraboloid, to give it a non-brand name



If any Googler is around, it would be nice if one could do 4d representations as well. (As in 3d that evolves in time, with a slider to go back and forth in time.)


I believe Google will answer "baby steps."

Until then, go and google up that elsewhere.


A great WebGL library giving you this ability: https://news.ycombinator.com/item?id=9395191


For those having issues, adding the hash should do the trick: https://www.google.com/?#q=x*sin(y)


The search doesn't actually find pages with x * sin(y), though. Even on verbatim mode the best it does is x = sin(y).


I like the axes. Those are usually really badly visualized in most 3D plotting software. Just indicate the origin a bit better and we're gold.


While this is nice, I don't like the idea of one company being the one-stop-shop for all of our knowledge.


Our civilization is doomed. Society will fall apart because Google decided to do 3d plots in their search engine.


Next thing you know, someone will be asking how to do it with JQuery.

Not JS, JQuery


You mean WordPress? I want a WordPress with this. It must be responsive and SEO optimized.


They can just Google the answer.


There'll be a plugin eventually.


I don't see it that way. To me, this usage of sharing a math graph is just a Schelling Point.[1]

Twenty years ago, residents had these huge paper phone books. It had the yellow pages listing businesses (the pre-internet version of Yahoo! directory pages). It also had blue pages in the front with all kinds of information: time-of-day phone number, first aid instructions for choking or ingesting poison (along with phone# for poison control center). In Florida, it also had maps with emergency evacuation routes in case of a hurricane. When the phone books expired at the end of the year, they could be repurposed as cheap door stops or booster chairs to feed toddlers. The phone books were something universal that everybody had shared knowledge about. Maybe it seemed like the phone company had a monopoly on disseminating non-phone related information but those books were yesterday's Schelling Point. Society has moved away from them.

I think this method of sharing a url from google is another harmless Schelling Point but I can be convinced otherwise. Monetizing people's curiosity about "x sin(y)" doesn't seem to be much of a threat. Wikipedia and Youtube are other Schelling Points. If I'm curious about an obscure music track; I just go to youtube.com because I'm conditioned to think that somebody somewhere already uploaded it.

Not sure what people expect the alternative should be. Should users who want to share graphs alternate URLs between google.com and wolframalpha.com?[1]

To me, the real threat from Google Inc isn't the Shelling Point aspect but the mountains of behavioral data they collect on users from search + Android location data + Gmail that can be used against them. The data can be misused to discriminate employment to job seekers or deny health insurance for the sick. Google says they don't want to be evil but the temptation to monetize that valuable data seems impossible to resist.

[1] http://en.wikipedia.org/wiki/Focal_point_(game_theory)

[2] https://www.wolframalpha.com/input/?i=x*sin%28y%29


I think it is okay for Google to send you that one answer so that you no longer need to do anymore searching. They scour the web and extract the simple answers that you require. (Google Customer Service: Did you find what you were looking for?) YES!

There are other websites that do this as well, and do it better, but they should be leaping to more complicated stuff once they have "plucked the low hanging fruits" for the establishment of their services.

This is the kind of democratization of knowledge and resource that the open web is all about.


While I share your sentiment, I just finished Randall Stross's Planet Google: One Company's Audacious Plan To Organize Everything We Know, which I found outside Strand Books in NYC.

One of the things I learned from the book, published in 2008, is that Google is a company with a [long view][1], which is a very good thing. We need more companies with long-term views to better our chances of survival as a species.

From the [Longnow Foundation's about page][2], parentheses mine:

> The term (Longnow) was coined by one of our founding board members, Brian Eno. Upon moving to New York City, Brian found that "here" and "now" meant "this room" and "this five minutes" as opposed to the larger here and longer now that he was used to in England. We have since adopted the term as the title of our foundation as we try to stretch out what people consider as now.

[1]: https://investor.google.com/corporate/2004/ipo-founders-lett... "See the 'LONG TERM FOCUS' section. They've done a good job up to now, and hope they continue."

[2]: http://longnow.org/about/


Assume that all information that exists at t = 0 shares more similarity with other information at t = 0, than information at t = other. Then all information that exists in the present observation has a uniform probability of being correct, without having to verify the correctness of the information.

Assume that information is deterministic - in that information has a limit of what it is capable of expressing given enough time.

Assume that information taken at t = 0 and information taken at t = n and t = -n shares similar degrees of complexity, transformation, simplification, mechanical operation. All information moves uniformly.

There are lots of things that already exist in culture that present themselves as fact or truth, when there really isn't any reason to have initialized yourself on agreement when you were first taught it, aside from cultural and societal pressure.

I don't like google, but what google is doing is no different than what anything else does when it creates, alters, and destroys information. The localization of the information doesn't matter, as the transformational functions applied to the information can be universal, random, and chaotic.

In simpler terms, someone at google may implement one way to think, which spreads virally across an entire population, but they may have learned that one way to think from something they learned isolated from civilization on top of a mountain. And they may change it tomorrow, because something seemingly trivial changed, like someone's tone of voice in an otherwise predictable meeting that occurs every Thursday at 2:15 pm. In retrospect, it's still ambiguous as to what has significance and what does not. Patterns are no different from chaos from an objective perspective.


I think it could be argued that the graph of a function isn't actually knowledge... but otherwise I agree there is a potential problem here...


So... what are your opinions on Wikipedia?

Google is a collection of links to the rest of the internet. Popularity and accuracy determine what is shown in the results. It's an aggregate of information and not company-selected&approved information.

If it was the latter, I'd have a larger problem with it.


Wolfram is what's used for more serious queries of this nature, and probably still will be for a long time


Google has done math in the search for a while. It is also my go to place for unit conversions.


But has it always done 3D? I was completely unaware!


apparently before 2013 as shown in this 'google boobs' video: https://www.youtube.com/watch?v=YQjNpFCjfKE



Speaking of which, miles per hour get converted in m/s, which is not very useful


They are both base units of the SI http://en.wikipedia.org/wiki/SI_base_unit


Just tell it the output unit you want.

30 mph in km/h


"3D charts require a web browser and system that support WebGL" :(


Reminds me of Wolfram Alpha.


Can an admin update to this link please (it won't let me change it now):

https://www.google.com/search?q=x*sin(y)


This is kind of unrelated, but when you grab the graph with your mouse and make circles, the whole graph rotates along the line of sight axis. I've noticed this with many 3d things. Why is that?


It's easier to understand if you take the motion of a circle to the extreme: Rotate the graph 90 degrees to the right, then any amount up or down, then 90 degrees back to the left. By rotating 90 degrees first, you changed the axis of the second rotation to be the plane normal (perpendicular) to the view axis, i.e. the view axis itself. If you instead drag in smaller circles, then each rotation only contains a small component of rotating that plane so the rotation is slower.


Thanks for sharing this. Every single day I convince myself that I am not wasting my time by going on HN and posts like these are the reason I find something useful and meaningful. This is something I can share with my 9 year old son who is showing keen interest in Maths. Though the stuff presented here is still pretty advanced for him to grasp, but sharing this will help him immensely to keep pursuing his mathematical interest.

Batman Graph rocks !!



Very nice.

Why have you posted it?


Probably to show us that it's possible. I didn't know Google Search accepted equations.


Note that the search is not even an "equation" (that would be z = x*sin(y) ).

Google always graphed equations -- I often use a google tab like a nice low-memory-footprint version of MATLAB basically -- but I didn't know it assumed the third axis when you created a non-linear expression and made it an equation.


So we all would waste 10 to 20 minutes putting in functions.


Mildly interesting, if you search for:

x * tanh(y)

you get the graph for:

x * ​(exp(​y)-​exp(​‑y))/​(exp(​y)+​exp(​‑y)).

[Edit: asterisks on HN are hard]


JavaScript doesn't have tanh built in, so you have to use an approximate:

http://stackoverflow.com/questions/6118028/fast-hyperbolic-t...


How do you get a page where you can edit the expression graphed?


x*y is more beautiful. It is a perfect hyperbolic surface.


Axis labels? Anybody?


There are labels in the legend associated with axis colors.


So the equation should read red*sin(green)?

The colours are already used for amplitude of the function, using them twice is confusing, akin to using the same variable for two different things.


Giving competition to Wolfram Alpha. Very interesting.


according to the EU this is an antitrust violation?


Oh wow!, just wow!!. Maths FTW!


It would be a B grade third course project if not on the Google SERP.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: