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!

Drawing a picture using math equations

  1. Oct 17, 2009 #1
    Hello everyone,

    I have an assignemnt where I have to use various transformed equations to draw a picture. I will be doing things like restricting the domain to control lengths. I was wondering if there were any computer programs that would plot equations and give me equations for lines so i didnt have to draw them by hand all the time. The functions i will be using are:

    - trig functions (sine, cos tan)
    - polynomial fcns
    - rational functions
    - exponential fcns
    - log fcns

    Remember the program must allow me to restrict domain PER function and graph the above fcns. If there is anything you could recommend id appreciate it, i have a college and university computer system i have access to use, so im sure they have some of the more expensive software.

    Thank you!

    Also, any ideas on what to draw are welcomed! i will post it when im all done with it. :)
  2. jcsd
  3. Oct 17, 2009 #2
    Mathematica does this easily using http://documents.wolfram.com/mathematica/functions/Boole [Broken] if you don't want 0.
    I believe you should be able to do similar work in Maxima using the boolean expressions.
    Last edited by a moderator: May 4, 2017
  4. Oct 17, 2009 #3
    i heard of mathematica ill see if i can give that a try. :)
  5. Oct 17, 2009 #4
    Ok i check the school, they have mathematica V 7.0, although it isnt very easy to learn how to use. Is there an easy way i can imput these graphs and restrict the domain and have it plot all of it on the same graph?

    I learned that i will need to use the command Plot[f, {x, xmin, xmax }]

    where f is the function and x min and max are the restriction on domain, but i dont see a command line to enter it in.
  6. Oct 17, 2009 #5
    Edit: this works and can be edited.
    Plot[2 x, {x, -5, 5}]

    Now i would like to plot several functions with different domain
    Last edited: Oct 17, 2009
  7. Oct 17, 2009 #6
    Suppose you wanted to plot y = 2x with domain [0, 1] and y = 3x with domain [3, 4] on the same graph. You can use the following expression:
    Code (Text):

    Plot[2 x Boole[0 <= x <= 1] + 3 x Boole[3 <= x <= 4], {x, 0, 4}]
    This will plot the expression as one graph on the same plot. In order to get different colors/labels for the two expressions, you will want to use a list of plots:
    Code (Text):

    Plot[{2 x Boole[0 <= x <= 1], 3 x Boole[3 <= x <= 4]}, {x, 0, 4}]
    Browse through the help documentation provided with Mathematica through the help menu. It is quite extensive. Ie., if you highlight a command in the notebook and press F1, the help for that command will open in a new window.
  8. Oct 18, 2009 #7
    Thank you for your help.

    I was trying to add on more to your command.

    Plot[2 x Boole[0 <= x <= 1] + Cos x Boole[-10 <= x <= 10], {x, -10, 10}]

    I added on a 3rd equation which worked but the command above didnt show me the actual graph it showed me the axis but it was empty. I will be doing this with a string of about 20 equations or so, is this the best way to do it?

    Also, I noticed that {x, 0, 4} restricts the size of the x axis, is there a way to do the same with the y, while plotting all these graphs?

    Thanks again.
  9. Oct 18, 2009 #8
  10. Oct 18, 2009 #9
    Perfect! I could not thank you enough, this will do everything i need in an easy manner.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Drawing a picture using math equations
  1. Math, simple equation (Replies: 1)