导航:首页 > 编程语言 > 数值计算java

数值计算java

发布时间:2022-09-27 00:08:07

java怎么用键盘输入的数据进行计算

出现这样的问题的主要原因是你不十分清楚面向对象的开发的意义。
java中,Scanner是一个类,他用来处理从输入流中输入的数据,将它转换为目标数据,因此它可以根据需要多次读取数据,只要输入流中有数据。也就是说:他不是输入的内容,而是为你提供了一个获取输入的工具,打个比方就相当于你的键盘了。
建议你学习以下OOP的思想。
下面是我给你修改的:

i nt c;
S canner s = new Scanner(System.in);
System.out.println("计算a+b和a*b的值。");
System.out.println("先输入a的值并回车。");
int a = s.nextInt();
System.out.println("再输入b的值并回车。");
int b = s.nextInt();
c = a + b;
System.out.println("good");
System

Ⅱ java语言中的计算变量的值

int
a=4;
计算下面两个表达式的值:
(a++)
+=
a;
分析一下:首先说一下,a++,是先把a
的值提取出来运算后再+1;所以,这个程式就
分解成(a++)=4+4;把
8赋予a;然后a++,所以值为9;
(++a)
+=
(a++);
如果:是上面那个方程同一个方法里面的话,那么a之前的内存空间并没有被回收;
所以保留原有的数值,那么,继续(++a)先执行;此时
,a=9;a=9+9,就是a=18;结束后别忘记之前还有a++每加上去;结果自然是19赋予a;
如果,2个方程不在同一个方法,那么,2个a的值就不关联;a+1=5;
接着a=5+5就等于10
;别忘记,还有个1;所以就是11;
讲的够详细么?

Ⅲ java中如何对较大的数字进行计算

不管是不是用JAVA,其实方法都一样,利用数组比如说长度为一千的数字,可以这个 int[] number = new int[1000];相加的思路是,首先两个数组的长度必须是一致,位数不同的话,前面补0,内存有点浪费,但是计算起来比较方便。然后让它们从0到最高位,每位进行相加并保存相应的位置上。最后一步是从0开始判断有没有大于10的数字,如果有就向前面进位(前一个加1,当前位减10),这样就可以。如果是相减,其实思路还是一样的,每位先相减,再判断是否有小于0的,如果有则向前面一位借1(前一位减1,当前位加10)如果是相乘,和上面一样,不过要注意的是进位的时候,不止进一位,比如5*6,就要向前进3位了(前一位加3,当前位减30)除就比较麻烦点,要涉及到精确度问题,得看实际需要 输出就更容易了,直接for循环数组 特别要注意的是,如果最高位有进位的时候,这个是比较容易出错的地方 思路在上面,如果实现不了请留言

Ⅳ java中如何有自己输入数字后根据输入数字计算啊

输入操作是Scanner sc=new Scanner(System.in);然后输入你的值,并且用一个变量接收这个输入值,如果你输入的是整数,那么就int i=sc.nextInt(),如果你输入的是浮点型,那就用一个浮点型变量接收输入值,float i=sc.nextFloat(),然后那你的这个变量参与计算,如果你要一次输入多个数字的话,可以用一个集合或数组来接收,如float[] arr=new Float[10],然后从键盘上输入10个值,按照你输入的先后顺序依次存入到arr数组中,不过数组数值是要在循环中接收的。给你个例子代码吧:
import java.util.Scanner;
public class test{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
Float[] arr=new Float[10];
//获取从键盘上输入的数值
for(int i=0;i<arr.length;i++){
arr[i]=sc.nextFloat();
}
//进行计算
float a=arr[0]+arr[1];
system.out.println(a);
}
}

Ⅳ JAVA有哪些适合进行数值计算,数据分析/机器学习的库

直接搜关键词:numerical computations in java

1、https //en wikipedia org/wiki/Java_programming_language

Apache Commons, is an open-source for creating reusable Java components. It has numerical packages for linear algebra and non-linear optimization.
ND4J is an open-source library that supports n-dimensional (ND) arrays, similar to NumPy. It runs on distributed GPUs or CPUs cross-platform. It supports thedeep learning library Deeplearning4j.
Colt provides a set of Open Source Libraries for High Performance Scientific and Technical Computing.
Efficient Java Matrix Library (EJML) is an open-source linear algebra library for manipulating dense matrices.
JAMA, a numerical linear algebra toolkit for the Java programming language. No active development has taken place since 2005, but it still one of the more popular linear algebra packages in Java.
Jblas: Linear Algebra for Java, a linear algebra library which is an easy to use wrapper around BLAS and LAPACK.
Parallel Colt is an open source library for scientific computing. A parallel extension of Colt.
DataMelt, an open-source Java libraries for numerical calculations, data I/O and visualization of scientific results. Used together with Jython.
JMSL Numerical Libraries, is a comprehensive set of mathematical, statistical, data mining, financial and 2D/3D charting classes.
Matrix Toolkit Java is a linear algebra library based on BLAS and LAPACK.
OjAlgo is an open source Java library for mathematics, linear algebra and optimisation.
exp4j is a small Java library for evaluation of mathematical expressions.
la4j is a tiny Java library and it provides linear algebra primitives and algorithms.
Universal Java Matrix Package UJM is a Java library which provides implementations for sparse and dense matrices, as well as linear algebra calculations such as matrix decomposition, inverse, multiply, mean, correlation, standard deviation, etc.
Java Matrix Library A thoughtfully designed Java library for dealing with Matrices ( Matrix Theory ). Simple, Intuitive and Flexible. The library revolves around a Matrix interface. Operations are thoughtfully distributed. Not guilty of exposing all-in-one Matrix class.
JDistLib Java Statistical Distribution Library is a Java package that provides routines for various statistical distributions. A manual translation of distributions provided by R statistical package.
SuanShu by Numerical Method Inc. is a large collection of numerical algorithms including linear algebra, (advanced) optimization, interpolation, Markov model, principal component analysis, time series analysis, hypothesis testing, regressions, statistics, ordinary and partial differential equation solvers.

2、Java Numerics: Main

Apfloat is a arbitrary precision floating-point arithmetic package.
ArciMath BigDecimal is an extension of java.math.BigDecimal based on IBM's Java Specification Request.
Colt is a free Java toolkit containing data structures and utilities intended for high performance computing.
Commons-Math The Jakarta Mathematics Library is is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language.
Drej, an open-source Java library for linear and non-linear least-squares regression and regularized least-squares classification.
A translation of the ELEFUNT Elementary Functions Testing Package has been ported to Java. The collection also contains extensions to java.lang.Math and new classes for numeric output formatting.
IBM's AlphaWorks contains several tools of interest, including
library of correctly rounded elementary functions intended for use with Java.
Ninja, a set of classes for numerically intensive Java, including complex, multidimensional arrays, and the BLAS. (RETIRED)
Java Numerical Toolkit (JNT)
Special functions including Bessel functions, Chebyshev series.
Zero root finder
Random Number generators for uniform and normal sequences of floating point numbers and long integers.
Java Ultimate Math Package, a framework for arbitrary precision computations.
The Java3D effort proced a matrix package for use in graphics.
JMSL, a collection of mathematical, statistical and charting classes, written in 100% Java, marketed by Visual Numeric, Inc. Includes linear algebra, zero finding, splines, ordinary differential equations, linear programming, nonlinear optimization, FFTs, special functions, regression, ANOVA, ARMA, Kalman filters.
JLargeArrays, a pure Java library of one-dimensional numeric arrays that can store up to 2^63 elements.
JSci, a set of Java packages for linear algebra, statistics, wavelets. Includes chart/graph components and a partial MathML DOM implementation.
jScience contains packages for numerical linear algebra, for computing with units (e.g., kg., sec.), and other utility operations.
Jspline+ is a spline approximation library for Java developed at the Institute of Computational Mathematics and Mathematical Geophysics (RAS) in Novosibirsk. It contains classes for univariate and multivariate spline approximation on scattered meshes, as well as core matrix and linear system solution classes.
JTransforms, The first open source, multithreaded FFT library in pure Java.
Koalog Constraint Solver is a commercial Java library for solving combinatorial optimization problems using Constraint Programming or Local Search.
Least Squares Software markets the jCrunch[tm] class libraries for numerical computing.
mpjava is a Java implementation of David Bailey's Fortran-based multiprecision package. The package performs multi precision floating point arithmetic with arbitrary precision level. It takes advantage of Java's inheritance facility to provide smooth transition from primitive arithmetic types.
netlib has a small collection of Java numerical classes.
A Numerical Library in Java for Scientists and Engineers, a book published by CRC Press, contains a CD-ROM with translation into Java of the library NUMAL (NUMerical proceres in Algol 60).

Ⅵ 关于JAVA表格里数值计算的问题

public Object getValueAt(int row,
int column)返回 row 和 column 位置的单元格值。
注:列是以表视图的显示顺序,而不是以 TableModel 的列顺序指定的。这是一项重要的区别,因为在用户重新安排表中的列时,视图中给定索引处的列将更改。同时用户的操作不会影响模型的列顺序。

参数:
row - 其值要被查询的行
column - 其值要被查询的列
返回:
指定单元格处的 Object
再把对象换成数字就好咯

Ⅶ 请大神,帮忙一个java数值计算2次方的源代码 看哪里出错 java.lang.Math.pow(a

请按我这样写:
int a=3,b=2;
double c=Math.pow(a,b);
变量要先赋值、后使用,否则会产生不可预料的错误;另外,通常情况下,计算结果要保存起来,存放于另一个变量中,方便后续使用。

Ⅷ JAVA有哪些适合进行数值计算,数据分析/机器学习的库

Apache Commons, is an open-source for creating reusable Java components. It has numerical packages for linear algebra and non-linear optimization.
ND4J is an open-source library that supports n-dimensional (ND) arrays, similar to NumPy. It runs on distributed GPUs or CPUs cross-platform. It supports thedeep learning library Deeplearning4j.
Colt provides a set of Open Source Libraries for High Performance Scientific and Technical Computing.
Efficient Java Matrix Library (EJML) is an open-source linear algebra library for manipulating dense matrices.
JAMA, a numerical linear algebra toolkit for the Java programming language. No active development has taken place since 2005, but it still one of the more popular linear algebra packages in Java.
Jblas: Linear Algebra for Java, a linear algebra library which is an easy to use wrapper around BLAS and LAPACK.
Parallel Colt is an open source library for scientific computing. A parallel extension of Colt.
DataMelt, an open-source Java libraries for numerical calculations, data I/O and visualization of scientific results. Used together with Jython.
JMSL Numerical Libraries, is a comprehensive set of mathematical, statistical, data mining, financial and 2D/3D charting classes.
Matrix Toolkit Java is a linear algebra library based on BLAS and LAPACK.
OjAlgo is an open source Java library for mathematics, linear algebra and optimisation.
exp4j is a small Java library for evaluation of mathematical expressions.
la4j is a tiny Java library and it provides linear algebra primitives and algorithms.
Universal Java Matrix Package UJM is a Java library which provides implementations for sparse and dense matrices, as well as linear algebra calculations such as matrix decomposition, inverse, multiply, mean, correlation, standard deviation, etc.
Java Matrix Library A thoughtfully designed Java library for dealing with Matrices ( Matrix Theory ). Simple, Intuitive and Flexible. The library revolves around a Matrix interface. Operations are thoughtfully distributed. Not guilty of exposing all-in-one Matrix class.
JDistLib Java Statistical Distribution Library is a Java package that provides routines for various statistical distributions. A manual translation of distributions provided by R statistical package.
SuanShu by Numerical Method Inc. is a large collection of numerical algorithms including linear algebra, (advanced) optimization, interpolation, Markov model, principal component analysis, time series analysis, hypothesis testing, regressions, statistics, ordinary and partial differential equation solvers.

2、Java Numerics: Main

Apfloat is a arbitrary precision floating-point arithmetic package.
ArciMath BigDecimal is an extension of java.math.BigDecimal based on IBM's Java Specification Request.
Colt is a free Java toolkit containing data structures and utilities intended for high performance computing.
Commons-Math The Jakarta Mathematics Library is is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language.
Drej, an open-source Java library for linear and non-linear least-squares regression and regularized least-squares classification.
A translation of the ELEFUNT Elementary Functions Testing Package has been ported to Java. The collection also contains extensions to java.lang.Math and new classes for numeric output formatting.
IBM's AlphaWorks contains several tools of interest, including
library of correctly rounded elementary functions intended for use with Java.
Ninja, a set of classes for numerically intensive Java, including complex, multidimensional arrays, and the BLAS. (RETIRED)
Java Numerical Toolkit (JNT)
Special functions including Bessel functions, Chebyshev series.
Zero root finder
Random Number generators for uniform and normal sequences of floating point numbers and long integers.
Java Ultimate Math Package, a framework for arbitrary precision computations.
The Java3D effort proced a matrix package for use in graphics.
JMSL, a collection of mathematical, statistical and charting classes, written in 100% Java, marketed by Visual Numeric, Inc. Includes linear algebra, zero finding, splines, ordinary differential equations, linear programming, nonlinear optimization, FFTs, special functions, regression, ANOVA, ARMA, Kalman filters.
JLargeArrays, a pure Java library of one-dimensional numeric arrays that can store up to 2^63 elements.
JSci, a set of Java packages for linear algebra, statistics, wavelets. Includes chart/graph components and a partial MathML DOM implementation.
jScience contains packages for numerical linear algebra, for computing with units (e.g., kg., sec.), and other utility operations.
Jspline+ is a spline approximation library for Java developed at the Institute of Computational Mathematics and Mathematical Geophysics (RAS) in Novosibirsk. It contains classes for univariate and multivariate spline approximation on scattered meshes, as well as core matrix and linear system solution classes.
JTransforms, The first open source, multithreaded FFT library in pure Java.
Koalog Constraint Solver is a commercial Java library for solving combinatorial optimization problems using Constraint Programming or Local Search.
Least Squares Software markets the jCrunch[tm] class libraries for numerical computing.
mpjava is a Java implementation of David Bailey's Fortran-based multiprecision package. The package performs multi precision floating point arithmetic with arbitrary precision level. It takes advantage of Java's inheritance facility to provide smooth transition from primitive arithmetic types.
netlib has a small collection of Java numerical classes.
A Numerical Library in Java for Scientists and Engineers, a book published by CRC Press, contains a CD-ROM with translation into Java of the library NUMAL (NUMerical proceres in Algol 60).

Ⅸ java里自己建立的包里能进行数值计算吗

你的数组信息存放在w[]中,而w[]是一个RIC构造函数中的局部变量,所以w[]的作用域是RIC构造函数,当RIC对象创建完成之后,作用域消失,此时w[]对象引用也会消失,所以在外部你不可能获取该信息。如果你希望获取这个数组的值信息,可以将w[]定义成RIC的一个变量,并对外提供一个获取该变量的方法,如下:
public class RIC{
private double w[];
public RIC(int d,int a,int b,double c){
//其他操作保持不变
w[]=new double[100];
for(int i=0;i<ii;i++){
w[i]=(Math.exp((- Math.pow((2*Math.PI*f/GAM),2))*Math.pow(t,2)))*Math.cos(2*Math.PI*f*t);
}
}

public double[] getW(){
return w;
}
}
这样你就可以在主程序中获取到数组的信息了。

其实这种方式不是很推荐,因为程序设计时,不提倡在构造函数中引入复杂的逻辑,你计算的过程其实可以放到一个独立的方法中。

阅读全文

与数值计算java相关的资料

热点内容
怎么追程序员的女生 浏览:481
空调外压缩机电容 浏览:73
怎么将安卓变成win 浏览:455
手机文件管理在哪儿新建文件夹 浏览:721
加密ts视频怎么合并 浏览:773
php如何写app接口 浏览:800
宇宙的琴弦pdf 浏览:395
js项目提成计算器程序员 浏览:942
pdf光子 浏览:832
自拍软件文件夹名称大全 浏览:327
程序员留学移民 浏览:51
梁中间部位箍筋加密区 浏览:119
频谱分析pdf 浏览:752
乐2怎么升级安卓70 浏览:174
java中获取日期 浏览:508
单片机74hc245 浏览:274
美国历史上的总统pdf 浏览:753
程序员脱单实验室靠不靠谱 浏览:460
php中间四位手机号 浏览:871
永旺app怎么样了 浏览:518