vdinkarz
(ver din)
June 1, 2022, 4:42am
1
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.
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]}*)
vdinkarz
(ver din)
June 1, 2022, 2:25pm
3
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.
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]
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]