d5ee87b7ed
Example Markov : simulation of a Markov chain. Use of a Random module, external call to C rand() function.
15 lines
204 B
C
15 lines
204 B
C
|
|
#include <stdlib.h>
|
|
#include "mathext.h"
|
|
|
|
void Mathext__power_step(float x, int n, Mathext__power_out *o) {
|
|
float r;
|
|
int i;
|
|
|
|
r = 1.0;
|
|
for (i = 1; i <= n; i++) {
|
|
r = r * x;
|
|
}
|
|
o->y = r;
|
|
}
|
|
|