0
$\begingroup$

I want to restrict the solutions to Solve to the positive reals. This is my code:

bet = 0.001; 
fc1 = (2/8)^2;
fc2 = ((3)/8)^2;   
N1p = N1*(1 - m) + N2*m;
N2p = N2*(1 - m) + N1*m;
b1 = 1 - bet*N1p - fc1;
b2 = 1 - bet*N2p - fc2;

Solve[{N1 == N1p*b1*2, N2 == N2p*b2*2 && N1>0 && 
N2> 0}, {N1, N2}]

I get the error

Solve::eqf: N2>0 is not a well-formed equation. >>.

Even when I try something much simpler like:

Solve[x^2 == 1 && x > 0, x]

which I got from [1]: Defining the domain of positive real numbers, I get the following error message:

Solve::eqf: x>0 is not a well-formed equation. >>

I am not sure what is going on. I am using version 7.0. Thanks in advance!:)

$\endgroup$
3
  • $\begingroup$ Hi! I tried your simple case in Mathematica 8 and Mathematica 10, and it worked in both cases. I also tried the complicated case in Mathematica 10, and it does not seem to complain (given that you rationalize the variable bet). The result is a conditional expression for values of m though, since you have not specified any assumptions for m. $\endgroup$
    – andy269
    Aug 17, 2016 at 15:40
  • 1
    $\begingroup$ Quit kernel, try again? $\endgroup$
    – Feyre
    Aug 17, 2016 at 16:28
  • $\begingroup$ I retried the simple example and still got the same error.. Is it version 7.0 then? Perhaps it is time for an upgrade.. $\endgroup$
    – MathJo
    Aug 18, 2016 at 11:09

1 Answer 1

1
$\begingroup$

I work with mathematica 11.1 You do have to declare the domain of Solve[] as being Reals (v11.1) or PositiveReals(v12). Otherwise Solve[] results in a empty solution.

Solve[{N1 == N1p*b1*2, N2 == N2p*b2*2 && N1>0 && N2> 0}, {N1, N2}, Reals]

In Mathematica 12 you can even declare a domain as PositiveReals appearantly. N1>0 && N2> 0}, {N1, N2}, Reals] works just as well.

See Defining the domain of positive real numbers It is renewed following the arrival of version 12.

it's like andy269 says without "m" being defined you get a lengthy conditional expression on "m" with goes on for nearly 300 lines and starts like this;

 > {{N1 -> ConditionalExpression[
 >Root[1.88672*10^10 m - 1.30514*10^11 m^2 + 2.40049*10^11 m^3 - 
 > 1.63965*10^11 m^4 + (2.45*10^7 - 2.86375*10^8 m + 
 >   1.16991*10^9 m^2 - 1.89913*10^9 m^3 + 
 >     1.14563*10^9 m^4) #1 + (-112000. + 1.004*10^6 m - 
 >     3.336*10^6 m^2 + 4.88*10^6 m^3 - 
 >     2.656*10^6 m^4) #1^2 + (128. - 1024. m + 3072. m^2 - 
 >     4096. m^3 + 2048. m^4) #1^3 &, 1], m > 11.4344], 
 >N2 -> ConditionalExpression[
 >1/(-1. + m)^2 0.0625 (2875. - 6875. m - 
 >   16. m Root[ ect.. ect

You do get a warning in mathematica 11.1.

> Solve::ratnz: Solve was unable to solve the system with inexact
> coefficients. The answer was obtained by solving a corresponding exact
> system and numericizing the result.

I'm not sure what the message means in Mathematica 11.1 and to which coefficients it refers to.

I suppose Solve[] in mathematica 7 was not ready to deal with inexact coefficients and/or variables that are not defined in the independent variable part of the equation (I really have no idea; version 7 is from 2008).

On assigning a value to 'm' say 1/2 or 2 You will get respectively;

 > m=1/2 {{N1 -> 429.565, N2 -> 367.31}}
 > m=2   {{N1 -> 403.528, N2 -> 369.127}}

If that's any help? It works pretty well as long as you define the domain in Solve[]. I have no clue what the calculation is all about. Possibly a binomial chance calculation? I answered this question because it helped me getting an answer to my domain problems concerning Solve[].

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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