# Equation Graphing Difficulties

1. Nov 29, 2013

### kyledixon

Hi everybody,

I am having some difficulties graphing this decaying trig function:

((e^(((.175(1-(y/10))+((y/10)-.001))t)/(2000)))(10cos((sqrt(((.175(1-(y/10))+((y/10)-.001))^(2))-400000000))t)+10sin((sqrt(((.175(1-(y/10))+((y/10)-.001))^(2))-400000000))t))

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. Nov 29, 2013

### scurty

$\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)$

where

$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:

exp(t*(0.175*(1-y/10)+(y/10-0.001))/2000)*(10*cos(t*sqrt((0.175*(1-y/10)+(y/10-0.001))^2-400000000))+10*sin(t*sqrt((0.175*(1-y/10)+(y/10-0.001))^2-400000000)))

No graph shows up however.

3. Nov 29, 2013

### kyledixon

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?

4. Nov 29, 2013

### scurty

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)

10*sqrt(2)*e^(a*t/2000)*sin(t*sqrt(a^2-400000000+pi/4))

5. Dec 1, 2013

### kyledixon

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!

6. Dec 1, 2013

### Bill Simpson

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.

http://www.wolframalpha.com/input/?i=Plot3D%5B%7BRe%5B10*Sqrt%5B2%5D*Exp%5Bt*%280.175*%281-y%2F10%29%2B%28y%2F10-0.001%29%29%2F2000%5D*Sin%5Bt*Sqrt%5B%280.175*%281-y%2F10%29%2B%28y%2F10-0.001%29%29%5E2-4*10%5E8%5D%2BPi%2F4%5D%5D%7D%2C%7Bt%2C-10%5E-4%2C10%5E-4%7D%2C%7By%2C-10%2C10%7D%5D

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