4
$\begingroup$

I am trying to get ahead of my upcoming semester by visualizing a differential equation of a general ODE solution for falling objects with the given solution of

$$m\frac{{dv}}{{dt}} = mg - \gamma v % MathType!MTEF!2!1!+- % feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyBamaala % aabaGaamizaiaadAhaaeaacaWGKbGaamiDaaaacqGH9aqpcaWGTbGa % am4zaiabgkHiTiabeo7aNjaadAhaaaa!4131! $$

where the solution is

$$v = (\frac{{mg}}{\gamma }) + [vo - (\frac{{mg}}{\gamma })]{e^{ - \frac{{\gamma t}}{m}}} % MathType!MTEF!2!1!+- % feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamODaiabg2 % da9iaacIcadaWcaaqaaiaad2gacaWGNbaabaGaeq4SdCgaaiaacMca % cqGHRaWkcaGGBbGaamODaiaad+gacqGHsislcaGGOaWaaSaaaeaaca % WGTbGaam4zaaqaaiabeo7aNbaacaGGPaGaaiyxaiaadwgadaahaaWc % beqaaiabgkHiTmaalaaabaGaeq4SdCMaamiDaaqaaiaad2gaaaaaaa % aa!4CF7! $$

Where m=mass, g=gravity constant, γ=drag coefficient, v0 is the initial condition, t=time (and is the independent variable)

I would like to create a manipulate and see how different figures for mass, drag, time, vo (maybe?) change the graph or see how the graphs geometrically converge/diverage toward equilibrium solution which is mg/γ but I am not having much success with the manipulate command.

I would appreciate any assistance; I am still getting used to Mathematica.

$\endgroup$
  • 1
    $\begingroup$ What have you tried so far? Can you post the code you’ve attempted for us so we may better help? Also, welcome to mma.SE!!! $\endgroup$ – CA Trevillian Aug 4 at 16:29
4
$\begingroup$

something to get you started. Set the initial height at 100 above the ground. Plot shows how the object height changes

enter image description here

Manipulate[
 data = Table[{i, 
    sol /. {m -> theMass, drag -> theDrag, v0 -> theV0, t -> i}}, {i,0, time, 0.01}];
 ListLinePlot[data, AxesOrigin -> {0, 100}, 
  PlotRange -> {{0, 10}, {0, 200}}, AxesLabel -> {"Time", "y(t)"}, 
  BaseStyle -> 14, PlotStyle -> Red, GridLines -> Automatic, 
  GridLinesStyle -> LightGray]
 ,
 {{theMass, 10, "Mass"}, 0.01, 10, 0.01, Appearance -> "Labeled"},
 {{theDrag, 1, "Drag"}, 0.01, 10, 0.01, Appearance -> "Labeled"},
 {{theV0, 20, "Initial velocity"}, 0, 40, 0.01, 
  Appearance -> "Labeled"},
 {{time, 0.001, "time"}, 0.001, 10, 0.001, Appearance -> "Labeled"},

 TrackedSymbols :> {theMass, theDrag, theV0, time},

 Initialization :> {
   g = -9.81;
   ode = m y''[t] == m g - drag y'[t];
   sol = y[t] /. First@DSolve[{ode, y[0] == 100, y'[0] == v0}, y[t], t]
   }
 ]
$\endgroup$
  • $\begingroup$ Thankyou so much this will definately be a nice start to my ODE studies and help me with a working example as a reference for other mathematical models! $\endgroup$ – HappyHiggs Aug 4 at 16:43
1
$\begingroup$

There is a lot going on in this, especially for a new user, but computers and software seem to have convinced people that they need to build and see things like this and more.

Manipulate[
  sol=v/.DSolve[{m v'[t]==m g-gamma v[t],v[0]==v0},v,t][[1]];
  Plot[sol[t],{t,0,6}],
  {{m,1},0,2},{{g,32},16,64},{{gamma,0},0,1},{{v0,0},-12,12}]

Study the documentation for every part of this and see if you can understand what was the thinking that put this together. You can search for Manipulate and DSolve in the help system and study the examples to see if you can learn how this works. Sometimes clicking on the orange "Details" can provide you with additional information about using a function. You can even search for /. and [[ and == and = to try to understand how each part of this works.

$\endgroup$
  • $\begingroup$ Thankyou. I wanted to upvote you but I don't have as much rep here as I do on the Math stack exchange. haha. I appreciate your insight. I will look into these things. $\endgroup$ – HappyHiggs Aug 4 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.