Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I want to find the common positive solutions of two polynomials $f_{a,b}(x,y)$, $g_{a,b}(x,y)$ where $a,b$ runs from 0 to 1 with an interval 0.01. Let $(x_0,y_0)$ be a common positive solution. Then I want evaluate a third polynomial $h_{a,b}(x_0,y_0)$. If this value is less than zero, I will change $b$ accordingly.

I have this tried in Mathamatica but could not succeed as follows: b=0 For[$a=0,a<1,a=a+0.01$, Solve[{$x^2$-$ax$+$by$==0, $2xa+y^2-5ab==0$},{$x,y$}]].

share|improve this question

2 Answers 2

First, remember that Solve[] returns its solutions as "rules" of the form {{x -> (*something*), y -> (*something*)}, ...}; what you can then do is {x, y} /. Solve[(*stuff*)] and then use the Select[] function accordingly (by construcing an appropriate test function, perhaps using > or Positive[]), after which you can then substitute into your third expression.

share|improve this answer
1  
To add to Dennis's solution (since I can't comment there), you have the choice of joining together equations and inequalities with || and &&, or collecting them in a list, like Reduce[{x^2 - a x + b y == 0, 2 x a + y^2 - 5 a b == 0, x > 0, y > 0}, {x, y}]. You can then use ToRules[] for postprocessing the output of Reduce[]. Note that it is a good idea to use 1/100 instead of 0.01 as the increment here so that you are working with exact values all throughout. –  Jerry Jun 30 '11 at 6:07

Try the following:

Table[Reduce[ x^2 - a x + b y == 0 && 2 x a + y^2 - 5 a b == 0, {x, y}], {a, 0, 1, 0.01}, {b, 0, 1, 0.01}]

share|improve this answer
    
Ok. Thanks for your help. –  user12290 Jul 23 '11 at 15:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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