An warware: Math Module digiri%28%29 Aiki

Ayyukan digiri () Math Module a Python kayan aiki ne mai ฦ™arfi wanda ke ba ku damar sauya radians zuwa digiri cikin sauri kuma daidai. Bukatar canzawa tsakanin waษ—annan raka'a biyu ya zama ruwan dare a fagage daban-daban, gami da lissafi, kimiyyar lissafi, da injiniyanci. A cikin wannan labarin, za mu nutse cikin zurfin aikin digiri (), yanayin amfani da shi, da yadda yake aiki. Za mu kuma ba da kwatanci mataki-mataki na aiwatar da shi a cikin lamba kuma za mu tattauna wasu ayyuka masu alaฦ™a da ษ—akunan karatu waษ—anda za su iya taimaka muku a cikin ฦ™oฦ™arin ku na ilimin lissafi.

Gabatarwa

Juyawa tsakanin radians da digiri wani muhimmin bangare ne na duka asali da kuma ci-gaban lissafi. Radians da digiri raka'a ne na ma'auni don kusurwoyi, kuma ana amfani da su don bayyana girman juyawar da'irar. Duk da yake ana san digiri da fahimta sosai, radians suna ba da hanyar da ta dace ta lissafi ta wakiltar kusurwoyi da yin ฦ™ididdiga mafi ฦ™warewa da madaidaiciya.

Module Math na Python ya ฦ™unshi ginannen ciki digiri() aikin da zai iya ษ—aukar kwana a cikin radians azaman shigarwa kuma ya dawo da daidai ฦ™imarsa a cikin digiri. Wannan aikin yana sauฦ™aฦ™a tsarin jujjuya kusurwa don masu shirye-shirye kuma yana kawar da ฦ™ididdige ฦ™ididdiga na hannu.

Aiwatar da aikin digiri()

Don amfani da aikin digiri () a Python, kuna buฦ™atar shigo da ilimin lissafi module farko. Da zarar an shigo da tsarin, kuna da damar zuwa aikin digiri() da duk sauran ayyukan lissafin da ke ฦ™unshe a cikin tsarin. Anan ga yadda zaku iya amfani da aikin digiri():

import math

radians = 1.57
degrees = math.degrees(radians)
print(degrees)

A cikin wannan misali, muna shigo da tsarin lissafi kuma mu sanya kusurwa a cikin radians (1.57) zuwa 'radians' masu canzawa. Sai mu yi amfani da digiri() aiki don canza kusurwa zuwa digiri kuma adana sakamakon a cikin 'digiri' masu canzawa. A ฦ™arshe, muna buga sakamakon.

Fahimtar Code

Bari mu zurfafa cikin kowane mataki don tabbatar da cewa mun fahimci yadda lambar ke aiki.

1. Shigo da tsarin lissafi: Ta shigo da tsarin lissafi, muna samun dama ga aikin digiri() ban da sauran ayyukan lissafi masu yawa.

  import math
  

2. Sanya kusurwa a cikin radians: Muna adana kusurwar a cikin radians (1.57) a cikin ma'anar "radians."

  radians = 1.57
  

3. Yi amfani da aikin digiri(): Muna amfani da aikin digiri () don canza kusurwar radians zuwa digiri kuma adana sakamakon a cikin "digiri".

  degrees = math.degrees(radians)
  

4. Buga sakamakon: Muna buga kusurwar da aka canza a digiri (digiri 89.954).

  print(degrees)
  

Ayyuka masu alaฦ™a da ษ—akunan karatu

Module na Lissafi yana ba da fiye da aikin digiri() kawai. Akwai wasu ayyuka masu alaฦ™a da ษ—akunan karatu waษ—anda zasu iya taimaka muku yin lissafin lissafi daban-daban.

  • math.radians(): Wannan aikin yana canza kwana daga digiri zuwa radians. Yana da sabanin aikin digiri() kuma yana ba da damar juyawa gaba da gaba tsakanin radians da digiri.
  • math.sin(), math.cos(), math.tan(): Waษ—annan ayyukan trigonometric suna ษ—aukar kusurwoyi a cikin radians azaman shigarwa kuma suna dawo da sine, cosine, da tangent na kwana, bi da bi. Ana iya haษ—a su tare da ayyukan digiri () da radians () lokacin da ake buฦ™ata.
  • nusaiba: Shahararren ษ—akin karatu don ฦ™ididdige ฦ™ididdiga a Python, numpy yana ba da ayyuka daban-daban na lissafi da kuma tsarin bayanai wanda ke sauฦ™aฦ™e aiwatar da hadaddun ayyuka na lissafi.

A ฦ™arshe, aikin digiri () Math Module a Python yana da matukar amfani ga juyar da radians zuwa digiri. Yana da sauฦ™i don aiwatarwa kuma yana taimakawa sosai a cikin aikace-aikacen lissafi daban-daban. Ayyuka masu alaฦ™a kamar math.radians() da dakunan karatu kamar numpy suna ฦ™ara haษ“aka ikon yin ayyukan lissafi a Python.

Shafi posts:

Leave a Comment