0
$\begingroup$

enter image description here

I want to know whether or not the objective function I have defined is correct. The nonlinear constraint has to be satisfied while ζ varies from 0 < ζ <= 1/2.

This is the first time I am trying to do optimization with Mathematica. It would be helpful if you would direct me to any documentation that can help me.

ClearAll 
f[β_] := β;
(*Objective function*)
a = 1/(2*β^3); 
eq = 
  a*(((Sin[β*(1 - ζ)]*Sin[β*ζ])/Sin[β]) - ((Sinh[β*(1 - ζ)]*Sinh[β*ζ])/Sinh[β])); 
eq1 = (10^12*eq) + 1;
(*This is the constraint equation*)
NMaximize[f[β_], eq1 == 0]
$\endgroup$
  • 1
    $\begingroup$ Have a look at NMaximize. $\endgroup$ – b.gates.you.know.what Dec 27 '17 at 8:17
  • $\begingroup$ ClearAll f[[Beta]_] := [Beta];(Objective function *) a = 1/(2*[Beta]^3); eq = a*(((Sin[[Beta]*(1 - [Zeta])]*Sin[[Beta]*[Zeta]])/ Sin[[Beta]]) - (( Sinh[[Beta]*(1 - [Zeta])]*Sinh[[Beta]*[Zeta]])/ Sinh[[Beta]])); eq1 = (10^12*eq) + 1;(*This is the constraint equation) NMaximize[f[[Beta]_], eq1 == 0] $\endgroup$ – Vijay Kumar S Dec 27 '17 at 9:07
  • $\begingroup$ But how to define variation of zeta from 0 <zeta<=0.5 $\endgroup$ – Vijay Kumar S Dec 27 '17 at 9:07
  • $\begingroup$ If you add copyable code to your question, rather than an image of an equation, more people might be willing to help out. $\endgroup$ – aardvark2012 Dec 27 '17 at 10:04
  • $\begingroup$ 1) ClearAll is not a Mathematica command and therefore is ignored. 2) Why does your code have a factor of 10^12 that does not appear in the image you originally posted? $\endgroup$ – m_goldberg Dec 27 '17 at 14:38
2
$\begingroup$
f[β_] = β; (*Objective function*)
a = 1/(2*β^3);
eq = a*(((Sin[β*(1 - ζ)]*Sin[β*ζ])/Sin[β]) - ((Sinh[β*(1 - ζ)]*Sinh[β*ζ])/Sinh[β]));
eq1 = (10^12*eq) + 1; (*This is the constraint equation*)

Use the proper syntax as shown in the documentation for NMaximize: "NMaximize[{f, cons}, {x, y,…}] maximizes f numerically subject to the constraints cons."

NMaximize[{f[β], eq1 == 0, 0 < ζ <= 1/2}, {β, ζ}, 
  WorkingPrecision -> 50] // N

(* {3.92685, {β -> 3.92685, ζ -> 0.00015584}} *)

EDIT: "For nonlinear functions, NMaximize may sometimes find only a local maximum."

NMaximize[{f[β], eq1 == 0, 
   0 < ζ <= 1/2}, {{β, 3, 10}, ζ}, WorkingPrecision -> 50] //
  N

(* {7.07025, {β -> 7.07025, ζ -> 0.000364042}} *)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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