MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solve[] with inequalities

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122025] Re: [mg121991] Solve[] with inequalities
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 9 Oct 2011 03:53:39 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110080933.FAA21018@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

a) You didn't send values for a or b, so those are not the results we'll  
get.

b) Using the letter l in a variable name (other than the first letter) is  
asking for trouble. Don't do it... particularly if you're also using the  
number 1. I often can't tell them apart, and the same will happen to you,  
someday.

c) b doesn't matter if it isn't zero, since it factors out:

Clear[cl1, ch1, m1, c12, ch2, m2]
D[(a - (w1 + ch2))^2/(4 b) (w1 -
        cl1)^2/((ch1 - cl1) (m1 - cl1)) ((ch2 - cl2)/(ch2 - cl2)),
   w1] // Factor

((a - ch2 + cl1 - 2 w1) (a - ch2 - w1) (cl1 - w1))/(2 b (ch1 -
    cl1) (cl1 - m1))

If b IS zero, you're dividing by zero.

d) Exact parameters often work better than reals:

Clear[cl1, ch1, m1, c12, ch2, m2]
parameters = {cl1 -> 0.2, ch1 -> 0.7, m1 -> 0.65,
    cl2 -> 0.4, ch2 -> 0.5, m2 -> 0.3} // Rationalize

{cl1 -> 1/5, ch1 -> 7/10, m1 -> 13/20, 2/5 -> 2/5, ch2 -> 1/2,
  m2 -> 3/10}

(a would be included in that parameter list, if I knew it.)

e) Combining those ideas:

d = (b D[(a - (w1 + ch2))^2/(4 b) (w1 -
            cl1)^2/((ch1 - cl1) (m1 - cl1)) ((ch2 - cl2)/(ch2 - cl2)),
       w1] // Factor) /. parameters

-(20/9) (-(3/10) + a - 2 w1) (1/5 - w1) (-(1/2) + a - w1)

soln1 = Solve[{d == 0 && w1 > 1/5}, {w1}, Reals,
   VerifySolutions -> True]

{{w1 -> ConditionalExpression[1/2 (-1 + 2 a), a > 7/10]}, {w1 ->
    ConditionalExpression[1/20 (-3 + 10 a), a > 7/10]}}

soln2 = Solve[{d == 0 && w1 > 0}, {w1}, Reals, VerifySolutions -> True]

{{w1 -> ConditionalExpression[1/5,
     3/10 < a < 1/2 || 1/2 < a < 7/10 || a > 7/10 || a < 3/10]}, {w1 ->
     ConditionalExpression[1/2 (-1 + 2 a),
     1/2 < a < 7/10 || a > 7/10]}, {w1 ->
    ConditionalExpression[1/20 (-3 + 10 a),
     3/10 < a < 1/2 || 1/2 < a < 7/10 || a > 7/10]}}

f) How all that plays out for your undisclosed value of a, I cannot guess,  
but interesting things DO happen at certain values:

soln1 /. List /@ Thread[a -> {3/10, 1/2, 7/10}]

{{{w1 -> Undefined}, {w1 -> Undefined}}, {{w1 -> Undefined}, {w1 ->
     Undefined}}, {{w1 -> Undefined}, {w1 -> Undefined}}}

soln2 /. List /@ Thread[a -> {3/10, 1/2, 7/10}]

{{{w1 -> Undefined}, {w1 -> Undefined}, {w1 -> Undefined}}, {{w1 ->
     Undefined}, {w1 -> Undefined}, {w1 -> Undefined}}, {{w1 ->
     Undefined}, {w1 -> Undefined}, {w1 -> Undefined}}}

If a is any of those values, you can expect trouble.

For instance,

Solve[{(d /. a -> 3/10) == 0 && w1 > 1/5}, {w1}, Reals,
  VerifySolutions -> True]

{}

Bobby

On Sat, 08 Oct 2011 04:33:35 -0500, enis <eniskayis at hotmail.com> wrote:

> I have the following problem parameters:
>
> cl1 = 0.2; ch1 = 0.7; m1 = 0.65;
> cl2 = 0.4; ch2 = 0.5; m2 = 0.3;
>
> When I use the call
>
> In[90]:= Solve[{D[(a - (w1 + ch2))^2/(4 b) (w1 - cl1)^2/((ch1 - cl1)
> (m1 - cl1)) ((ch2 - cl2)/(ch2 - cl2)), w1] == 0 && w1 > 0.2}, {w1},
> Reals, VerifySolutions -> True]
>
> I get
> Out[90]= {{w1 -> 0.5}}
>
> But when I use the call
>
> In[91]:= Solve[{D[(a - (w1 + ch2))^2/(4 b) (w1 - cl1)^2/((ch1 - cl1)
> (m1 - cl1)) ((ch2 - cl2)/(ch2 - cl2)), w1] == 0 && w1 > 0.0}, {w1},
> Reals, VerifySolutions -> True]
>
> I get
> Out[91]= {{w1 -> 0.2}, {w1 -> 0.35}, {w1 -> 0.5}}
>
> Clearly, 0.3 is a solution to the first call, but it disappears in the
> first call. Any ideas why? Is this a bug in the code?
>
> Thanks,
>
> Enis.
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: RE: Rank of a matrix depending on a variable
  • Next by Date: Re: Compilation: Avoiding inlining
  • Previous by thread: Solve[] with inequalities
  • Next by thread: Re: = ?