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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
| /*27:*/
#line 80 "./lotkavolterra2.w"
#include <ostream>
#include "vnode.h"
using namespace std;
using namespace vnodelp;
/*20:*/
#line 6 "./lotkavolterra2.w"
/*19:*/
#line 76 "./usage.w"
template<typename var_type>
void lotkavolterra2(int n,var_type*yp,
const var_type*y,
var_type t,void*param)
{
yp[0]= (1-0.01*y[1])*y[0];
yp[1]= (-1+0.02*y[0])*y[1];
}
#line 1 "./lotkavolterra2.w"
/*:19*/
#line 7 "./lotkavolterra2.w"
int main()
{
/*21:*/
#line 24 "./lotkavolterra2.w"
const int n= 2;
interval t= 0.0,tend= 2;
iVector y(n);
//interval ci1 = interval(49.5, 50.5);
//interval ci2 = interval(49.5, 50.5);
//y[0]= ci1;
//y[1]= ci2;
y[0]= 50.0;
y[1]= 50.0;
/*:21*/
#line 10 "./lotkavolterra2.w"
/*22:*/
#line 41 "./lotkavolterra2.w"
AD*ad= new FADBAD_AD(n,lotkavolterra2,lotkavolterra2);
/*:22*/
#line 11 "./lotkavolterra2.w"
/*23:*/
#line 48 "./lotkavolterra2.w"
VNODE*Solver= new VNODE(ad);
/*:23*/
#line 12 "./lotkavolterra2.w"
/*24:*/
#line 57 "./lotkavolterra2.w"
interval step= string_to_interval("0.1");
tend= 0.0;
for(int i= 1;i<=20;i++)
{
tend+= step;
Solver->integrate(t,y,tend);
/*26:*/
#line 67 "./basic.w"
ofstream outFile1("lorenz.tight",ios::out);
outFile1<<"Solution enclosure at t = "<<t<<endl<<"\t";
cout<<"Solution enclosure at t = "<<t<<endl;
printVector(y);
/*:26*/
#line 19 "./intermed.w"
}
tend= 2.1;
Solver->integrate(t,y,tend);
/*26:*/
#line 67 "./basic.w"
cout<<"Solution enclosure at t = "<<t<<endl;
printVector(y);
/*:24*/
#line 13 "./lotkavolterra2.w"
/*25:*/
#line 62 "./lotkavolterra2.w"
if(!Solver->successful())
cout<<"VNODE-LP could not reach t = "<<tend<<endl;
/*:25*/
#line 14 "./lotkavolterra2.w"
/*26:*/
#line 67 "./lotkavolterra2.w"
cout<<"Solution enclosure at t = "<<t<<endl;
printVector(y);
/*:26*/
#line 15 "./lotkavolterra2.w"
return 0;
}
/*:20*/
#line 86 "./lotkavolterra2.w"
/*:27*/ |
Partager