0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ How do you get two solutions from one equation? $\endgroup$ – anderstood Sep 14 at 21:45
  • 2
    $\begingroup$ @Ninos: There are infinite solutions. You have $$3(a + bs) + 4(c + d s) = 1 + 5s$$ We get $$3 a + 4c = 1 \\ 3b + 4d = 5$$ $c$ and $d$ are free variables - choose whatever you'd like and then solve for $a$ and $b$. $\endgroup$ – Moo Sep 14 at 22:15
  • 2
    $\begingroup$ You can get them with 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 with Simplify[3 (a + p s) + 4 (b + q s) /. Join[#, sol /. #] &@{b -> 25, q -> -64}] $\endgroup$ – flinty Sep 14 at 22:16
  • $\begingroup$ since there are lots of integer u,v satisfied 3u+4v=1,we can set x=(1+5s)u, y=(1+5s)v. For example,we assume u=-1,v=1,so x=-(1+5s),y=1+5s $\endgroup$ – cvgmt Sep 15 at 0:56
1
$\begingroup$

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)}}*)
| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.