0

I entered

h[x_] := Sqrt[x] + cos x

into the system and then entered

Plot[h[x], {x, -10, 10}]

and it's showing up with plot but with no curve plotted. I've tried scaling up and down the area to be shown, but nothing changes. I've also tried re-entering my function into the system and it's not affecting anything. Is there anything else I can try?

Edit

I changed my original function to

h[x_] := Sqrt[x] + cos[x] 

and it is still not plotting. I also changed my range to {x, 0, 2pi} and that has not affected anything either.

Edit 2

I capitalized the c in cosine and it is now plotting the function. Thank you!

Anna
  • 3
  • 1
  • 4
  • 1
    Your definition should be h[x_] := Sqrt[x] + Cos[x]. The Wolfram Language is case sensitive and the names of all built-in functions begin with capital letters. And {x, 0, 2pi} should be {x, 0, 2 Pi} – m_goldberg Nov 06 '18 at 01:12
  • Possible duplicate: https://mathematica.stackexchange.com/questions/136864/how-to-plot-a-spherical-spiral-in-mathematica – Michael E2 Nov 06 '18 at 01:16
  • 1
    To be expicit: h[x_] := Sqrt[x] + Cos[x]; Plot[h[x], {x, -10, 10}] shows the plot fine. – bill s Nov 06 '18 at 01:19
  • For the possible duplicate-- That's a 3D graph; I'm graphing in 2D – Anna Nov 06 '18 at 01:29
  • Welcome to Mathematica.SE! I suggest the following:
    1. As you receive help, try to give it too, by answering questions in your area of expertise.
    2. Take the [tour] and check the faqs!
    3. When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge.

    Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!

    – Chris K Nov 06 '18 at 01:45
  • 1
    I suggest reading https://mathematica.stackexchange.com/a/18395/121 – Mr.Wizard Nov 06 '18 at 02:19

1 Answers1

4

You need to write Cos[x], not cos x. So, you need to define your function as

h[x_] := Sqrt[x] + Cos[x].

Besides, since the square root of x is only defined for values of $x \geq 0$ you shouldn't expect something for negative values of x.

Sth99
  • 86
  • 4
  • This fixed one problem I had where the NSolve command for this function as equal to zero was actually showing up with an answer and I knew it wasn't supposed to, but the graph is still empty (and I changed my range to 0, 2pi). – Anna Nov 06 '18 at 00:54
  • I didn't notice that you had changed the lowercase c to a capital C, but I have now changed that and it is now plotting. Thank you! – Anna Nov 06 '18 at 01:31