Covert differential equation into a system of 1st order ODE?

Click For Summary

Discussion Overview

The discussion revolves around converting a second-order differential equation into a system of first-order ordinary differential equations (ODEs) and solving it using MATLAB's ode23 or ode45 functions. Participants explore the mathematical formulation and implementation details, including initial conditions and notation.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant presents the second-order differential equation \(x^2 y'' - 2xy' + 2y = 0\) and attempts to convert it into a first-order system, proposing \(X' = AX\) with \(X = [y, z]'\) and \(A = [0, 1; 2/x^2, 2/x]\), but notes that \(x\) in \(A\) complicates the use of MATLAB's dsolve.
  • Another participant points out that steps in the reasoning are missing and questions the notation used, specifically whether the "prime" denotes a derivative or a transpose. They suggest defining \(z\) explicitly.
  • A later reply expresses confidence in their understanding and suggests sharing the solution for the benefit of others facing similar issues.
  • One participant provides a solution using MAPLE, detailing the steps to solve the second-order differential equation and convert it into a system of first-order ODEs, including the initial conditions.
  • The MAPLE solution indicates that the system can be expressed as \( \frac{dy(t)}{dt} = z(t) \) and \( \frac{dz(t)}{dt} = -\frac{2y(t)}{t^2} + \frac{2z(t)}{t} \), with specific initial conditions.
  • Another participant shares MATLAB code to implement the solution using ode45, noting a change in the variable from \(t\) to \(t+1\) in the matrix \(A\).

Areas of Agreement / Disagreement

Participants express varying levels of understanding and approaches to the problem, with some providing solutions while others seek clarification. There is no consensus on a single method or solution.

Contextual Notes

Some participants note missing steps in the reasoning and the potential confusion arising from notation. The dependence on specific definitions and the adjustments made to the equations for MATLAB implementation are also highlighted.

nufeng
Messages
6
Reaction score
0
How to covert this differential equation into a system of one order ODE?
(require covert the equation into a system of 1st-order equations and solve by using ode23 in matlab)

x^2*y''-2*x*y'+2*y = 0;
y(1) = 4; y'(1)=0;
solve for y(x)

I tried to convert it
get

X' = AX
in which
X = [y, z]'
A = [0, 1; 2/x^2, 2/x];

But x exists in A, which cannot solve by dsolve in Matlab.
 
Physics news on Phys.org
You have left out steps in your reasoning.
You are mixing math and MATLAB notation: is the "prime" for derivative or transpose?

Try: $$X=\left [ \matrix{y\\z}\right ]$$ $$X^\prime=AX$$

What did you make ##z## equal to?
 
Simon Bridge said:
You have left out steps in your reasoning.
You are mixing math and MATLAB notation: is the "prime" for derivative or transpose?

Try: $$X=\left [ \matrix{y\\z}\right ]$$ $$X^\prime=AX$$

What did you make ##z## equal to?

Thank you!
I know how to do it.
 
Great to hear!
For the benefit of those poor souls who google to this page off a similar problem, and find my reply too obtuse perhaps you will post the answer?
 
Simon Bridge said:
Great to hear!
For the benefit of those poor souls who google to this page off a similar problem, and find my reply too obtuse perhaps you will post the answer?

solve by MAPLE
first, solve 2nd order differential equation
ode2 := x^2*(diff(f(x), x, x))-2*x*(diff(f(x), x))+2*f(x) = 0
ics2 := (D(f))(1) = 9, f(1) = 4
dsolve([ode2, ics2])
answer is f(x) = 5*x^2-x

convert to a system of 1st ode
sys1ode := diff(y(t), t) = z(t), diff(z(t), t) = -2*y(t)/t^2+2*z(t)/t
ics := y(1) = 4, (D(y))(1) = 9
dsolve([sys1ode, ics])
solution: {y(t) = t*(5*t-1), z(t) = 10*t-1}

My original problem is I want to solve this problem by using ode23 or ode45 in MATLAB,
code:

% subfunction to define the equation
function f = funcENGM801(t,x);
A =[0,1;-2/(t+1)^2,2/(t+1)]; % here I change t to t+1
f = A*x ;

% main function
format longEng
tspan = [0: 0.01: 1];
x0 = [4,9];
[t,x] = ode45('funcENGM801', tspan, x0);
 
Thank you :)
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 52 ·
2
Replies
52
Views
9K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 0 ·
Replies
0
Views
4K