Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4004 > unrolled thread
| Started by | Eli Fenichel <Eli.Fenichel@asu.edu> |
|---|---|
| First post | 2011-07-27 10:19 +0000 |
| Last post | 2011-07-29 08:48 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
getting ride of 0.i Eli Fenichel <Eli.Fenichel@asu.edu> - 2011-07-27 10:19 +0000
Re: getting ride of 0.i Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-07-28 11:56 +0000
Re: getting ride of 0.i Joseph Gwinn <joegwinn@comcast.net> - 2011-07-29 08:48 +0000
| From | Eli Fenichel <Eli.Fenichel@asu.edu> |
|---|---|
| Date | 2011-07-27 10:19 +0000 |
| Subject | getting ride of 0.i |
| Message-ID | <j0oomv$krj$1@smc.vnet.net> |
I am trying to use FindMinimum to minimize the square of a function over many variables (i.e., parameters). The function itself has the potential to generate imaginary numbers and involves numerical integration (the parameter values that minimize the function are real). For clarification the function in evaluated at multiple points so it can be written as vector. By squaring the vector the numerical values of the elements are always real with no imaginary parts. However, Mathematica often writes x + 0.i, where x is a some numerical value, for some of the elements. Typically, this can be ignored, the Chop command can be used, or it simply does not cause problems. However, I keep getting an error: [cid:image003.png@01CC4BBC.E87A0F30] NIntegrate::nlim: "t = Y[1.] is not a valid limit of integration." Y is an array with the parameters to be minimized. However, if evaluate the objective function to be minimized using replacement rules I get x + 0.i. Is there a way for me tell Mathematica to always treat 0.i as 0 and drop it? It seems to be causing problems in the FindMinimum call. Thanks, Eli
[toc] | [next] | [standalone]
| From | Armand Tamzarian <mike.honeychurch@gmail.com> |
|---|---|
| Date | 2011-07-28 11:56 +0000 |
| Message-ID | <j0rips$41r$1@smc.vnet.net> |
| In reply to | #4004 |
On Jul 27, 8:19 pm, Eli Fenichel <Eli.Fenic...@asu.edu> wrote: > I am trying to use FindMinimum to minimize the square of a function over many variables (i.e., parameters). The function itself has the potential to generate imaginary numbers and involves numerical integration (the parameter values that minimize the function are real). For clarification the function in evaluated at multiple points so it can be written as vector. By squaring the vector the numerical values of the elements are always real with no imaginary parts. However, Mathematica often writes x + 0.i, where x is a some numerical value, for some of the elements. > > Typically, this can be ignored, the Chop command can be used, or it simply does not cause problems. However, I keep getting an error: [cid:image003....@01CC4BBC.E87A0F30] > > NIntegrate::nlim: "t = Y[1.] is not a valid limit of integration." > > Y is an array with the parameters to be minimized. > > However, if evaluate the objective function to be minimized using replacement rules I get > x + 0.i. > > Is there a way for me tell Mathematica to always treat 0.i as 0 and drop it? It seems to be causing problems in the FindMinimum call. > > Thanks, > Eli Re[3 + 2 I]
[toc] | [prev] | [next] | [standalone]
| From | Joseph Gwinn <joegwinn@comcast.net> |
|---|---|
| Date | 2011-07-29 08:48 +0000 |
| Message-ID | <j0ts4n$d66$1@smc.vnet.net> |
| In reply to | #4019 |
In article <j0rips$41r$1@smc.vnet.net>, Armand Tamzarian <mike.honeychurch@gmail.com> wrote: > On Jul 27, 8:19 pm, Eli Fenichel <Eli.Fenic...@asu.edu> wrote: > > I am trying to use FindMinimum to minimize the square of a function over > many variables (i.e., parameters). The function itself has the potential > to generate imaginary numbers and involves numerical integration (the > parameter values that minimize the function are real). For clarification > the function in evaluated at multiple points so it can be written as vector. > By squaring the vector the numerical values of the elements are always real > with no imaginary parts. However, Mathematica often writes x + 0.i, where x > is a some numerical value, for some of the elements. > > > > Typically, this can be ignored, the Chop command can be used, or it simply > > does not cause problems. However, I keep getting an error: > > [cid:image003....@01CC4BBC.E87A0F30] > > > > NIntegrate::nlim: "t = Y[1.] is not a valid limit of integration." > > > > Y is an array with the parameters to be minimized. > > > > However, if evaluate the objective function to be minimized using > > replacement rules I get > > x + 0.i. > > > > Is there a way for me tell Mathematica to always treat 0.i as 0 and drop > > it? It seems to be causing problems in the FindMinimum call. > > > > Thanks, > > Eli > > Re[3 + 2 I] It sounds like the "0 I" is in fact a roundoff error times I, such as 10^-18 I. This problem is what Chop[] used for. Chop[x+0 I] will yield x, if roundoff error is in fact the problem. One can tell Chop[] what threshold to use. Joe Gwinn
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web