Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63843531
print_series.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, May 22, 20:37
Size
841 B
Mime Type
text/x-c
Expires
Fri, May 24, 20:37 (2 d)
Engine
blob
Format
Raw Data
Handle
17826085
Attached To
R9482 SP4E_Homework_Ashtari_Sieber
print_series.cc
View Options
#include <iostream>
#include <cmath>
#include <iomanip>
#include "print_series.hh"
void PrintSeries::dump(std::ostream & os){
double computed = 0.0;
double analytical = 0.0;
double error = 0.0;
for (unsigned long i = 0.0; i <= maxiter; ++i){
if (((i+1) % frequency == 0) && std::isnan(series.getAnalyticPrediction())){
computed = series.compute(i);
os << std::setprecision(dump_precision) << i << "\t" << computed << std::endl;
}
else if ((i+1) % frequency == 0){
computed = series.compute(i);
analytical = series.getAnalyticPrediction();
error = 100.0*(analytical - computed)/analytical;
os << std::setprecision(dump_precision) << i << "\t" << computed << "\t" << analytical << "\t" << error <<std::endl;
}
}
}
Event Timeline
Log In to Comment