math - How can I solve an equation with two variables where x is maximum? -


lets have equation - x^2+y^2=100 - there's more 1 solution.
want make mathematica 8 give me solution (where natural numbers involved) x maximized (i.e x=10, y=0)
i'm pretty new mathematica - , got confused whats going on...

without diophantine explicit requierment:

maximize[{x , x^2 + y^2 == 100}, {x, y}] (* -> {10, {x -> 10, y -> 0}} *) 

edit

as can see, result 2 elements list. first element (10) value x (the function maximization performed). second element {x -> 10, y -> 0}, corresponding assignment rules variables @ max point.

note here maximizing x, value 10 repeated in both elements, not case, want maximize general function of variables, , not vars themselves.

in particular case, have 2 straightforward ways assign max value of x n:

using first element of list:

n = first@maximize[{x , x^2 + y^2 == 100}, {x, y}]   

or more general, using appropriate rule:

n = x /. last@maximize[{x, x^2 + y^2 == 100}, {x, y}] 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -