Help with Mathematica: Graph Period vs Theta Not

  • Thread starter anonindiv
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses how to graph a function in Mathematica to solve the equation d^2theta/dt^2 + g/lsin(theta)= 0 and shows examples of using DSolve and NDSolve to solve differential equations and plot the results.
  • #1
anonindiv
6
0

Homework Statement


Graph in Mathematica to solve d^2theta/dt^2 + g/lsin(theta)= 0
Show a graph of period vs. Theta not.


Homework Equations





The Attempt at a Solution



I am not very experienced with entering information into mathematica. I am aware that the manipulate plot functions are probably necessary for graphing them, however after watching a number of help videos on mathematica I have failed miserably.

For instance:

Solve[{(d^2 x)/dt^2 - gsin[x] == 0}, {x, g}] is one attempt, and I realize that I mistakenly put a - instead of + sign in.

I have tried using Solve, Plot, Integrate, Dsolve...
I am simply lost.

Could anybody help me with mathematica?

Thanks,
AnonIndiv
 
Physics news on Phys.org
  • #2
Solve just solves "ordinary" equations, for differential equations use DSolve:
Code:
DSolve[x''[t] - g Sin[x[t]] == 0, x, t]
(note that you have to write the function dependence x(t) instead of x everywhere).
 
  • #3
Thanks! That makes considerably more sense. But I'm still not sure how to graph the function...
 
  • #4
I think you need to solve an initial value problem, preferably numerically, then plot the results of that calculation. Tell you what, I'll show you how to do:

[tex]y''+y=0,\quad y(0)=0,\quad y'(0)=1[/tex]

and you figure how to modify it to do yours.

Code:
mysol = NDSolve[{Derivative[2][y][t] + 
           y[t] == 0, y[0] == 0, 
       Derivative[1][y][0] == 1}, y, 
     {t, 0, 2*Pi}]
Plot[y[t] /. mysol, {t, 0, 2*Pi}, 
   PlotRange -> {{0, 2*Pi}, {-5, 5}}]
 
  • #5
Thanks so much everyone!

I think I've mostly figured it out. Turns out there is a very applicable example in the mathematica database. But I rerused it and modified it sort of.

s = NDSolve[{y''[x] + 10*Sin[y[x]] == 0, y[0] == 1, y'[0] == 0},
y, {x, 0, 30}]

and then

Plot[Evaluate[{y[x]} /. s], {x, 0, 30}, PlotStyle -> Automatic].

And you get a nice graph.

Thanks all
 

1. What is Mathematica and how can it help me with graphing?

Mathematica is a computational software program commonly used by scientists and mathematicians to analyze data, create graphs, and perform complex calculations. It has a user-friendly interface and a powerful language that allows for efficient and accurate data analysis and visualization.

2. How can I graph the period vs theta of a function in Mathematica?

To graph the period vs theta of a function in Mathematica, you can use the Plot or ParametricPlot function, depending on the type of graph you want. The period of a function can be found by determining the distance between consecutive peaks or troughs of the graph, and theta represents the angle of rotation or displacement along the x-axis.

3. Can I customize the appearance of my graph in Mathematica?

Yes, there are a variety of options available in Mathematica to customize the appearance of your graph. You can change the color, style, and thickness of the lines, add labels and legends, adjust the axes and ticks, and more. These options can be accessed through the PlotStyle and Frame options in the Plot or ParametricPlot function.

4. Is there a way to export my graph from Mathematica to another file format?

Yes, you can export your graph from Mathematica to various file formats such as PDF, PNG, JPEG, and more. This can be done by using the Export function and specifying the desired file format. You can also adjust the resolution and size of the exported graph.

5. How can I learn more about graphing in Mathematica?

There are many online resources available to help you learn more about graphing in Mathematica. The Wolfram website has a vast collection of tutorials, videos, and documentation on using Mathematica for graphing and data analysis. Additionally, there are online courses and forums where you can interact with other Mathematica users and learn from their experiences and expertise.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
262
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
137
  • Engineering and Comp Sci Homework Help
Replies
4
Views
894
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
389
  • Engineering and Comp Sci Homework Help
Replies
1
Views
825
Back
Top