Click here to Skip to main content
15,904,877 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: To Michael Dunn Pin
Bob Stanneveld24-Sep-04 0:08
Bob Stanneveld24-Sep-04 0:08 
GeneralRe: To Michael Dunn Pin
Antony M Kancidrowski24-Sep-04 3:38
Antony M Kancidrowski24-Sep-04 3:38 
QuestionWhere and when to initialize them? Pin
Guoguor23-Sep-04 15:09
Guoguor23-Sep-04 15:09 
AnswerRe: Where and when to initialize them? Pin
Michael Dunn23-Sep-04 15:15
sitebuilderMichael Dunn23-Sep-04 15:15 
GeneralHelp writing a function Pin
NietzscheDisciple23-Sep-04 12:11
NietzscheDisciple23-Sep-04 12:11 
GeneralRe: Help writing a function Pin
Ravi Bhavnani23-Sep-04 12:35
professionalRavi Bhavnani23-Sep-04 12:35 
GeneralRe: Help writing a function Pin
NietzscheDisciple23-Sep-04 12:44
NietzscheDisciple23-Sep-04 12:44 
GeneralRe: Help writing a function Pin
Ravi Bhavnani23-Sep-04 13:31
professionalRavi Bhavnani23-Sep-04 13:31 
OK, so that implies x and y are simply floating point values and not functions. But then I'm confused by your original definition, viz:
y(n) = (1-a)*x(n-1) + a*y(n-1)
To me, that says y is a function of n, whose definition includes the value y(n-1). This is pretty easy to code recursively, but then I need to know the exit condition (eg: y(0) is arbitrarily defined as some value). Assuming y(0) is zero, I think the function you want is:
#define EPSILON   0.0000001
double y
  (float n,
   float a,
   float x)
{
  if (fabs (n) < EPSILON)
     return (0.0); // exit condition
  return ((1.0 - a)*x*(n - 1.0) + (a*y(n-1)));
}
/ravi

My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com

GeneralRe: Help writing a function Pin
NietzscheDisciple23-Sep-04 13:45
NietzscheDisciple23-Sep-04 13:45 
GeneralRe: Help writing a function Pin
Ravi Bhavnani23-Sep-04 18:07
professionalRavi Bhavnani23-Sep-04 18:07 
GeneralRecursive File Enumeration Pin
wayvirgo23-Sep-04 11:50
wayvirgo23-Sep-04 11:50 
GeneralRe: Recursive File Enumeration Pin
David Salter23-Sep-04 11:56
David Salter23-Sep-04 11:56 
GeneralRe: Recursive File Enumeration Pin
wayvirgo23-Sep-04 12:08
wayvirgo23-Sep-04 12:08 
GeneralRe: Recursive File Enumeration Pin
BlackDice24-Sep-04 3:20
BlackDice24-Sep-04 3:20 
QuestionHow about this? Pin
Tom Wright23-Sep-04 11:34
Tom Wright23-Sep-04 11:34 
AnswerRe: How about this? Pin
Michael Dunn23-Sep-04 11:42
sitebuilderMichael Dunn23-Sep-04 11:42 
GeneralRe: How about this? Pin
Tom Wright23-Sep-04 11:50
Tom Wright23-Sep-04 11:50 
GeneralRe: How about this? Pin
BlackDice23-Sep-04 11:59
BlackDice23-Sep-04 11:59 
GeneralRe: How about this? Pin
Tom Wright23-Sep-04 12:04
Tom Wright23-Sep-04 12:04 
GeneralRe: How about this? Pin
Michael Dunn23-Sep-04 12:03
sitebuilderMichael Dunn23-Sep-04 12:03 
GeneralRe: How about this? Pin
Tom Wright23-Sep-04 12:24
Tom Wright23-Sep-04 12:24 
GeneralRe: How about this? Pin
Tom Wright23-Sep-04 12:32
Tom Wright23-Sep-04 12:32 
GeneralRe: How about this? Pin
Michael Dunn23-Sep-04 15:13
sitebuilderMichael Dunn23-Sep-04 15:13 
GeneralRe: How about this? Pin
markkuk23-Sep-04 23:58
markkuk23-Sep-04 23:58 
General_CrtIsValidHeapPointer ASSERTS Pin
BlackDice23-Sep-04 10:43
BlackDice23-Sep-04 10:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.