Seeking a one-line command (v. 10) to solve for x[s_] and y[s_] in the following equation: 3x+4y=1+5s. The answes are x=-1+3s and y=1-s.
1 Answer
$\begingroup$
$\endgroup$
As stated in the comments there are infinite solutions. Perhaps you are looking for the "minimal" solution?
Minimize [{x^2 + y^2, 3 x + 4 y == 1 + 5 s}, {x, y}] // Simplify
(*{1/25 (1 + 5 s)^2, {x -> 3/25 (1 + 5 s), y -> 4/25 (1 + 5 s)}}*)
sol = First[SolveAlways[3 (a + p s) + 4 (b + q s) == 1 + 5 s, s]]
then choose any b,q you want to find a particular solution. Choosing b==25, q==-64 we have{b -> 25, q -> -64, a -> -33, p -> 87}
. You can then check the result easily withSimplify[3 (a + p s) + 4 (b + q s) /. Join[#, sol /. #] &@{b -> 25, q -> -64}]
$\endgroup$