# Use a variable obtained from a "Solve" in another equation?

Posted 5 months ago
921 Views
|
2 Replies
|
1 Total Likes
|
 Hey everyone, I have been having trouble to plug in a variable and assign its value automatically. Normally I would have to plug it manually but I want my program to run automatically even when I change initial conditions. Here it is an example: - Simplify[Solve[E^5 + E^-5 == Subscript[C, 1] + Subscript[C, 2], Subscript[C, 1]]] - Simplify[Solve[e^5 + e^(-5) == C1 +C2, C1] I want to solve for C1 and then plug that value in another equation but I do not know how to do it automatically.
2 Replies
Sort By:
Posted 5 months ago
 See if this is what you want to do: r1 = Subscript[C, 1] /. Simplify[Solve[E^5 + E^-5 == Subscript[C, 1] + Subscript[C, 2], Subscript[C, 1]]][[1]]  r2 = C1 /. Simplify[Solve[e^5 + e^(-5) == C1 + C2, C1]][[1]]  -r1 - r2 I could do it in just one equation but I chose to do it in two parts so you can see the procedure. Did this help?You can also do: n = Simplify[ Solve[E^5 + E^-5 == Subscript[C, 1] + Subscript[C, 2], Subscript[C, 1]]][[1]]; r1 = Lookup[Association@n, Subscript[C, 1]]