Skip to main content
added 12 characters in body
Source Link
Daniel Huber
  • 56.4k
  • 2
  • 24
  • 66

Using symbols like "n1" makes it complicated. I would rather use indexed symbols like "n[1]" or subscripted symbols.

Clear["Globals`*"]
num = 4;
as = Table[a[i, j], {i, num}, {j, num}]
ns = Table[n[i][t], {i, num}]
Do[n[i]'[t] = r[i] + n[i][t] (1 + as[[i]].ns), {i, num}]

This does define the derivatives:

n[2]'[t]

(* r[2] + n[2][t] (1 + a[2, 1] n[1][t] + a[2, 2] n[2][t] + a[2, 3] n[3][t] + a[2, 4] n[4][t]) *)

n[2]'[t]

(* r[2] + n[2][t] (1 + a[2, 1] n[1][t] + a[2, 2] n[2][t] + a[2, 3] n[3][t] + a[2, 4] n[4][t]) *)

Using subscripted symbols this runs like:

Clear["Globals`*"]
num = 4;
as = Table[Subscript[a, i, j], {i, num}, {j, num}]
ns = Table[Subscript[n, i][t], {i, num}]
Do[Subscript[n, i]'[t] = Subscript[r, i] + Subscript[n, i][t] (1 + as[[i]].ns), {i, num}]

Subscript[n, 2]'[t]

enter image description here

Using symbols like "n1" makes it complicated. I would rather use indexed symbols like "n[1]" or subscripted symbols.

Clear["Globals`*"]
num = 4;
as = Table[a[i, j], {i, num}, {j, num}]
ns = Table[n[i][t], {i, num}]
Do[n[i]'[t] = r[i] + n[i][t] (1 + as[[i]].ns), {i, num}]

This does define the derivatives:

n[2]'[t]

(* r[2] + n[2][t] (1 + a[2, 1] n[1][t] + a[2, 2] n[2][t] + a[2, 3] n[3][t] + a[2, 4] n[4][t]) *)

Using subscripted symbols this runs like:

Clear["Globals`*"]
num = 4;
as = Table[Subscript[a, i, j], {i, num}, {j, num}]
ns = Table[Subscript[n, i][t], {i, num}]
Do[Subscript[n, i]'[t] = Subscript[r, i] + Subscript[n, i][t] (1 + as[[i]].ns), {i, num}]

Subscript[n, 2]'[t]

enter image description here

Using symbols like "n1" makes it complicated. I would rather use indexed symbols like "n[1]" or subscripted symbols.

Clear["Globals`*"]
num = 4;
as = Table[a[i, j], {i, num}, {j, num}]
ns = Table[n[i][t], {i, num}]
Do[n[i]'[t] = r[i] + n[i][t] (1 + as[[i]].ns), {i, num}]

This does define the derivatives:

n[2]'[t]

(* r[2] + n[2][t] (1 + a[2, 1] n[1][t] + a[2, 2] n[2][t] + a[2, 3] n[3][t] + a[2, 4] n[4][t]) *)

Using subscripted symbols this runs like:

Clear["Globals`*"]
num = 4;
as = Table[Subscript[a, i, j], {i, num}, {j, num}]
ns = Table[Subscript[n, i][t], {i, num}]
Do[Subscript[n, i]'[t] = Subscript[r, i] + Subscript[n, i][t] (1 + as[[i]].ns), {i, num}]

Subscript[n, 2]'[t]

enter image description here

Source Link
Daniel Huber
  • 56.4k
  • 2
  • 24
  • 66

Using symbols like "n1" makes it complicated. I would rather use indexed symbols like "n[1]" or subscripted symbols.

Clear["Globals`*"]
num = 4;
as = Table[a[i, j], {i, num}, {j, num}]
ns = Table[n[i][t], {i, num}]
Do[n[i]'[t] = r[i] + n[i][t] (1 + as[[i]].ns), {i, num}]

This does define the derivatives:

n[2]'[t]

(* r[2] + n[2][t] (1 + a[2, 1] n[1][t] + a[2, 2] n[2][t] + a[2, 3] n[3][t] + a[2, 4] n[4][t]) *)

Using subscripted symbols this runs like:

Clear["Globals`*"]
num = 4;
as = Table[Subscript[a, i, j], {i, num}, {j, num}]
ns = Table[Subscript[n, i][t], {i, num}]
Do[Subscript[n, i]'[t] = Subscript[r, i] + Subscript[n, i][t] (1 + as[[i]].ns), {i, num}]

Subscript[n, 2]'[t]

enter image description here