1

I am plotting in 2D on gnuplot through Ubuntu. When defining my equation for 'radius of curvature' a function of theta=x of variables sin and cos functions, respectively, I get an error message saying 'undefined variable: sin' or cos. I am simply defining the variable R=1 in the equation then setting

f(x) = R*sin(x)*(1+4*cos**2*(x)**(1.5)) / 2*(2*sin**2*(x)+3*cos**2*(x))

then saying plot f(x). What am I doing wrong?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
ldcapes
  • 13
  • 2
  • gnuplot does not recognize `cos**2(x)` as meaning `cos(x)**2`. It thinks you are squaring a variable named cos. – Ethan Aug 08 '22 at 05:52

1 Answers1

0

With your function

f(x) = R*sin(x)*(1+4*cos**2*(x)**(1.5)) / 2*(2*sin**2*(x)+3*cos**2*(x))

you should actually get an error undefined variable: cos,

Your intention probably was:

f(x) = R*sin(x)*(1+4*cos(x)**2**(1.5)) / 2*(2*sin(x)**2 + 3*cos(x)**2)

or maybe

f(x) = R*sin(x)*(1+4*cos(x)**2**(1.5)) / (2*(2*sin(x)**2 + 3*cos(x)**2))

where I'm not sure whether in the first part this should really be: cos(x)**2**1.5

or maybe: R*sin(x)*(1+4*cos(x)**2)**1.5

Mind the parentheses.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
theozh
  • 22,244
  • 5
  • 28
  • 72
  • Yes, this is what worked. I realized that the value of the power comes immediately after. Thankyou – ldcapes Aug 09 '22 at 12:24