0

I have a symbolic solution to a linear system with respect to some variables a[i,j] which depend on a parameter t.

sol=Solve[...,Table[a[i,j],{i,0,n},{j,0,n}]]

I would like to make functions from the solutions. Something like

a[i,j][t_]:=a[i,j]/.sol[[1]]

When I do it by hand, everything is fine. But when I try to get it in any loop, like

Do[{a[i, j][t] := a[i, j] /. sol[[1]]}, {i, 0, n}, {j, 0, n}]

it doesn't work.

For example, when I'm trying to look at a[0,1][t] it gives me

a[i,j]

How can one define a family of functions in a loop?

Ivan
  • 235
  • 1
  • 4
  • Use Table rather than Do. – Verbeia Aug 09 '13 at 07:00
  • @verbeia Are you sure this is a simple issue? It seems to me that the OP is not looking for a table of functions, he wants a series of functions defined. From a quick look at the text I'd say the problem lies in the HoldFirst attribute of the SetDelayed function. – Sjoerd C. de Vries Aug 09 '13 at 08:23
  • Well, that's how I read it, but if the post shoud be reopened, I won't object. I just can't help feeling there is a dupe, but I couldn't find it. – Verbeia Aug 09 '13 at 11:28
  • I meant to say HoldAll attribute. If you change := to = it works. This enables evaluation of the RHS. Additionally, in the definition you probably should change t to t_. – Sjoerd C. de Vries Aug 09 '13 at 22:45
  • This might work: (#1[t_] := Evaluate[#2]) & @@@ First[sol]. Hard to be sure without a working example to test it on.. – Michael E2 Aug 10 '13 at 01:59

0 Answers0