3
$\begingroup$

I want to find the numbers $a, b, c, d, m, n, p, q, r$ so that the equation has the form $$ \left |(a x + b) (c x + d)\right | + \left |m x + n\right | + p x^2 + q x + r=0 $$ has six solutions $-5,-3,-1,1,2,3$. I tried

Clear[f, a, b, c, d, m, n, p, q, r]
f[x_] := Abs[(a x + b)* (c x + d)] + Abs[m x + n] + p x^2 + q x + r;
FindInstance[{f[-1] == 0 && f[-5] == 0 && f[-3] == 0 && f[1] == 0 && 
   f[2] == 0 && f[3] == 0 && 1 <= a <= 10 && -100 <= b <= 100 && 
   1 <= c <= 10 && -100 <= d <= 100 && 
   1 <= m <= 10 && -100 <= n <= 100 && -10 <= p <= -1 && -100 <= q <= 
    100 && -50 <= r <= 100 && a > c && a c + p != 0 && 
   c a - p != 0 }, {a, b, c, d, m, n, p, q, r}, Reals]

I got

{{a -> 2, b -> -8, c -> 1, d -> -(23/13), m -> 32/13, n -> 64/13, p -> -(34/13), q -> 118/13, r -> -(240/13)}}

I got the answer about 20 minutes (or longer). How can I decrease the time?

$\endgroup$
7
$\begingroup$

The use of RealAbs instead of Abs in your f[x_] does the job.

Clear[f, a, b, c, d, m, n, p, q, r]
f[x_] := RealAbs[(a x + b)*(c x + d)] + RealAbs[m x + n] + p x^2 + 
 q x + r;FindInstance[{f[-1] == 0 && f[-5] == 0 && f[-3] == 0 && f[1] == 0 && 
f[2] == 0 && f[3] == 0 && 1 <= a <= 10 && -100 <= b <= 100 && 
1 <= c <= 10 && -100 <= d <= 100 && 
1 <= m <= 10 && -100 <= n <= 100 && -10 <= p <= -1 && -100 <= q <=
  100 && -50 <= r <= 100 && a > c && a c + p != 0 && 
c a - p != 0}, {a, b, c, d, m, n, p, q, r}, Reals]//AbsoluteTiming

{30.195,{{a->3/2,b->-(43/8),c->1,d->98/67,m->40685/4288,n->-(56959/4288),p->-(4921/2144),q->27045/4288,r->-(74397/4288)}}}

$\endgroup$

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.