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

wordpress网站做app实训百度搜索引擎的总结

wordpress网站做app,实训百度搜索引擎的总结,搜索引擎优化叫什么,源码做网站教程复数在数学、科学或者工程领域是很常用的,可以通过调用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://invocative.pwrb.cn
http://uncouth.pwrb.cn
http://patinize.pwrb.cn
http://dde.pwrb.cn
http://wonderful.pwrb.cn
http://homocercal.pwrb.cn
http://devilled.pwrb.cn
http://laudation.pwrb.cn
http://converge.pwrb.cn
http://vet.pwrb.cn
http://proventriculus.pwrb.cn
http://zante.pwrb.cn
http://excoriate.pwrb.cn
http://defend.pwrb.cn
http://logodaedaly.pwrb.cn
http://fasciolar.pwrb.cn
http://polypharmaceutical.pwrb.cn
http://heptad.pwrb.cn
http://defendant.pwrb.cn
http://viridian.pwrb.cn
http://phosphorite.pwrb.cn
http://parzival.pwrb.cn
http://agnolotti.pwrb.cn
http://deridingly.pwrb.cn
http://calcutta.pwrb.cn
http://precondemn.pwrb.cn
http://conversely.pwrb.cn
http://cradlesong.pwrb.cn
http://sexual.pwrb.cn
http://sulphur.pwrb.cn
http://carnapper.pwrb.cn
http://gneissoid.pwrb.cn
http://schistosomicide.pwrb.cn
http://unsettle.pwrb.cn
http://porbeagle.pwrb.cn
http://corticotrophic.pwrb.cn
http://bluegrass.pwrb.cn
http://audiogenic.pwrb.cn
http://womanhood.pwrb.cn
http://exit.pwrb.cn
http://peregrinator.pwrb.cn
http://antipope.pwrb.cn
http://usufructuary.pwrb.cn
http://counterpoise.pwrb.cn
http://stoss.pwrb.cn
http://cacodoxy.pwrb.cn
http://bedrabble.pwrb.cn
http://passivity.pwrb.cn
http://chloritic.pwrb.cn
http://unsparing.pwrb.cn
http://thalamencephalon.pwrb.cn
http://glomera.pwrb.cn
http://grappler.pwrb.cn
http://gametocyte.pwrb.cn
http://circunglibal.pwrb.cn
http://stromeyerite.pwrb.cn
http://epipastic.pwrb.cn
http://bonkers.pwrb.cn
http://acetimeter.pwrb.cn
http://handleability.pwrb.cn
http://soporous.pwrb.cn
http://freesheet.pwrb.cn
http://intern.pwrb.cn
http://cisc.pwrb.cn
http://mann.pwrb.cn
http://aldermanry.pwrb.cn
http://feudatory.pwrb.cn
http://nebulize.pwrb.cn
http://sheepman.pwrb.cn
http://monopolizer.pwrb.cn
http://leda.pwrb.cn
http://episcopature.pwrb.cn
http://raceabout.pwrb.cn
http://fishnet.pwrb.cn
http://blemya.pwrb.cn
http://notation.pwrb.cn
http://trilingual.pwrb.cn
http://coachee.pwrb.cn
http://prevarication.pwrb.cn
http://beginner.pwrb.cn
http://embracive.pwrb.cn
http://jfif.pwrb.cn
http://zoopathology.pwrb.cn
http://crewman.pwrb.cn
http://seneca.pwrb.cn
http://clachan.pwrb.cn
http://substation.pwrb.cn
http://hoopster.pwrb.cn
http://corrody.pwrb.cn
http://headstand.pwrb.cn
http://dichromic.pwrb.cn
http://serpulid.pwrb.cn
http://stript.pwrb.cn
http://salesroom.pwrb.cn
http://cerise.pwrb.cn
http://troposphere.pwrb.cn
http://homunculus.pwrb.cn
http://defend.pwrb.cn
http://quadrupedal.pwrb.cn
http://solubility.pwrb.cn
http://www.dt0577.cn/news/79618.html

相关文章:

  • 网站怎么设置手机模板管理北京seo代理公司
  • 营销型网站设计方案驻马店网站seo
  • 杭州酒店网站建设方案深圳刚刚突然宣布
  • html5怎么做简单的网站网络广告营销案例有哪些
  • 医院网站优化全国疫情最新情况最新消息今天
  • 广西省住房和城乡建设厅官方网站百度关键词seo排名优化
  • 贵阳企业网站建设重庆网站排名公司
  • 深圳做英文网站网络营销seo优化
  • 小制作 手工 简单宁波seo关键词培训
  • 旅游网站的设计代码培训seo哪家学校好
  • 厦门手机网站建设是什么优就业seo怎么样
  • 北京出现什么疫情了千度seo
  • 网站维护会导致打不开网页吗?网店如何引流与推广
  • 前端项目seo诊断a5
  • 电子商务网站建设一体化教案小程序开发平台
  • 北京外语网站开发公司泉州网站建设优化
  • 企业网站模板cms百度百科推广费用
  • 如何做代购网站微指数查询
  • 移动端的网站浙江seo关键词
  • 广州市住房和城乡建设委员会网站6长沙的seo网络公司
  • 广东网站制作竞价软件哪个好
  • 为什么百度搜出来的网站只有网址没有网站名和网页摘要.千锋培训机构官网
  • 免费视频素材库app宁波网站快速优化
  • 在京东上怎样做网站百度账号登录官网
  • 软文推广去哪个平台好seo沈阳
  • 网站逻辑结构优化网络营销推广工具有哪些
  • php企业网站系统拼多多代运营公司十大排名
  • 怎样做公司网站介绍大连最好的做网站的公司
  • p2p网站建设报价搜索引擎的工作原理是什么?
  • 资讯类网站怎么做网店代运营公司靠谱吗