1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Help!

  1. Jun 20, 2010 #1
    Hi, Guys
    Can someone help me about this question?
    I am trying to use Mathematica to plot all the functions: y=k-x/k for all -10<k<10 with interval of 0.1
    what I wrote is like this:
    Plot[Table[k-x/k,{k,-10,10,0.1}],{x,-10,10}]

    However, because the function doesn't have meaning when k=0.

    So how can I type the comment to eliminate k=0
     
  2. jcsd
  3. Jun 20, 2010 #2
    I cheated and tried this: Plot[Table[{k - x/k, -k + x/k}, {k, 1, 10, 1}], {x, -10, 10}]
     
  4. Jun 22, 2010 #3
    You could also try this:
    s1=Plot[Table[k-x/k,{k,0.1,10,0.1}],{x,-10,10}]
    s2=Plot[Table[k-x/k,{k,-10,-0.1,0.1}],{x,-10,10}]
    Show[s1,s2]
    Enjoy!
     
  5. Jun 25, 2010 #4
    HAHA,many thanks for all
    I have just discovered that it's even better if type in:
    Plot[Table[-x/k+k,Cases[{k,-10,10,0.1},Except[0]]],{x,-10,10}]
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook