1
$\begingroup$

I'm trying to solve a system of equations and inequalities with 5 variables but one of them is real, and the other 4 are integer. How could I tell this to Mathematica? I tried using FindInstance[eq && eq && ineq && ineq && eq, {a, b, c, d, e}, Integers] but I don't know how to specify, let's say, e is a real variable.

My particular case is this set of equations:

$\frac{a(a+1) + b^2(c-1)}{d(d+1) + e^2(c-1)} = 1$, $|b|\leq a$, $|e| \leq d$, $a>0$, $d>0$, $c > 0$,

where all variables are integers except from $c$ which is real.

Could you give me some hints?

Thak you!

$\endgroup$
3
  • $\begingroup$ It is unclear what are you ask about. Do you want to solve this problem in general or in your particularly case? $\endgroup$ Apr 10 '20 at 13:57
  • $\begingroup$ I'd like to solve it in my particular case (which I'll write now in my question), but I'm curious about whether there exists or not a way with whch solving it is easy $\endgroup$
    – Pablo
    Apr 10 '20 at 14:53
  • $\begingroup$ See my answer with hints. $\endgroup$ Apr 10 '20 at 15:28
2
$\begingroup$

Hints

Solve[a (a + 1) + b^2 (c - 1) == d (d + 1) + e^2 (c - 1), c]

Out[1]= {{c -> (-a - a^2 + b^2 + d + d^2 - e^2)/(b^2 - e^2)}}

 FindInstance[
 Abs[b] <= a && Abs[e] <= d && d > 0 && 
  a > 0 && (-a - a^2 + b^2 + d + d^2 - e^2)/(b^2 - e^2) > 0, {a, b, d,
   e}, Integers]

Out[4]= {{a -> 8, b -> -2, d -> 8, e -> -4}}

Calculate c

 (-a - a^2 + b^2 + d + d^2 - e^2)/(b^2 - e^2) /. First[%]

Out[5]= 1
$\endgroup$
2
  • 1
    $\begingroup$ Thank you!!! I'll work on that. Thank you very much $\endgroup$
    – Pablo
    Apr 10 '20 at 16:08
  • $\begingroup$ @Patrick You are welcome! $\endgroup$ Apr 10 '20 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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