0
$\begingroup$

I have a question regarding the minimization of a function, which is a summation of two separate functions, with a discrete list for one of the variables.

$S[a,c]= \sqrt{\sum_{b=0,4,8,12,16}{(f[b]-g[b,c,a])^2}} $


$f[b]$ is linear function with one variable , However $g[b,c,a]$ is a complex number function

and note that there are also constraints, $0<c<1$ and $0<a<5$

My question is, how do I first perform the summation then minimize the function $S[a,c]$ to optimize the variable $a$ and $c$ on the function.

Is there anyway I can used the NMinimize option?

I tried using this built in operator and it gives me an error which says that the objects are of unequal length.

Any help regarding this problem would be appreciated.

$\endgroup$
1
  • $\begingroup$ Hi Jonathan and welcome! To make the most of Mma.SE start by taking the tour now. It will help us to help you if you write an excellent question. Edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$
    – rhermans
    Commented Jul 5, 2018 at 13:31

1 Answer 1

2
$\begingroup$

This not an answer but extended comment. Try something like this.

f[b_] := 2 b - 5
g[b_, c_, a_] := b^2 + 2 c^4 + a^4 + 2
S[a_?NumberQ, c_?NumberQ] := Sqrt[
 Total@Table[(f[b] - g[b, c, a])^2, {b, 0, 16, 4}]]

NMinimize[{S[a, c], 0 < c < 1, 0 < a < 5}, {a, c}]

{269.794, {a -> 0.00163593, c -> 0.00210146}}

$\endgroup$
1
  • $\begingroup$ thanks alot,,, it did solve the problem $\endgroup$ Commented Jul 5, 2018 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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