Message Boards Message Boards

0
|
4267 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

how to use subscript here?

I have a numerical solution such as:

In: sol = NSolve[Eqn, Flatten[Array[Subscript[Fc, ##] &, {Ns - 1, Nx}]]]
Out: {{Subscript[Fc, 1, 1] -> 37559.9, Subscript[Fc, 1, 2] -> 18969.8, 
  Subscript[Fc, 1, 3] -> 11399.8, Subscript[Fc, 1, 4] -> 7452.95, 
  Subscript[Fc, 2, 1] -> 22983.4, Subscript[Fc, 2, 2] -> 11693.3, 
  Subscript[Fc, 2, 3] -> 7065.16, Subscript[Fc, 2, 4] -> 4639.3}}

I, then, want to place the values of the solution in another matrix:

In: Fcsol = (Array[Subscript[Fc, ##] &, {Ns - 1, Nx}] /. sol)[[1]]
Out: {{37559.9, 18969.8, 11399.8, 7452.95}, {22983.4, 11693.3, 7065.16, 
  4639.3}}

Finally, my post-solution function requires:

In: Subscript[Fcsol, 2, 1] 
Out: Subscript[{{37559.9, 18969.8, 11399.8, 7452.95}, {22983.4, 11693.3, 
  7065.16, 4639.3}}, 1, 1]

However, it should have resulted in

Out: 37559.9

Could you please help? Thanks.

4 Replies
POSTED BY: Gianluca Gorni

To extract an entry from a matrix the standard way is this: Fcsol[[2,1]] or

Part[Fcsol,2,1]

Subscript is inert by itself. It is designed mainly for display, not for action.

POSTED BY: Gianluca Gorni
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