Les fonctions " racines niemmes " et " arctan "et "arccos " et "arcsin"

labriji Messages postés 10 Date d'inscription lundi 2 juin 2003 Statut Membre Dernière intervention 20 mars 2008 - 31 janv. 2005 à 10:05
labriji Messages postés 10 Date d'inscription lundi 2 juin 2003 Statut Membre Dernière intervention 20 mars 2008 - 31 janv. 2005 à 23:45
Salut :


Je cherche un programme qui calcule les valeurs de :
" racine nièmme " et " arctan " et " arcsin "
c-a-d les bibliothéques des ces fonctions
merci infiniment

6 réponses

econs Messages postés 4030 Date d'inscription mardi 13 mai 2003 Statut Membre Dernière intervention 23 décembre 2008 24
31 janv. 2005 à 10:33
L'arccosinus




Public Function InvCos(X) As Single


Pi = 3.14


For Ang = 0 To 2 * Pi Step Pi / 100


Aprox1 = Cos(Ang - Pi / 200)


Aprox2 = Cos(Ang + Pi / 200)


If Aprox1 > Aprox2 Then


Temp = Aprox1


Aprox1 = Aprox2


Aprox2 = Temp


End If


If X >= Aprox1 And X <= Aprox2 Then InvCos = Ang: Exit For


Next


End Function




L'arcsinus





Public Function InvSin(X) As Single


Pi = 3.14


For Ang = 0 To 2 * Pi Step Pi / 100


Aprox1 = Sin(Ang - Pi / 200)


Aprox2 = Sin(Ang + Pi / 200)


If Aprox1 > Aprox2 Then


Temp = Aprox1


Aprox1 = Aprox2


Aprox2 = Temp


End If


If X >= Aprox1 And X <= Aprox2 Then


InvSin = Ang: Exit For


End If


Next


End Function



ces deux fonctions étaient tirées de http://www.vbfrance.com/code.aspx?id=228

car elles n'existent pas dans VB6.



L'arctangente et la racine (non n-ième)



Private Sub Command1_Click()

Dim i As Double



i = 3.141592654

MsgBox Math.Sqr(i)

MsgBox Math.Atn(i)

End Sub



La librairie Math est inclus par défaut dans VB6.



Reste la racine n-ième ... j'vais chercher.

Manu
-------------------------------------------
Une question bien posée, c'est une chance de réponse bien adaptée.
0
mrdep1978 Messages postés 402 Date d'inscription jeudi 25 novembre 2004 Statut Membre Dernière intervention 7 juin 2009 7
31 janv. 2005 à 10:36
Dans les 3 fonctions que tu cites, seule la fonction Arctan est définie en VB.
Les autres peuvent être déduites mathématiquement des fonctions existantes et sont à faire toi-même:Racine nièmme : 2^3 8> 8^(1/3) = 2
Attention, les fonctions trigo travaillent en radians !Arcsin X Atn(X / Sqr(-X * X + 1)) (Attention : tester pour X -1 et X = 1 et renvoyer respectivement -Pi/2 et Pi/2)

Et voila un formulaire qui te donne l'ensemble des formules à partir des fonctions VB existantes :

Sécante,
Sec(X) = 1 / Cos(X),
----

Cosécante,
Cosec(X) = 1 / Sin(X),
----

Cotangente,
Cotan(X) = 1 / Tan(X),
----

Arcsinus,
Arcsin(X) = Atn(X / Sqr(-X * X + 1)),
----

Arccosinus,
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1),
----

Arcsécante,
Arcsec(X) = Atn(X / Sqr(X * X – 1)) + Sgn((X) – 1) * (2 * Atn(1)),
----

Arccosécante,
Arccosec(X) = Atn(X / Sqr(X * X – 1)) + (Sgn(X) – 1) * (2 * Atn(1)),
----

Arccotangente,
Arccotan(X) = Atn(X) + 2 * Atn(1),
----

Sinus hyperbolique,
HSin(X) = (Exp(X) – Exp(-X)) / 2,
----

Cosinus hyperbolique,
HCos(X) = (Exp(X) + Exp(-X)) / 2,
----

Tangente hyperbolique,
HTan(X) = (Exp(X) – Exp(-X)) / (Exp(X) + Exp(-X)),
----

Sécante hyperbolique,
HSec(X) = 2 / (Exp(X) + Exp(-X)),
----

Cosécante hyperbolique,
HCosec(X) = 2 / (Exp(X) – Exp(-X)),
----

Cotangente hyperbolique,
HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) – Exp(-X)),
----

Arcsinus hyperbolique,
HArcsin(X) = Log(X + Sqr(X * X + 1)),
----

Arccosinus hyperbolique,
HArccos(X) = Log(X + Sqr(X * X – 1)),
----

Arctangente hyperbolique,
HArctan(X) = Log((1 + X) / (1 – X)) / 2,
----

Arcsécante hyperbolique,
HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X),
----

Arccosécante hyperbolique,
HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X),
----

Arccotangente hyperbolique,
HArccotan(X) = Log((X + 1) / (X – 1)) / 2,
----

Logarithme de base N,
LogN(X) = Log(X) / Log(N)
0
cs_rene38 Messages postés 1858 Date d'inscription samedi 29 juin 2002 Statut Membre Dernière intervention 17 octobre 2013 11
31 janv. 2005 à 10:48
Bonjour
Attention aussi aux racines nèmes :
n étant un entier supérieur à 1, x1/n n'est défini que si x est positif.
Print (-8)^(1/3) entraîne une erreur 5.
0
mrdep1978 Messages postés 402 Date d'inscription jeudi 25 novembre 2004 Statut Membre Dernière intervention 7 juin 2009 7
31 janv. 2005 à 11:36
Bonne remarque mais je ne suis pas entièrement d'accord avec toi. Effectivement, pris comme ça, VB par en erreur. Mais mathématiquement, la fonction x1/n est définie sur les x négatifs si n est impair.
Racine_cubique(-8) = -2
La fonction doit donc tenir compte de cette particularité :

Private Function SqrN(a_Val As Long, a_Power As Integer) As Double
If a_Val < 0 And (a_Power Mod 2 = 0) Then
MsgBox "Fonction non définie sur cet intervalle"
SqrN = 0
Else
SqrN = Sgn(a_Val) * (Abs(a_Val) ^ (1 / a_Power))
End If
End Function
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
labriji Messages postés 10 Date d'inscription lundi 2 juin 2003 Statut Membre Dernière intervention 20 mars 2008
31 janv. 2005 à 23:27
merci infiniment
0
labriji Messages postés 10 Date d'inscription lundi 2 juin 2003 Statut Membre Dernière intervention 20 mars 2008
31 janv. 2005 à 23:45
merci infiniment
de la part : Labriji
0
Rejoignez-nous