Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How to plot sin(x) + sin(y) = 1 in gnuplot?

Writer Emily Wong

I am trying to plot the parametric function sin(x) + sin(y) = 1, but I'm not quite there yet. Here's my script:

set parametric
set urange [-10:10]
set vrange [-10:10]
set sample 2000
set size ratio -1
set grid front
unset border
splot sin(u) + sin(v) = 1

But I get the error: line 10: parametric function not fully specified. What should I do? I want my function plotted as Desmos does it, in the Cartesian coordinate system:

enter image description here

Thank you for your suggestions in advance.

2

1 Answer

sin(x) + sin(y) = 1 is not a parametric equation but an implicit equation. Either you need to do some maths and find a corresponding parametric equation, or you need to resort to a 'trick' which is the one you've probably used in Desmos: gnuplot can plot isolines of functions, so you can plot the isoline 1 of f(x,y)=sin(x) + sin(y).

set cntrparam levels discrete 1
set contour
set view map
unset surface
set isosample 100
splot sin(x)+sin(y)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy