Group Abstract Group Abstract

Message Boards Message Boards

[?] Get equation solutions via Table (list)?

Posted 8 years ago

Dear All,

Here is my simple Mathematica code:

solut = Flatten[
  Table[sol[a_, b_, c_] = Solve[a*y == 3 + b/c, y], {a, 1, 3, 1}, {b, 
    1, 2, 1}, {c, 1, 2, 1}]]
{y -> 4, y -> 7/2, y -> 5, y -> 4, y -> 2, y -> 7/4, y -> 5/2, y -> 2,
  y -> 4/3, y -> 7/6, y -> 5/3, y -> 4/3}

I can see that the 6th element of the resulting list is y = 7/4 (y -> 7/4). I am interested in the value of that 6th element (7/4). How do I get the values of a, b, and c that led to y = 7/4 as a solution (i.e., the value of y at the 6th element)? I know that it happens when a=2, b=1, c=2, but how do I get these a, b, c values if I do not know those values a priori? I am sorry if my writings are not readable. So, just in case I attach a file here.

Thank you.

Attachments:
POSTED BY: Alex Token
2 Replies
Posted 8 years ago

Try this

solut = Flatten[Table[Flatten[{a,b,c,y/.Solve[a*y==3+b/c,y]}],{a,1,3,1},{b,1,2,1},{c,1,2,1}],2]

followed by

solut[[6]]

which gives

{2, 1, 2, 7/4}
POSTED BY: Bill Simpson
Posted 8 years ago

Thank you so much.

POSTED BY: Alex Token
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard