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!

Equation Graphing Difficulties

  1. Nov 29, 2013 #1
    Hi everybody,

    I am having some difficulties graphing this decaying trig function:


    I have checked over the parentheses three times now, and I don't see any errors there. I am assuming I am just timing out the graphing programs, because WolframAlpha is having difficulty, and I don't know how else I can graph this. So does anybody know how I can graph this? Or do you see any errors I have made?
  2. jcsd
  3. Nov 29, 2013 #2
    Is this your function?

    ##\displaystyle \exp\left(at/2000\right) \cdot \left( 10 \cos \left( t \cdot \sqrt{a^2 - 400000000} \right) + 10 \sin \left( t \cdot \sqrt{a^2 - 400000000} \right) \right)##


    ##a = 0.175 (1-y/10)+(y/10-0.001)##

    Your original expression had many superfluous parentheses in it. For example, 1-(y/10) and ^(2). Also, I noticed that Wolfram didn't know how to recognize ()t, once I inputted several * into the expression a result was shown (indicating errors in parentheses). There was one error near the end, that I fixed when rewriting the expression but I don't know what parens it was. Here is what I can use for Wolfram:


    No graph shows up however.
  4. Nov 29, 2013 #3
    Yes! You nailed the equation exactly. Sorry about the extra parentheses, I became used to adding things like ^(2) after I kept getting inaccurate answers because Wolfram misunderstood what I meant. I can't thank you enough for fixing the equation. Do you think Mathematica 9 would plot it? If so, would you know how to input it appropriately?
  5. Nov 29, 2013 #4
    You can actually simplify the expression down further. Using the fact that ##\sin(x) + \cos(x) = \sqrt{2} \sin(x + \pi/4)##, the expression can be rewritten as

    ##\displaystyle 10\sqrt{2} \cdot \exp\left(at/2000\right) \cdot \sin \left( t \cdot \sqrt{a^2 - 400000000} + \pi/4 \right)##

    where a is as defined previously. The sin term is too complex for Wolfram to graph, but you can try it with Mathematica and see if the extra time allowed can plot it. (Wolfram basic only allows so much computation time)

  6. Dec 1, 2013 #5
    I gotcha. Thanks so much for your help, now I just need to learn how to use Mathematica and hopefully I will be good to go!
  7. Dec 1, 2013 #6
    Code (Text):

    In[1]:= a = 0.175*(1 - y/10) + (y/10 - 0.001);
        expr = 10*Sqrt[2]*Exp[a*t/2000]*Sin[t*Sqrt[a^2 - 4*10^8] + Pi/4];
        Plot3D[{Re[expr], Im[expr]}, {t, -10^-4, 10^-4}, {y, -10, 10}]

    Out[3]= ...PlotSnipped...
    expr is HUGE for values of t much bigger than +/- 10^-4. Try
    Code (Text):
    Table[expr, {t, -20, 20, 5}, {y, -1, 1}]
    to see what I mean.
    expr is Complex for many or most values of t.
    The plot is almost unchanged by the range of y until y is beyond +/-10^5.
    Overlaying two plots, one the Real part and the other the Imaginary part,
    and suitably restricting the Plot range lets you see a plot.
    Mathematica is fanatic about correct capitalization and () versus [] versus {} while WolframAlpha doesn't care.
    Mathematica allows you to define functions and assign values to variables while WolframAlpha doesn't.
    Be very very careful to verify that any plot which includes numbers like 400000000 is correct because Plot is not perfect and with wildly large or wildly small numbers it can often show you something that is misleading or simply wrong, increase the range of t in that plot by 10x or 100x and look at the result to see examples of this.
    Getting a graph to be exactly the way you want it to be can take ten times as long as it takes to get the math to be really correct.

    You can get WolframAlpha to plot the Real or Imaginary part, but the line of code is so long that it barely fits within the limits.


    Change the Re to Im at the beginning of that line to see the Imaginary plot.
    Hopefully I haven't broken any of this with copy and paste.
    Test all this very carefully before you depend on any of it.
    Last edited: Dec 1, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Equation Graphing Difficulties
  1. Equation of a graph (Replies: 4)