A cikin duniyar ilimin lissafi, yanki na daidaitaccen ra'ayi shine ainihin ra'ayi wanda aka yi amfani da shi sosai a aikace-aikace daban-daban, kamar gine-gine, injiniyanci, da ฦira. Fahimta da ฦididdige yanki na layi ษaya yana da mahimmanci don magance matsaloli masu yawa, kuma yana iya taimaka muku don godiya da kyau da ayyuka na siffofi na geometric. Don sauฦaฦe wannan aikin, za mu iya amfani da ikon Python, sanannen yaren shirye-shirye da aka sani da sauฦi da iya karantawa. A cikin wannan labarin, za mu binciko dabara don tantance yanki na parallelogram, rubuta lambar Python mataki-mataki don ฦididdige shi, da kuma tattauna wasu ษakunan karatu da ayyuka masu alaฦa waษanda za su iya zama masu amfani ga matsalolin geometric iri ษaya.
Don farawa, bari mu fahimci dabarar nemo yanki na daidaici. Ana iya ฦididdige yanki (A) ta hanyar ninka tushe (b) na daidaici da tsayinsa (h) kuma ana wakilta ta ta hanyar lissafi kamar haka:
A=b*h
Don aiwatar da wannan dabarar a cikin Python, zamu iya ฦirฦirar aikin da ke ษaukar tushe da tsayi azaman sigogin shigarwa. Anan ga bayanin mataki-mataki na lambar da ke ฦididdige yanki na daidaici:
def area_of_parallelogram(base, height): area = base * height return area
A cikin lambar da ke sama, mun ayyana wani aiki mai suna `yankin_parallelogram`, wanda ke ษaukar gardamar shigarwa guda biyu: `tushe` da `tsawo`. A cikin aikin, muna ฦididdige wurin ta hanyar ninka ฦimar 'tushe' da 'tsawo', sannan mu adana sakamakon a cikin maษalli mai suna 'yanki'. A ฦarshe, muna mayar da ฦimar 'yankin' ga mai kira.
Yanzu, bari mu tattauna wasu dakunan karatu da ayyuka masu alaฦa waษanda zasu iya zama da amfani yayin da ake fuskantar matsalolin geometric.
m
m (gajeren "Python Lambobi") ษakin karatu ne mai ฦarfi kuma ana amfani da shi sosai don yin ayyukan lambobi da aiki tare da tsararraki masu girma dabam. Yana ba da ayyuka masu amfani da yawa don algebra na layi, haษa lamba, da haษakawa. ฦayan aikin da za a iya amfani da shi don ฦididdige yanki na daidaici shine aikin 'cross' na numpy, wanda ke ฦididdige samfurin giciye na vector biyu. Samfurin giciye na iya samar da yankin layi daya da waษannan vectors suka kirkira.
tausayi
tausayi wani ษakin karatu ne wanda zai iya taimakawa wajen magance matsalolin geometric. Laburaren buษewa ne na Python don lissafi na alama wanda zai iya sauฦaฦa kalmomin algebra, warware daidaito, aiwatar da ayyukan ฦididdiga, da ฦari mai yawa. Tare da tausayawa, zaku iya sauri ayyana da sarrafa maganganun alamomi masu alaฦa da lissafi, gami da gano yanki na siffofi daban-daban.
Ga misali na ฦididdige yanki na daidaici ta amfani da tausayi:
from sympy import symbols, Eq, solve base, height, area = symbols('b h A') eq = Eq(area, base * height) area_formula = solve(eq, area)[0]
A ฦarshe, fahimtar yankin layi ษaya yana da mahimmanci ga aikace-aikacen lissafi daban-daban. Python, tare da dakunan karatu masu ฦarfi kamar ฦididdigewa da tausayi, yana sauฦaฦa ฦididdige yanki na daidaici da magance matsalolin geometric masu alaฦa. Yanzu da kuka san yadda ake nemo yankin layi ษaya ta amfani da Python, zaku iya amfani da waษannan ฦwarewar don magance wasu ฦalubalen geometric ko haษa su da ilimin ku na ฦirar ฦirar ฦira mai ban sha'awa kuma daidaitattun daidaito.