TransWikia.com

DSolveValue differential equation list of arbitrary values

Mathematica Asked by ConfusionOverK on March 20, 2021

I have been solving arrays of differential equations, and recently moved to the general case, where my initial conditions are arbitrary constants (either real or complex). However when I moved from using NDSolveValue to DSolveValue the output that is given is unclear to me. If anyone could help clear up my confusion that would be fantastic.

$Assumptions = {Subscript[b, 0] [Element] Reals, 
   Subscript[a, 0] [Element] Reals};

w1 = 1000000;

[Tau] = [Pi]/(w1);

mat = {{0, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 0}};

H = Exp[-t^2/(2*[Tau]^2)] * w1 * mat;

funcs = Array[p[#1, #2][t] &, {4, 4}];

equation = Flatten@Join[Thread[D[funcs, t] == I (funcs.H - H.funcs)]];

f = Table[
   DSolveValue[equation[[i, 1, k]] == equation[[i, 2, k]], 
    funcs[[i, k]], {t, -4*10^-6, 4*10^-6}], {k, 4}, {i, 4}] // MatrixForm
```

One Answer

An extended comment rather than an answer follows.

Reviewing your code after pasting it into a Mathematica notebook, raised some questions.

It does not appear that you have defined t. Nothing wrong with this if you want your code to treat it as a symbol, but my reading of your code leaves your intention unclear.

Note: your use of the following, D[funcs, t] stands as something entirely different.

This raises more questions.

Do you actually want to define funcs as a function, e.g.,

funcs[t] := Array[p[#1, #2][t] &, {4, 4}];,

then recast D[funcs, t] as D[funcs[t], t]?

Doing so would address some issues of the undefined t, but then you still have t undefined in:

H = Exp[-t^2/(2*[Tau]^2)]*w1*mat;

and within:

DSolveValue[ equation[[i, 1, k]] == equation[[i, 2, k]], funcs[[i, k]], {t, -4*10^-6, 4*10^-6}]

Also,

funcs[t] := Array[p[#1, #2][t] &, {4, 4}]

produces the following:

{{p[1, 1][3 + (2 + (1 + x^2)^2)^2], p[1, 2][3 + (2 + (1 + x^2)^2)^2], p[1, 3][3 + (2 + (1 + x^2)^2)^2], p[1, 4][3 + (2 + (1 + x^2)^2)^2]}, {p[2, 1][ 3 + (2 + (1 + x^2)^2)^2], p[2, 2][3 + (2 + (1 + x^2)^2)^2], p[2, 3][3 + (2 + (1 + x^2)^2)^2], p[2, 4][3 + (2 + (1 + x^2)^2)^2]}, {p[3, 1][ 3 + (2 + (1 + x^2)^2)^2], p[3, 2][3 + (2 + (1 + x^2)^2)^2], p[3, 3][3 + (2 + (1 + x^2)^2)^2], p[3, 4][3 + (2 + (1 + x^2)^2)^2]}, {p[4, 1][ 3 + (2 + (1 + x^2)^2)^2], p[4, 2][3 + (2 + (1 + x^2)^2)^2], p[4, 3][3 + (2 + (1 + x^2)^2)^2], p[4, 4][3 + (2 + (1 + x^2)^2)^2]}}

Does this make sense for what you intend?

Finally, best practices in Mathematica avoid defining variables with capital letters. Rather than H = Exp[-t^2/(2*[Tau]^2)]*w1*mat; consider using. h = Exp[-t^2/(2*[Tau]^2)]*w1*mat;

You may have perfectly sound reasons for everything on which I've commented. I only offer the above in in hopes it may help you think through the code and identify issues.

Answered by Jagra on March 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP