-
Notifications
You must be signed in to change notification settings - Fork 0
/
Problems3.c
57 lines (52 loc) · 962 Bytes
/
Problems3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "philsp.h"
//Amanda Martin
void func( double (*first)(double R, double F, double dt),
double (*second)(double R, double F, double dt),
double *R, double *F, double dt, double *i)
{
while(*i<10000)
{
*R=*R+first(*R, *F, dt);
*F=*F+second(*R, *F, dt);
*i=*i+dt;
putpoint_plot(*R,*F,2,1,8,2.0,0);
flush_plot();
delay_plot(1);
}
}
double first(double R, double F, double dt)
{
double a,b;
a=0.2;
b=.01;
R=(a*R-b*R*F)*dt;
return(R);
}
double second( double R, double F,double dt)
{
double c,d;
c=.001;
d=.1;
F=(c*F*R-d*F)*dt;
return(F);
}
int main()
{
double Rmin, Rmax, Fmin, Fmax, dt, R, F, i;
int j,u,k;
open_plot("800x800");
Rmin=0;
Rmax=300;
Fmin=0;
Fmax=50;
dt=0.1;
R=200.0;
F=20.0;
i=0.0;
box_plot(Rmin, Rmax, Fmin, Fmax,1.5, 1,"x","t","","");
func(&first,&second, &R, &F, dt, &i);
return(0);
}