Message Boards Message Boards

0
|
3240 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

What's the best way to find a set of constants minimizing a given equation

Posted 9 years ago

Hi,

I have a formula for a 3d vector field u(x,y,z) given by

{-((I Tanh[y C[2] + z C[3] - (x Sqrt[1 - 2 C[2]^2 - 2 C[3]^2])/Sqrt[2] + C[4]])/Sqrt[2]), 
-((Sqrt[3 - 2 C[7]^2] Tanh[y C[2] + z C[3] - (x Sqrt[1 - 2 C[2]^2 - 2 C[3]^2])/Sqrt[2] + C[4]])/Sqrt[2]), 
 C[7] Tanh[y C[2] + z C[3] - (x Sqrt[1 - 2 C[2]^2 - 2 C[3]^2])/Sqrt[2] + C[4]]}

and I want to find the set of constants (C[2], C[3], C[4], C[7]) which will minimize the squared difference between this function and a given target function of the form

{x,y,z}/Sqrt[x^2+y^2+z^2]*Tanh[Sqrt[x^2+y^2+z^2]/2]

Only real solutions are of interest to me. Can someone help me out on how to do this kind of thing in Mathematica ?

POSTED BY: xort dsc

Try using NMinimize:

http://reference.wolfram.com/language/ref/NMinimize.html

Or try using the FindMinimum function:

http://reference.wolfram.com/language/ref/FindMinimum.html

The first step is to define the function you're trying to minimize. From the context above I can't tell, but it's probably something like

Integrate[(f[parameters]-curve)^2, {x,a,b},{y,a,b},{z,a,b}]

Where "f" is the curve with your parameters and "curve" is the curve you're trying to get it close to.

Notice that "f" and "curve" are 3-vectors. You need them to be a scalar quantity. When you minimize something, you minimize a scalar value. You could chose for example to minimize the magnitude of the vector. That is a common choice.

POSTED BY: Sean Clarke
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