| Author |
Message |
Negi
Joined: 05 May 2008 Posts: 1
|
Posted: May 5, 2008 1:51 AM Post subject: Function Passing Help |
|
|
I have been trying to write a small function to evaluate RRAM really quickly.
| Code: | rram(function,bound1,bound2,iterations)
Func
local delta
((bound2-bound1)/iterations)STO>delta
return Σ(function(bound1+index*delta)*delta,index,1,iterations)
EndFunc |
Unfortunately, there's some problem I'm having with the function parameter. It's not being recognized as a function.
For example,
returns the following error:
| Code: | | Name is not a function or program. |
Does anyone here know how to make it see that the function variable has a function datatype? |
|
| Back to top |
|
 |
calc0002
Joined: 01 Oct 2008 Posts: 4
|
Posted: October 3, 2008 9:45 AM Post subject: Re: Function Passing Help |
|
|
| Negi wrote: | I have been trying to write a small function to evaluate RRAM really quickly.
| Code: | rram(function,bound1,bound2,iterations)
Func
local delta
((bound2-bound1)/iterations)STO>delta
return Σ(function(bound1+index*delta)*delta,index,1,iterations)
EndFunc |
Unfortunately, there's some problem I'm having with the function parameter. It's not being recognized as a function.
For example,
returns the following error:
| Code: | | Name is not a function or program. |
Does anyone here know how to make it see that the function variable has a function datatype? |
Well, if the function you're trying to pass is always going to use x as the independent variable, you can write:
| Code: | rram(function,bound1,bound2,iterations)
Func
local delta
((bound2-bound1)/iterations)STO>delta
return Σ((function|x=(bound1+index*delta))*delta,index,1,iterations)
EndFunc |
This should work. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
Saphic 1.5 // Theme created by Sopel
|
|