Message Boards Message Boards

0
|
4087 Views
|
8 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to declare a list of functions in ODE system solving?

Posted 9 years ago

For instance a ODE system of two unknown functions: x(t_):={x1(t),x2(t)}; DSolve[x'[t]==a.x(t),x(t),t]

Now, suppose that instead of two, I have 1,000,000 unknown functions. How do I write x(t_):={x1(t),x2(t),...,x1000000(t)}?

POSTED BY: Joao Pedro
8 Replies
Posted 9 years ago
x #[t] & /@ Range@3
{x 1[t], x 2[t], x 3[t]}
POSTED BY: Okkes Dulgerci

I don't think that would work as a list of functions

In[5]:= x #[t] & /@ Range@3

Out[5]= {x 1[t], x 2[t], x 3[t]}

In[6]:= InputForm[%]

Out[6]//InputForm=
{x*1[t], x*2[t], x*3[t]}
POSTED BY: Frank Kampas
 ToExpression["x" <> ToString[#] <> "[t]"] & /@ Range[3]

 {x1[t], x2[t], x3[t]}
POSTED BY: Frank Kampas
Posted 9 years ago

Subscript[x, #][t] & /@ Range[3]

Attachments:
POSTED BY: Okkes Dulgerci
In[31]:= x[#][t] & /@ Range[3]

Out[31]= {x[1][t], x[2][t], x[3][t]}
POSTED BY: Frank Kampas
Posted 9 years ago

How about this..

xx[t_]=Table[x[i][t], {i, 3}]
{x[1][t], x[2][t], x[3][t]}
POSTED BY: Okkes Dulgerci
Posted 9 years ago

Worked. Thanks!

POSTED BY: Joao Pedro
In[6]:= xx[t_] = Through[Array[x, 3][t]]

Out[6]= {x[1][t], x[2][t], x[3][t]}
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract