help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quadrature of funct. with parameters


From: Gorazd Brumen
Subject: Re: quadrature of funct. with parameters
Date: Sat, 18 Mar 2006 13:52:58 +0100
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

Thanks for the info. that did the job. maybe it is just me,
but where is this described in john's book?

regards and thanks again,
g.

address@hidden wrote:
> Hi again.
> 
> With the anonymous function you are creating a function handle that
> is assigned to a variable.  Passing a function as an argument
> with a string is valid only when the function is defined as a
> *real* function.
> 
> Look at this piece of code:
> 
> octave:3> function y=foo(x,a)
> 
>>y=x*a;
>>end
> 
> octave:4> f2=@(x) foo(x,2)
> f2 =
> 
> @(x) foo (x, 2)
> 
> octave:5> f2(4)
> ans = 8
> octave:6> quad(f2,0,2) %you must pass the variable that contains
>                        %the function handle
> ans = 4
> 
> On Fri, Mar 17, 2006 at 08:30:43PM +0100, Gorazd Brumen wrote:
> 
>>Hi Guillem,
>>
>>Yes, actually parameteres can be defined, but i cant get the thing
>>working. If I write
>>
>>f2 = @(x) f1(x,2);
>>f2 (2)
>>f2 (3)
>>quad ('f2',0,1)
>>
>>where f1 is defined in a separate file, than the first three lines work,
>>but the 4th doesnt. Can you give me hint what i am doing wrong?
>>
>>
>>thanks,
>>g.
>>
>>Guillem Borrell Nogueras wrote:
>>
>>>Hi
>>>
>>>Yu can use an anonymous function to reduce the variables if some parameter 
>>>is 
>>>known
>>>
>>>f2= @(x) f(x,2)
>>>
>>>guillem
>>>
>>>On Friday 17 March 2006 14:38, Gorazd Brumen wrote:
>>>
>>>
>>>>Hi all,
>>>>
>>>>Is there a way to do numeric quadrature of a function over
>>>>one variables if the function takes as arguments several parameters,
>>>>i.e. f = f(x,a), and i just want a quadrature over x.
>>>>Aja, and is there a solution not using global variables?
>>>>
>>>>
>>>>thanks a lot,
>>>>G.
>>>
>>>
>>-- 
>>Gorazd Brumen
>>Mail: address@hidden
>>WWW: http://valjhun.fmf.uni-lj.si/~brumen
>>PGP: Key at http://pgp.mit.edu, ID BCC93240
>>
>>
>>
>>-------------------------------------------------------------
>>Octave is freely available under the terms of the GNU GPL.
>>
>>Octave's home on the web:  http://www.octave.org
>>How to fund new projects:  http://www.octave.org/funding.html
>>Subscription information:  http://www.octave.org/archive.html
>>-------------------------------------------------------------
>>
> 
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 
> 

-- 
Gorazd Brumen
Mail: address@hidden
WWW: http://valjhun.fmf.uni-lj.si/~brumen
PGP: Key at http://pgp.mit.edu, ID BCC93240



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]