TI-89 HomeGames ArchiveTitanium GamesGames How ToProgramsFAQForumTI-89 WikiLinks

Function Passing Help

 
Post new topic   Reply to topic    Your TI-89 Resource Forum Index -> BASIC Programming
Author Message
Negi



Joined: 05 May 2008
Posts: 1

PostPosted: May 5, 2008 1:51 AM    Post subject: Function Passing Help Reply with quote

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,
Code:
rram(x^2,1,3,12)

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
View user's profile Send private message
calc0002



Joined: 01 Oct 2008
Posts: 4

PostPosted: October 3, 2008 9:45 AM    Post subject: Re: Function Passing Help Reply with quote

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,
Code:
rram(x^2,1,3,12)

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
View user's profile Send private message
Display posts from previous:    View previous topic : View next topic  
Post new topic   Reply to topic    Your TI-89 Resource Forum Index -> BASIC Programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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

Contact Us | Privacy Policy | Disclaimer | Trademarks

Copyright ©2006 All rights reserved.


Free Greeting Cards | Girly Myspace Layouts | Myspace Unblocker |