0

The below equation gives beautiful graph in desmos. I was trying to find a way to draw this graph using Javascript but for that I first need to express y in terms of x but I am not able to figure out a way, any pointers would be great.

$$y=2x(\sin x)(\cos y)$$

enter image description here

  • What leads you to believe this can be done in a clean fashion? – JMoravitz Nov 29 '21 at 14:09
  • @JMoravitz Yes it's difficult, as I have been trying to figure it out for quite a few hours now. I believe there should be a solution because I can see the graph plotted in desmos as well as in wolfram alpha – Muthukrishnan Nov 29 '21 at 14:11
  • 1
    Those use "implicit plotting" techniques... one example of which would be looking at $f(x,y) = 2x\sin(x)\cos(y)-y$ using a grid of points, categorizing those points according to which had $f(x,y)$ positive, which had $f(x,y)$ negative and coloring the boundary between those respective regions (as well as any points where $f(x,y)$ was identically zero) to draw the graph you see. They did not draw the graphs by solving for $y$. With higher resolution (more points in the grid) you get more accurate looking graphs. – JMoravitz Nov 29 '21 at 14:14
  • @JMoravitz Thanks! I think this is what I was looking for, the word "implicit plotting". I have my answer. – Muthukrishnan Nov 29 '21 at 14:22
  • 1
    https://www.wolframalpha.com/input/?i=ContourPlot%5By+%3D%3D+2+x+Sin%5Bx%5D+Cos%5By%5D%2C+%7Bx%2C+-100%2C+100%7D%2C+%7By%2C+-100%2C+100%7D%5D – Claude Leibovici Nov 29 '21 at 14:35
  • 1
    I prefer this one https://www.wolframalpha.com/input/?i=ContourPlot%5By+%3D%3D+2+x+Sin%5Bx%5D+Cos%5By%5D%2C+%7Bx%2C+-10%2C+10%7D%2C+%7By%2C+-10%2C+10%7D%5D – Claude Leibovici Nov 29 '21 at 14:56
  • @ClaudeLeibovici I prefer it with range between -20, 20 – Muthukrishnan Nov 29 '21 at 16:25

0 Answers0