Mathematica Differential Equation, help me see whats wrong

Click For Summary
SUMMARY

The discussion revolves around an issue encountered while using Mathematica's NDSolve function to solve a system of differential equations. The user is attempting to model a magnetic pendulum but receives an error stating, "The first argument must have both an equation and an initial condition." The problem arises from the incorrect formatting of the input to NDSolve, specifically the need for a proper structure that includes both equations and initial conditions. The user is advised to ensure that the equations and initial conditions are correctly paired within the NDSolve function.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of differential equations and their initial conditions
  • Knowledge of the NDSolve function in Mathematica
  • Basic concepts of magnetic pendulum dynamics
NEXT STEPS
  • Review the structure of the NDSolve function in Mathematica documentation
  • Learn about the correct formatting of equations and initial conditions in Mathematica
  • Explore examples of solving systems of differential equations in Mathematica
  • Investigate the mathematical principles behind magnetic pendulum dynamics
USEFUL FOR

Mathematica users, physicists, and engineers working on modeling dynamic systems, particularly those interested in solving differential equations related to mechanical systems.

sm1t
Messages
6
Reaction score
0
Basically I am trying to recreate this http://mathforum.org/advanced/robertd/magneticpendulum.html

now my differential equation is
NDSolve[{x''[t] + Rx'[t] - Sum from i=1to3 of (x-x[t])/(rootof(x-x[t])^2 +[y-y[t])^2 +d^2)^3 + Qx[t]==0,
{y''[t] + Ry'[t] - Sum from i=1to3 of (y-y[t])/(rootof(x-x[t])^2 +[y-y[t])^2 +d^2)^3 + Qy[t]==0, x[0]==-.95, y[0]==0.09, x'[0]==0, y'[0]==0}, {x,y}, {t,0,100}, MaxSteps -> 1000]
I have assigned values to R Q and d, and please note than the x's and y's which are not of t, should be subscript i.

I get the error,
"The first argument must have both an equation and an initial condition."

I keep compare my equation to other example equations but I can't see what's wrong.

Any anyone shed any light?

Very much appreciated.
 
Physics news on Phys.org
As far as I can tell, you started off the set of differential equations with an opening { but then re-opened with another {. The form should be NDSolve[{f1(vars),f2(fars)},{vars}...] and so on and so forth.
 

Similar threads

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