James Peach
James Peach

Reputation: 69

Mathematica Maximization, Won't maximize a * 0.3

I'm Having a problem maximizing this function in mathematica:

Maximize[a + 0.3 * b, 0 < b < 10, a]

I just get the above back again as output when I run the code, Not helpfull

However when I maximize the equivalent function:

Maximize[a + (3/10) * b, 0 < b < 10, a]

I get a solution?!?

What is going on here? why does mathematica do this?

Upvotes: 0

Views: 228

Answers (1)

Chris Degnen
Chris Degnen

Reputation: 8645

If you compare these results you see that the first one switches to use NMaximize due to 0.3 being Real, whereas the second attempts to solve symbolically using Maximise due to 3/10 being Rational. This accounts for the different behaviour.

enter image description here

Map[Head, {0.3, 3/10}]

{Real, Rational}

Upvotes: 2

Related Questions