本文整理匯總了Java中java.lang.Math.cos方法的典型用法代碼示例。如果您正苦於以下問題:Java Math.cos方法的具體用法?Java Math.cos怎麽用?Java Math.cos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.Math
的用法示例。
在下文中一共展示了Math.cos方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: j1
import java.lang.Math; //導入方法依賴的package包/類
/**
* J 1 double.
*
* @param x a double value
* @return the Bessel function of order 1 of the argument.
* @throws ArithmeticException the arithmetic exception
*/
static public double j1(double x) throws ArithmeticException {
double ax;
double y;
double ans1, ans2;
if ((ax=Math.abs(x)) < 8.0) {
y=x*x;
ans1=x*(72362614232.0+y*(-7895059235.0+y*(242396853.1
+y*(-2972611.439+y*(15704.48260+y*(-30.16036606))))));
ans2=144725228442.0+y*(2300535178.0+y*(18583304.74
+y*(99447.43394+y*(376.9991397+y*1.0))));
return ans1/ans2;
} else {
double z=8.0/ax;
double xx=ax-2.356194491;
y=z*z;
ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
+y*(0.2457520174e-5+y*(-0.240337019e-6))));
ans2=0.04687499995+y*(-0.2002690873e-3
+y*(0.8449199096e-5+y*(-0.88228987e-6
+y*0.105787412e-6)));
double ans=Math.sqrt(0.636619772/ax)*
(Math.cos(xx)*ans1-z*Math.sin(xx)*ans2);
if (x < 0.0) ans = -ans;
return ans;
}
}
示例2: beChildof
import java.lang.Math; //導入方法依賴的package包/類
/**
* Computes the center of a bubble knowing its father, ray, angle, and margin
* @param father the father bubble
* @param mRay the ray of the child bubble
* @param angle the angle between the child and the father ( 0 means vertically from top to bottom )
* @param margin the margin in pixels between the father's circle and the child's circle
* @return the Point of the center for the child bubble
*
*/
public Point beChildof(Oval father, float mRay, double angle, double margin ){
Point mpoint = new Point();
mpoint.x=(int)(father.getX()+ Math.sin(angle)*(margin+father.getRay()+mRay));
mpoint.y=(int)(father.getY() + Math.cos(angle)*(margin+father.getRay()+mRay));
return mpoint;
}