Jake_Mill22
Jake_Mill22

Reputation: 39

Why won't this Mathematica code maximize?

f[n_] := ((A*n^a)^(1/s) + 
        c*(B*(a*c*(B/A)^(1/s)*n^(1 - (a/s)))^(-(a*s)/(a - s)))^(1/s))^s +
        b*log (1 - n - ((a*c*(B/A)^(1/s)*n^(1 - (a/s)))^(-(a*s)/(a - s))))
        d/dn (f (n))
        d/dn (f[n])
        D[f[n], n]
        solve (D[f[n], n] = 0)
        0
        Solve[D[f[n], n] = 0, n]
        Solve[0, n]
        Maximize[f[n], n]
        Maximize[b log (1 - n - (a (B/A)^(1/s) c n^(1 - a/s))^(-((a s)/(a - s)))) + ((A n^a)^(1/s) 
                     + c (B (a (B/A)^(1/s) c n^(1 - a/s))^(-((a s)/(a - s))))^(1/s))^s, n]

I am not getting anything returning for any of these functions. Any idea why?

Attaching a photo of the mathematica script:

enter image description here

Upvotes: 0

Views: 249

Answers (1)

Alexander Gruber
Alexander Gruber

Reputation: 519

First of all, you're using solve with a lowercase, which is just an undefined variable. To use the function Solve you need to write it with a capital letter. In the same way, you have to write Log with a capital letter, not a lower-case letter, since it's a built in function.

Second, your open parenthesis is not a bracket. Functions in Mathematica require brackets, like Solve[ ... ], not Solve( ).

Third, you're using = instead of ==. The single equals = is used to store variables, the double equals == is used to represent equality.

See if you can get it to work after remedying these errors.

Upvotes: 3

Related Questions