0
|
2996 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

How to write system of differential equations in Mathematica with index?

Posted 2 years ago
 Hello, I am new to Mathematica. I was trying to write a system of differential equations in Mathematica but no success so far. My system is in vector form with index like.. Further, I want to expand x_ n in series form as x_ n=x_ n0 +x_ n1+x_ n2+....... Can someone help me how can I write this? Thanks in advance.
4 Replies
Sort By:
Posted 2 years ago
 This is a way: DSolve[{Subscript[x, 1]'[t] == -Subscript[x, 1][t] + Subscript[x, 2][t], Subscript[x, 2]'[t] == Subscript[x, 1][t] - Subscript[x, 2][t]}, {Subscript[x, 1][t], Subscript[x, 2][t]}, t] 
Posted 2 years ago
 General solution: DSolve[{x1'[t] == -x1[t] + x2[t], x2'[t] == x1[t] - x2[t]}, {x1[t], x2[t]}, t] (*{{x1[t] -> 1/2 E^(-2 t) (1 + E^(2 t)) C[1] + 1/2 E^(-2 t) (-1 + E^(2 t)) C[2], x2[t] -> 1/2 E^(-2 t) (-1 + E^(2 t)) C[1] + 1/2 E^(-2 t) (1 + E^(2 t)) C[2]}}*) Or: A = {{-1, 1}, {1, -1}}; DSolve[x'[t] == A . x[t], x[t] \[Element] Vectors[2], t] (*{{x[t] -> {1/2 E^(-2 t) (1 + E^(2 t)) C[1] + 1/2 E^(-2 t) (-1 + E^(2 t)) C[2], 1/2 E^(-2 t) (-1 + E^(2 t)) C[1] + 1/2 E^(-2 t) (1 + E^(2 t)) C[2]}}}*) Solution by series: AsymptoticDSolveValue[{x1'[t] == -x1[t] + x2[t], x2'[t] == x1[t] - x2[t]}, {x1[t], x2[t]}, {t, 0, 5}] (*{(1 - t + t^2 - (2 t^3)/3 + t^4/3 - (2 t^5)/15) C[ 1] + (t - t^2 + (2 t^3)/3 - t^4/3 + (2 t^5)/15) C[ 2], (t - t^2 + (2 t^3)/3 - t^4/3 + (2 t^5)/15) C[ 1] + (1 - t + t^2 - (2 t^3)/3 + t^4/3 - (2 t^5)/15) C[2]}*) 
Posted 2 years ago
 Thanks for the answer. However, it does not serve my purpose as I want to write x_ n[t] in index form, so that I can apply "For" loop on index "n" and process my set of equations through several operations at the same time. Is there any remedy? Thanks in advance.
Posted 2 years ago
 Another way:  DSolve[{x[1]'[t] == -x[1][t] + x[2][t], x[2]'[t] == x[1][t] - x[2][t]}, {x[1][t], x[2][t]}, t]