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

15年做哪个网站能致富精准营销的成功案例

15年做哪个网站能致富,精准营销的成功案例,手机抖音你做我女朋友好吗套路网站,外贸营销网站推广复数在数学、科学或者工程领域是很常用的,可以通过调用Apache Commons Math库来完成,也可以自己手撸。 一、使用Apache Commons Math库 这个库有多个版本,在写这篇文章时,它的最新版是2022年12月19日的4.0-beta1,构建…

复数在数学、科学或者工程领域是很常用的,可以通过调用Apache Commons Math库来完成,也可以自己手撸。

一、使用Apache Commons Math库

这个库有多个版本,在写这篇文章时,它的最新版是2022年12月19日的4.0-beta1,构建坐标是org.apache.commons:commons-math4-core:4.0-beta1,考虑到程序稳定性,我们可以使用目前开发者用得最多的版本3.6.1(2016年3月17日发布),Maven依赖如下:

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
<dependency><groupId>org.apache.commons</groupId><artifactId>commons-math3</artifactId><version>3.6.1</version>
</dependency>

示例代码如下:

import org.apache.commons.math3.complex.Complex;
public class ACMComplexDemo {public static void main(String[] args) {Complex c = new Complex(3, 5);Complex d = new Complex(2, -2);System.out.println(c);System.out.println("c = " + c.getReal() + " + " + c.getImaginary() + "i");System.out.println(c + " * " + d + " = " + c.multiply(d));System.out.println(c + " / " + d + " = " + c.divide(d));}
}

二、自己开发一个复数类

public class SimpleComplex {private double real;private double imaginary;// 无参构造public SimpleComplex() {this(0.0, 0.0);}// 双参构造,用于表示虚数public SimpleComplex(double real, double imaginary) {this.real = real;this.imaginary = imaginary;}// 单参构造,适用于实数范围public SimpleComplex(double real) {this(real, 0.0);}// 加法public SimpleComplex add(SimpleComplex other) {double real = this.real + other.real;double imaginary = this.real + other.imaginary;return new SimpleComplex(real, imaginary);}// 减法public SimpleComplex sub(SimpleComplex other) {return this.add(opposite(other));}// 乘法public SimpleComplex mul(SimpleComplex other) {double real = this.real * other.real - this.imaginary * other.imaginary;double imaginary = this.real * other.imaginary + this.imaginary * other.real;return new SimpleComplex(real, imaginary);}// 除法public SimpleComplex div(SimpleComplex other) {double real = (this.real * other.real + this.imaginary * other.imaginary)/ (other.real * other.real + other.imaginary * other.imaginary);double imaginary = (this.imaginary * other.real - this.real * other.imaginary)/ (other.real * other.real + other.imaginary * other.imaginary);return new SimpleComplex(real, imaginary);}// 获取实部public double getReal() {return real;}// 获取虚部public double getImaginary() {return imaginary;}@Overridepublic String toString() {if (this.real == 0.0) {return this.imaginary + "i";} else if (this.imaginary == 0.0) {return this.real + "";} else if (this.imaginary < 0.0 && this.real != 0.0) {return this.real + "" + this.imaginary + "i";} else if (this.imaginary == 0.0 && this.real == 0.0) {return "0.0";}return this.real + "+" + this.imaginary + "i";}// 判断两个复数是否相等@Overridepublic boolean equals(Object obj) {if (obj == this) {return true;} else if (obj == null || !(obj instanceof SimpleComplex)) {return false;}SimpleComplex tmp = (SimpleComplex) obj;return Math.abs(this.real - tmp.real) < 1e-6&& Math.abs(this.imaginary - tmp.imaginary) < 1e-6;}// 返回相反数private static SimpleComplex opposite(SimpleComplex one) {return new SimpleComplex(-one.real, -one.imaginary);}public static void main(String[] args) {// 示例用法SimpleComplex c1 = new SimpleComplex(3, 5); // 3 + 5iSimpleComplex c2 = new SimpleComplex(2, -2); // 2 - 2iSystem.out.println("c1 + c2 = " + c1.add(c2));System.out.println("c1 - c2 = " + c1.sub(c2));System.out.println("c1 * c2 = " + c1.mul(c2));System.out.println("c1 / c2 = " + c1.div(c2));}
}

显然,自己开发一个并不如Apache Commons Math做得好了,毕竟Apache的库提供了大量的运算方法,且逻辑严谨,是应用开发的首选。但执行一些简单的运算,譬如复数除法,在一定量的基础上,简单实现有一点点的性能优势。

http://www.yidumall.com/news/109694.html

相关文章:

  • 企业网站更新频率海外网站cdn加速
  • 好的网站域名网络营销的五大优势
  • 如何制作网站app品牌整合推广
  • 做文学网站算不算开公司上海app网络推广公司
  • 怎样建设香港网站百度爱采购怎样入驻
  • java可以做网站吗海外黄冈网站推广
  • 企业h5网站建设灰色词排名接单
  • java视频网站开发技术百度资源平台
  • WordPress商务网站今日新闻
  • 罗湖医院网站建设seo外包方法
  • 商务网站如何推广seo咨询河北
  • 扁平化手机网站如何制作一个简单的网页
  • 做网站优化需要做什么seosem顾问
  • 哪个网站查企业信息免费seo点击排名软件哪里好
  • 一张图片网站代码推广专员
  • 看b站直播平台长尾关键词搜索网站
  • 人妖变装雅琪wordpressseo国外英文论坛
  • 平台网站 备案吗企业网站的推广阶段
  • 公司网站要什么做排超最新积分榜
  • 服装网站建设推荐军事新闻今日最新消息
  • 网站服务器不稳定怎么办网上代写文章一般多少钱
  • 网站建设排行网站页面seo
  • 深圳建站公司收费网络优化公司
  • 帝国cms网站建设爱站网长尾关键词挖掘工具电脑版
  • 深圳网站建设工作谷歌seo排名公司
  • 武汉网站建设 网站制作数字营销网站
  • 怎么做短文网站新的seo网站优化排名 网站
  • 摩洛哥网站后缀网页制作教程书籍
  • 钢板防护罩做网站中国国家培训网官网入口
  • 中国知名的建网站的公司广州做seo整站优化公司