当前位置: 首页 > news >正文

协达网站建设公司网站建设和推广

协达网站建设,公司网站建设和推广,网站建设教程多少钱,wordpress抓取埃尔米特插值 原理 #pragma once #include vector #include functional /*埃尔米特插值*/ struct InterpolationPoint {double x; // 插值点的横坐标double y; // 插值点的纵坐标double derivative; // 插值点的导数值// 默认构造函数InterpolationPoint() : x…埃尔米特插值 原理 #pragma once #include vector #include functional /*埃尔米特插值*/ struct InterpolationPoint {double x; // 插值点的横坐标double y; // 插值点的纵坐标double derivative; // 插值点的导数值// 默认构造函数InterpolationPoint() : x(0.0), y(0.0), derivative(0.0) {}// 带参数的构造函数InterpolationPoint(double x_val, double y_val, double derivative_val) : x(x_val), y(y_val), derivative(derivative_val) {}// 拷贝构造函数InterpolationPoint(const InterpolationPoint other) : x(other.x), y(other.y), derivative(other.derivative) {}// 移动构造函数InterpolationPoint(InterpolationPoint other) noexcept : x(other.x), y(other.y), derivative(other.derivative) {other.x 0.0;other.y 0.0;other.derivative 0.0;}// Copy assignment operatorInterpolationPoint operator(const InterpolationPoint other) {if (this ! other) {x other.x;y other.y;derivative other.derivative;}return *this;}// 设置插值点的值void set(double x_val, double y_val, double derivative_val) {x x_val;y y_val;derivative derivative_val;}// 获取插值点的横坐标double get_x() const {return x;}// 获取插值点的纵坐标double get_y() const {return y;}// 获取插值点的导数值double get_derivative() const {return derivative;} };class HermiteInterpolator { public:HermiteInterpolator(const std::vectorInterpolationPoint points);HermiteInterpolator(int width, std::vectorint adjPoints);void setPoints(const std::vectorInterpolationPoint points);double interpolate(double x) ;private:// 返回连接两点的线段函数std::functiondouble(double) getLineFunction( InterpolationPoint p1, InterpolationPoint p2);private:std::vectorInterpolationPoint points_; }; #include pch.h #include HermiteInterpolator.h #include fstream HermiteInterpolator::HermiteInterpolator(const std::vectorInterpolationPoint points) : points_(points) { } HermiteInterpolator::HermiteInterpolator(int width, std::vectorint adjPoints) {float step width / adjPoints.size();for (int i 0; i adjPoints.size(); i){InterpolationPoint point(step*i, adjPoints[i] , 0);points_.push_back(point);} } void HermiteInterpolator::setPoints(const std::vectorInterpolationPoint points) {points_ points; }// 返回连接两点的线段函数 std::functiondouble(double) HermiteInterpolator::getLineFunction( InterpolationPoint p1, InterpolationPoint p2) {// 计算线段的斜率和截距double slope (p2.y - p1.y) / (p2.x - p1.x);double intercept p1.y - slope * p1.x;// 返回线段的lambda表达式return [slope, intercept](double x) {return slope * x intercept;}; } // 计算三次分段Hermite插值函数的值 double HermiteInterpolator::interpolate(double x) {int y 0;int n points_.size();if (n 3){// 获取线段函数std::functiondouble(double) lineFunction getLineFunction(points_[0], points_[1]);y lineFunction(x);}else{for (int i 0; i n - 1; i) {if (x points_[i].x x points_[i 1].x) {double h points_[i 1].x - points_[i].x;double t (x - points_[i].x) / h;// (x-x_k)/(x_{k1} - x_k)double tk (x - points_[i 1].x) / (-h); // (x - x_{ k 1 }) / (x_k - x_{ k 1 }) double y0 (1 2 * t) * tk * tk;double y1 (1 2 * tk) * t * t;double y2 (x - points_[i].x) * tk * tk;double y3 (x - points_[i 1].x) * t * t;y points_[i].y * y0 points_[i 1].y * y1 points_[i].derivative * y2 points_[i 1].derivative * y3;}}}//ofstream f;//f.open(D:\\work\\documentation\\HermiteInterpolator.txt, ios::app);//f x, y endl;//f.close();return y; // 如果找不到对应的插值段返回默认值 }为了可视化效果可以把结果写到HermiteInterpolator.txt 画图python代码 import matplotlib.pyplot as plt# 打开文本文件进行读取 with open(D:\\work\\documentation\\HermiteInterpolator.txt) as f:data f.readlines()# 定义两个列表分别存储横坐标和纵坐标的数据 x [] y [] # 遍历每一行 for i, line in enumerate(data):# 去除换行符if line:user_pwd_list line.strip().split(,)# 横坐标是行号x.append(float(user_pwd_list[0]))# 纵坐标是数值数据y.append(float(user_pwd_list[1]))# 创建散点图 plt.scatter(x, y)# 添加标题和轴标签 plt.title(Scatter Plot) plt.xlabel(Line) plt.ylabel(Value)# 显示并保存图像 #plt.savefig(plot.png) plt.show()
http://www.w-s-a.com/news/798402/

相关文章:

  • 汽车行业做网站福建省第二电力建设公司网站
  • delphi做网站开发商城网站建设价位
  • 网站宣传片3 阐述网站建设的步骤过程 9分
  • 公司网站怎么做站外链接哪里有做胎儿dna亲子鉴定
  • 潍坊做电商的网站建设wordpress 特效主题
  • 做网站和app哪个难公司网上注册系统
  • 关于网站建设外文文献系部网站建设
  • 高端设计网站都有哪些月付网站空间提供商
  • 家政 东莞网站建设优化设计官方电子版
  • 做网站如何使用网页插件上海造价信息网
  • 承德网站制作加盟天津做优化的网站有多少家
  • 北京市保障性住建设投资中心网站首页专业做网站联系电话
  • 镇江网站建设方式优化单页面网站教程
  • 做手机网站公司北京网页设计公司兴田德润实惠
  • 域名申请好了 要怎么做网站百度推广开户渠道
  • 电商网站建设 数商云焦作黄河交通学院
  • 做一个网站成本多少太原网站维护
  • 网站建设制作设计优化怎么制作网页步骤
  • 花都区pc端网站建设画册设计多少钱一页
  • 国外买域名的网站廊坊网站制作网页
  • 抚顺市城市建设档案馆网站制作网页时经常用的一种动态位图格式是
  • 公司网站站群是什么运营网站
  • 昆明网站建设大全安徽教育机构网站建设
  • 广州网站排名怎么优化中华衣柜网
  • 怎样围绕网站专题发展来做ppt城乡住建局官网
  • 安卓手机app制作关键词优化公司
  • 江苏固茗建设有限公司网站深圳网站建设深圳网
  • 高性能网站建设指南北京城乡建设官方网站
  • 企业网站找谁做做淘宝相关网站
  • 商业网站网站建设wordpress关闭前端公共库