1
$\begingroup$

I want to obtain some positive x and y which satisfy the equation

0.01 x^2 - 0.01 x^3 - 0.01 x + 0.01 x^2 + y == 0

I have written:

Solve[0.01 x^2 - 0.01 x^3 - 0.01 x + 0.01 x^2 + y == 0 && x > 0 && y > 0, {x, y}]

But it returns errors:

Solve::svars: Equations may not give solutions for all "solve" variables. >> 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. >>

Where am I doing wrong?

$\endgroup$
1
  • 3
    $\begingroup$ You have received excellent answers below, but nonetheless I think it would be best to point out that, in the future, you should mention exactly what errors you obtain, when you ask a question. This helps those answering the question more appropriately. $\endgroup$
    – MarcoB
    Commented Dec 7, 2015 at 2:47

2 Answers 2

5
$\begingroup$
expr = 0.01 x^2 - 0.01 x^3 - 0.01 x + 0.01 x^2 + y == 0 && x > 0 && y > 0 // 
   Rationalize;

Solve[expr, {x, y}]

(*  Solve::svars: Equations may not give solutions for all "solve" variables. >>  *)

(*  {{y -> ConditionalExpression[
         (1/100)*(x - 2*x^2 + x^3), 
         0 < x < 1 || x > 1]}}  *)

Reduce[expr, {x, y}]

(*  (0 < x < 1 || x > 1) && 
   y == (1/100)*(x - 2*x^2 + x^3)  *)

Use FindInstance for examples of numerical values

FindInstance[expr, {x, y}, Reals, 5]

(*  {{x -> 267/502, 
     y -> 589803/506024032}, 
   {x -> 416, y -> 716456}, 
   {x -> 197, y -> 1891988/25}, 
   {x -> 268, y -> 4776363/25}, 
   {x -> 335/502, 
     y -> 1868563/2530120160}}  *)

And @@ (expr /. %)

(*  True  *)

Or for Integers

FindInstance[expr, {x, y}, Integers, 5]

(*  {{x -> 96, y -> 8664}, 
   {x -> 32761, y -> 351596817936}, 
   {x -> 42225, y -> 752815242816}, 
   {x -> 26800, y -> 192473955468}, 
   {x -> 17256, y -> 51377155914}}  *)

And @@ (expr /. %)

(*  True  *)
$\endgroup$
1
$\begingroup$

If you want only the points then try this:

points = Table[{x /. 
     NSolve[0.01 x^2 - 0.01 x^3 - 0.01 x + 0.01 x^2 + y == 0 && 
        x > 0][[1]], y}, {y, 0, 10, .5}];
ContourPlot[
 0.01 x^2 - 0.01 x^3 - 0.01 x + 0.01 x^2 + y == 0, {x, 0, 10}, {y, 0, 
  10}, Epilog -> Point[points]]

enter image description here

$\endgroup$

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