Help with Mathematica: Graph Period vs Theta Not

  • Thread starter Thread starter anonindiv
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around using Mathematica to graph the relationship between the period and the initial angle (Theta not) for a differential equation related to pendulum motion, specifically the equation d²θ/dt² + g/l sin(θ) = 0. Participants seek assistance with Mathematica functions and methods for solving and plotting the equation.

Discussion Character

  • Homework-related
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant expresses difficulty in using Mathematica for solving the differential equation and mentions confusion about the syntax and functions needed.
  • Another participant suggests using DSolve for solving differential equations instead of Solve, emphasizing the need to correctly express function dependencies.
  • A different participant proposes solving an initial value problem numerically and offers an example to illustrate how to set it up in Mathematica.
  • One participant reports progress in understanding and mentions finding a relevant example in the Mathematica database, which they modified to suit their needs.
  • Participants share specific Mathematica code snippets to assist with the problem, including the use of NDSolve and Plot functions.

Areas of Agreement / Disagreement

There is no explicit consensus on the best approach, but participants generally agree on the need to use numerical methods and specific functions in Mathematica for solving the problem. The discussion reflects a collaborative effort to troubleshoot and refine the approach without resolving all uncertainties.

Contextual Notes

Participants have not fully explored the implications of their solutions or the accuracy of their methods, and there may be limitations in their understanding of the mathematical concepts involved.

Who May Find This Useful

Individuals looking for assistance with Mathematica, particularly in solving differential equations and graphing results, may find this discussion beneficial.

anonindiv
Messages
6
Reaction score
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
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).
 
Thanks! That makes considerably more sense. But I'm still not sure how to graph the function...
 
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:

y''+y=0,\quad y(0)=0,\quad y'(0)=1

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}}]
 
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
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K