[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Integration with constants?
From: |
John W. Eaton |
Subject: |
Re: Integration with constants? |
Date: |
Sat, 11 Nov 2006 10:16:41 -0500 |
On 11-Nov-2006, Jens Benecke wrote:
| John W. Eaton wrote:
|
| > On 11-Nov-2006, Jens Benecke wrote:
| >
| > | I am trying to integrate a function that has constants previously
| > | defined in the same matlab file. Like this:
| > |
| > | [J2, ier, nf, err] = quad(@(x) log( ...
| > | sqrt(1 + alpha.^2 + 2.*a.pha.*cos(2.*x)) + alpha + cos(2.*x) ),
| > | ...
| > | 0, pi/2, 1e-6)
| > |
| > | "alpha" is a constant that has been calculated before. However, Octave
| > | tells me "error: alpha undefined ..."
| > |
| > What version of Octave are you using? This works in 2.9.9:
|
| > octave:1> a = 2
| > a = 2
| > octave:2> quad (@(x) x + a, 0, 1)
| > ans = 2.5000
|
| Sorry ... 2.1.72, on SuSE Linux.
| I can't upgrade because this is installed on a number of computers and we
| have created multiple custom RPMs for it (it would be a major amount of
| work).
|
| Any way to do this with the 2.1 branch?
In that case, I think the only option is a separate function and
global variables.
jwe