vb.netsin函数的简单介绍

有谁知道VB编程中运算sin、cos、tan、cot的程序怎么写?sin(角度值)同理cos,tan
Atn()是VB反正切函数 , VB不提供其他反三角函数,不过可以用下列公式导出:
Inverse
Sine
(反正弦):
Arcsin(X)
=
Atn(X
/
Sqr(-X
*
X
1))
Inverse
Cosine
(反余弦):
Arccos(X)
=
Atn(-X
/
Sqr(-X
*
X
1))
2
*
Atn(1)
Inverse
Secant
(反正割):
Arcsec(X)
=
Atn(X
/
Sqr(X
*
X
-
1))
Sgn((X)
-
1)
*
(2
*
Atn(1))
Inverse
Cosecant
(反余割):
Arccosec(X)
=
Atn(X
/
Sqr(X
*
X
-
1))
(Sgn(X)
-
1)
*
(2
*
Atn(1))
以上这些公式,其实就是应用了数学中的各类三角函数和正切函数之间的关系导出的 。其中需要注意的是其中的
X
不能等于正负1 。(引用-_-)
x都是弧度制
VB.NETsin曲线Dim Points1(30) As Point
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Enabled = True
Timer1.Interval = 200
For i = 0 To 30
Points1(i) = New Point(i * 45, Math.Sin(i) * (PictureBox1.Height - 50) / 9)
Points1(i).Offset(-450, Math.Abs(Points1(i).Y - (PictureBox1.Height - 50) / 9) * 3.5543)
Next
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static j As Long
j = j1
PictureBox1.Image = x_y(PictureBox1, j)
End Sub
Private Function x_y(ByVal pic As PictureBox, ByVal x As Long) As Bitmap
Dim b As New Bitmap(pic.Width, pic.Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim c
Dim j
g.Clear(Color.YellowGreen)
Dim p As New Pen(Color.WhiteSmoke)
p.EndCap = Drawing2D.LineCap.ArrowAnchor
g.DrawLine(p, 20, pic.Height - 20, 20, 10)
g.DrawLine(p, 20, pic.Height - 20, pic.Width - 20, pic.Height - 20)
Dim i As Double
Dim bs As New SolidBrush(Color.Red)
Dim po As New Point
g.DrawString(-2, Me.Font, bs, 12, pic.Height - 18)
po.X = 0
po.Y = pic.Height - 45
For i = -1.6 To 4 Step 0.4
g.DrawString(Math.Round(i, 1), Me.Font, bs, po.X, po.Y)
g.DrawLine(p, po.X18, po.Y5, po.X20, po.Y5)
Dim p1 As New Pen(Color.Blue)
p1.DashStyle = Drawing2D.DashStyle.Dash
g.DrawLine(p1, po.X28, po.Y5, pic.Width - 20, po.Y5)
po.Y -= (pic.Height - 50) / 9
Next
po.X = 20
po.Y = pic.Height - 20
For c = 0 To 14400 Step 1200
If (c / 1200)0 Then
g.DrawString((c / 1200)x, Me.Font, bs, po.X - j, po.Y5)
End If
g.DrawLine(p, po.X, po.Y2, po.X, po.Y)
po.X= (pic.Width - 50) / 12
Next
For i = 0 To Points1.Count - 1
Points1(i).Offset(45, 0)
Next
If x Mod 6 = 0 Then
For i = 0 To Points1.Count - 1
Points1(i).Offset(-270, 0)
Next
End If
g.DrawCurve(Pens.Red, Points1)
'For i = 0 To Points1.Count - 1
'g.DrawString(Math.Sin(i), Me.Font, Brushes.Red, Points1(i))
'Next
Return b
End Function
vb.net中我使用函数sin函数计算sin30度可是为什么算出来结果是0.479425538604203高手帮忙看看!程序如下:为什么vb.netsin函数我vb.netsin函数的不是?
Dim pi
pi = 3.1415926
Dim a
a = 30
Text1.Text = Sin(a * pi / 180)
vb中这个怎么解sin那个VB中vb.netsin函数的Sin函数是以弧度为参数的vb.netsin函数,例如vb.netsin函数:SIN(30°)应该等于0.5是吧 。那么vb.netsin函数我们在VB中要得到这个值就必须将30度转换为弧度vb.netsin函数,因此得到如下
SIN(30
*
(3.1415926/180))
这样写才能得到0.5,当然返回值是double,因此你可以用format来截取你需要的保留小数位数 。
vb 里的SIN函数怎么使用?帮我解释一下下面的代码谢谢Cos(pi * C * 6 / 180)中的 pi是π值,C 是变量,pi * C * 6 / 180 计算出的是弧度数 。
Sin(pi * C * 6 / 180)同上 。
Sin(mm) 中的 mm 可以是任何有理数(正无穷大到负无穷大) , 即可以是一个正的有理数,也可以是一个负的有理数,同样也可以是0,在VB计算时程序就认为 mm 是弧度数,故此,只要 mm 是有理数,那么就可以的 。
如果 mm 是角度数 , 必须转换为弧度数 。
在vb中 。如何进行三角函数的程序代码编写有几个地方要注意:
1、VB中的三角函数的角度全部是用弧度制表示的,如果是度数的话,应先乘以180再除以π转成弧度,再用函数计算结果 。
2、VB中直接支持的三角函数有:Sin()、Cos()、Tan(),如果涉及到其它三角函数,可以从下面列出的代码中自己选择相应的函数:
Function
Sec(X)
As
Double
'正割
Sec
=
1
/
Cos(Angle)
End
Function
Function
Csc(X)
As
Double
'余割
Csc
=
1
/
Sin(Angle)
End
Function
Function
Cot(X)
As
Double
'余切
Cot
=
1
/
Tan(Angle)
End
Function
Function
ArcSin(X)
As
Double
'反正弦
ArcSin
=
Atn(X
/
Sqr(-X
*
X
1))
End
Function
Function
ArcCos(X)
As
Double
'反余弦
ArcCos
=
Atn(-X
/
Sqr(-X
*
X
1))
2
*
Atn(1)
End
Function
Function
ArcSec(X)
As
Double
'反正割
ArcSec
=
Atn(X
/
Sqr(X
*
X
-
1))
Sgn((X)
-
1)
*
(2
*
Atn(1))
End
Function
Function
ArcCsc(X)
As
Double
'反余割
ArcCsc
=
Atn(X
/
Sqr(X
*
X
-
1))
(Sgn(X)
-
1)
*
(2
*
Atn(1))
End
Function
Function
ArcCot(X)
As
Double
'反余切
ArcCot
=
Atn(X)
2
*
Atn(1)
End
Function
Function
HSin(X)
As
Double
'双曲正弦
HSin
=
(Exp(X)
-
Exp(-X))
/
2
End
Function
Function
HCos(X)
As
Double
'双曲余弦
HCos
=
(Exp(X)
Exp(-X))
/
2
End
Function
Function
HTan(X)
As
Double
'双曲正切
HTan
=
(Exp(X)
-
Exp(-X))
/
(Exp(X)
Exp(-X))
End
Function
Function
HSec(X)
As
Double
'双曲正割
HSec
=
2
/
(Exp(X)
Exp(-X))
End
Function
Function
HCsc(X)
As
Double
'双曲余割
HCsc
=
2
/
(Exp(X)
-
Exp(-X))
End
Function
Function
HCot(X)
As
Double
'双曲余切
HCot
=
(Exp(X)
Exp(-X))
/
(Exp(X)
-
Exp(-X))
End
Function
Function
HArcsin(X)
As
Double
'反双曲正弦
HArcsin
=
Log(X
Sqr(X
*
X
1))
End
Function
Function
HArccos(X)
As
Double
'反双曲余弦
HArccos
=
Log(X
Sqr(X
*
X
-
1))
End
Function
Function
HArctan(X)
As
Double
'反双曲正切
HArctan
=
Log((1
X)
/
(1
-
X))
/
2
End
Function
Function
HArcsec(X)
As
Double
'反双曲正割
HArcsec
=
Log((Sqr(-X
*
X
1)
1)
/
X)
End
Function
Function
HArccsc(X)
As
Double
'反双曲余割
HArccsc
=
Log((Sgn(X)
*
Sqr(X
*
X
1)
1)
/
X)
End
Function
Function
【vb.netsin函数的简单介绍】HArccot(X)
As
Double
'反双曲余切
HArccot
=
Log((X
1)
/
(X
-
1))
/
2
End
Function
关于vb.netsin函数和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读