Message Boards Message Boards

GROUPS:

Minimize beats Solve

Posted 1 month ago
577 Views
|
3 Replies
|
3 Total Likes
|

This is the second step in solving a problem Reygan Dionisio posted on LinkedIn

Solve[{res == b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, b > 0}, {a, b,
   k}]

During evaluation := Solve::nsmet: This system cannot be solved with the methods available to Solve.

Solve[{res == b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, b > 0}, {a, b,
   k}]

 MinValue[{ b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, b > 0}, {a, b, 
   k}] // FullSimplify

1 + Sqrt[2]

MaxValue[{ b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, b > 0}, {a, b, 
   k}] // FullSimplify

1 + Sqrt[2]
3 Replies

Frank,

The reason Solve fails is that you have more variables in the equations than you told Solve about. This works (by adding res to the list of variables):

Solve[{res == b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, 
  b > 0}, {a, b, k, res}]

as does this (let Solve figure out the variables):

Solve[{res == b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, 
  b > 0}]

However, the minimize approach runs faster if you know that the minimum is the solution.

Regards,

Neil

MinValue is 100 times faster than Solve

In[6]:= AbsoluteTiming[
 Solve[{res == b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, 
    b > 0}, {a, b, k, res}] // FullSimplify]

Out[6]= {84.9759, {{a -> 9^(ArcSinh[1]/Log[5/3]), 
   b -> 15^(ArcSinh[1]/Log[5/3]), k -> ArcSinh[1]/Log[5/3], 
   res -> 1 + Sqrt[2]}}}

In[2]:= AbsoluteTiming[
 MinValue[{ b/a, a == 9^k, b == 15^k, a + 2 b == 25^k, a > 0, 
    b > 0}, {a, b, k}] // FullSimplify]

Out[2]= {0.399868, 1 + Sqrt[2]}

PositiveReals puts a constraint on every variable. A notebooks is attached with code.

pr

Attachments:
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract