资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java求sinc的代码 java怎么计算sin

java 海伦公式编程

海伦公式的几种另证及其推广

创新互联公司是一家以网络技术公司,为中小企业提供网站维护、成都网站建设、成都网站制作、网站备案、服务器租用、申请域名、软件开发、小程序制作等企业互联网相关业务,是一家有着丰富的互联网运营推广经验的科技公司,有着多年的网站建站经验,致力于帮助中小企业在互联网让打出自已的品牌和口碑,让企业在互联网上打开一个面向全国乃至全球的业务窗口:建站联系电话:18980820575

关于三角形的面积计算公式在解题中主要应用的有:

设△abc中,a、b、c分别为角a、b、c的对边,ha为a边上的高,r、r分别为△abc外接圆、内切圆的半径,p

=

(a+b+c),则

s△abc

=

aha=

ab×sinc

=

r

p

=

2r2sinasinbsinc

=

=

其中,s△abc

=

就是著名的海伦公式,在希腊数学家海伦的著作《测地术》中有记载。

海伦公式在解题中有十分重要的应用。

一、

海伦公式的变形

s=

=

=

=

=

=

二、

海伦公式的证明

证一

勾股定理

分析:先从三角形最基本的计算公式s△abc

=

aha入手,运用勾股定理推导出海伦公式。

证明:如图ha⊥bc,根据勾股定理,得:

x

=

y

=

ha

=

=

=

s△abc

=

aha=

=

此时s△abc为变形④,故得证。

证二:斯氏定理

分析:在证一的基础上运用斯氏定理直接求出ha。

斯氏定理:△abc边bc上任取一点d,

若bd=u,dc=v,ad=t.则

t

2

=

证明:由证一可知,u

=

v

=

ha

2

=

t

2

=

s△abc

=

aha

=

a

×

=

此时为s△abc的变形⑤,故得证。

证三:余弦定理

分析:由变形②

s

=

可知,运用余弦定理

c2

=

a2

+

b2

-2abcosc

对其进行证明。

证明:要证明s

=

则要证s

=

=

=

ab×sinc

此时s

=

ab×sinc为三角形计算公式,故得证。

证四:恒等式

分析:考虑运用s△abc

=r

p,因为有三角形内接圆半径出现,可考虑应用三角函数的恒等式。

恒等式:若∠a+∠b+∠c

=180○那么

tg

·

tg

+

tg

·

tg

+

tg

·

tg

=

1

证明:如图,tg

=

tg

=

tg

=

根据恒等式,得:

+

+

=

①②③代入,得:

∴r2(x+y+z)

=

xyz

如图可知:a+b-c

=

(x+z)+(x+y)-(z+y)

=

2x

∴x

=

同理:y

=

z

=

代入

④,得:

r

2

·

=

两边同乘以

,得:

r

2

·

=

两边开方,得:

r

·

=

左边r

·

=

r·p=

s△abc

右边为海伦公式变形①,故得证。

证五:半角定理

半角定理:tg

=

tg

=

tg

=

证明:根据tg

=

=

∴r

=

×

y

同理r

=

×

z

r

=

×

x

①×②×③,得:

r3

=

×xyz

向量的问题 !在线等待!

∵A+B+C=180度,

A+B=180-C,

sin(A+B)=sin(180-C)=sinC,

sinA*cosB+cosA*ainB=sinC,

∵cosA=-5/13,cosB=3/5.

sinA=√(1-cos^2A)=12/13,

sinB=√(1-cos^2B)=4/5,

∴sinC=sinA*cosB+cosA*ainB=16/65,

设BC=5,

BC/sinA=AB/sinC,

AB=(sinC/sinA)*BC=4/3,

三角形ABC的面积=1/2sinB*AB*BC=8/3.

Java编程——求解几何图形的周长、面积的程序。

/**

* The Class PerimeterArea. This Class is to compute perimeter and area

*/

public class PerimeterArea {

/**

* The main method.

*

* @param args

* the arguments

*/

public static void main(String[] args) {

Shape TriangleObj = new Triangle(3, 4, 5);// 定义三边为3,4,5的三角形

Shape RectangleObj = new Rectangle(5, 6);// 定义长为5,宽为6的矩形

Shape CircleObj = new Circle(5);// 定义半径为5的对象

// 打印各个形状的周长和面积

System.out.println(TriangleObj.toString());

System.out.println(RectangleObj.toString());

System.out.println(CircleObj.toString());

}

}

// 周长接口

interface perimeter {

public abstract double cutePerimeter();

}

// 面积接口

interface area {

public abstract double cuteArea();

}

// 抽象形状类

abstract class Shape implements perimeter, area {

public abstract double cutePerimeter();

public abstract double cuteArea();

}

// 三角形

class Triangle extends Shape {

private int aSide;

private int bSide;

private int cSide;

public Triangle(){}

public Triangle(int aSide, int bSide, int cSide) {

this.aSide = aSide;

this.bSide = bSide;

this.cSide = cSide;

}

public double cutePerimeter() {

return aSide + bSide + cSide;

}

public double cuteArea() {

//面积公式

/*设三边长分别为A、B、C,面积为S;周长的一半P为(A+B+C)/2.

S=√[P(P-A)*(P-B)*(P-C)].

√为开二次方. */

int x = (aSide + bSide + cSide) / 2;

return Math.sqrt(x*(x-aSide)*(x-bSide)*(x-cSide));

}

public int getASide() {

return aSide;

}

public void setASide(int side) {

aSide = side;

}

public int getBSide() {

return bSide;

}

public void setBSide(int side) {

bSide = side;

}

public int getCSide() {

return cSide;

}

public void setCSide(int side) {

cSide = side;

}

public String toString() {

return "三角形的周长为:" + cutePerimeter() + "\n三角形的面积为:" + cuteArea() + "\n";

}

}

// 矩形

class Rectangle extends Shape {

private int longLength;

private int widthLength;

public Rectangle(){}

public Rectangle(int longLength, int widthLength) {

this.longLength = longLength;

this.widthLength = widthLength;

}

public double cutePerimeter() {

return 2 * (longLength + widthLength);

}

public double cuteArea() {

return longLength * widthLength;

}

public int getLongLength() {

return longLength;

}

public void setLongLength(int longLength) {

this.longLength = longLength;

}

public int getWidthLength() {

return widthLength;

}

public void setWidthLength(int widthLength) {

this.widthLength = widthLength;

}

public String toString() {

return "矩形的周长为:" + cutePerimeter() + "\n矩形的面积为:" + cuteArea() + "\n";

}

}

// 圆形

class Circle extends Shape {

public final double pi = 3.14;

private double radius;

public Circle(){}

public Circle(double radius) {

this.radius = radius;

}

public double cutePerimeter() {

return 2 * pi * radius;

}

public double cuteArea() {

return pi * radius * radius;

}

public double getRadius() {

return radius;

}

public void setRadius(double radius) {

this.radius = radius;

}

public String toString() {

return "圆形的周长为:" + cutePerimeter() + "\n圆形的面积为:" + cuteArea() + "\n";

}

}

三角形面积已经修正~谢谢楼上的兄弟~set和get方法只是为了拓展性考虑~不局限于new才能设置参数值

java实现如下:已知平面内三点,其中一个为顶点,求顶点与其他两点构成直线的夹角。

//trangle 函数里面是三点坐标。其中A为直角

public static void trangle(double a_x,double a_y,double b_x,double b_y,double c_x,double c_y){

//Math.sqrt(x)表示开根号。Math.pow(x,n)表示x的n次方。

double ab = Math.sqrt(Math.pow(a_x-b_x, 2) + Math.pow(a_y - b_y, 2));//直线ab

double ac = Math.sqrt(Math.pow(a_x-c_x, 2) + Math.pow(a_y - c_y, 2));//直线bc

//求角B,C度数。Math.PI表示π;Math.atan2(x, y)表示arctant(x/y),在Java中是弧线长度,因此要将长度转换为度数。

double B = Math.atan2(ac, ab)*180/Math.PI;

double C = Math.atan2(ab, ac)*180/Math.PI;

System.out.println("B:"+B+"°\nC:"+C+"°");

}


名称栏目:java求sinc的代码 java怎么计算sin
链接地址:http://cdkjz.cn/article/ddddcpp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220