توابع مثلثاتی و هذلولوی در پایتون — راهنمای کاربردی

۱۷۰۳ بازدید
آخرین به‌روزرسانی: ۰۷ اسفند ۱۴۰۲
زمان مطالعه: ۴ دقیقه
توابع مثلثاتی و هذلولوی در پایتون — راهنمای کاربردی

در این مطلب، توابع مثلثاتی و هذلولوی در پایتون مورد بررسی قرار گرفته‌اند. این توابع، از جمله توابع اعداد مختلط مهم محسوب می‌شوند.

توابع مثلثاتی و هذلولوی در پایتون

توابع مثلثاتی پایتون در ادامه معرفی شده‌اند.

  • sin()‎: این تابع، سینوس عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • cos()‎: این تابع، کسینوس عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • tan()‎: این تابع، تانژانت عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.

در کدهای زیر، روش استفاده از هر یک از این توابع، آموزش داده شده است.

1# Python code to demonstrate the working of  
2# sin(), cos(), tan() 
3   
4# importing "cmath" for complex number operations 
5import cmath 
6   
7# Initializing real numbers 
8x = 1.0
9   
10y = 1.0
11  
12# converting x and y into complex number z 
13z = complex(x,y); 
14  
15# printing sine of the complex number 
16print ("The sine value of complex number is : ",end="") 
17print (cmath.sin(z)) 
18  
19# printing cosine of the complex number 
20print ("The cosine value of complex number is : ",end="") 
21print (cmath.cos(z)) 
22  
23# printing tangent of the complex number 
24print ("The tangent value of complex number is : ",end="") 
25print (cmath.tan(z))

خروجی کدهای بالا، به صورت زیر است.

The sine value of complex number is : (1.2984575814159773+0.6349639147847361j)
The cosine value of complex number is : (0.8337300251311491-0.9888977057628651j)
The tangent value of complex number is : (0.2717525853195118+1.0839233273386946j)
  • asin()‎: این تابع مقدار آرک سینوس عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • acos()‎: این تابع، آرک کسینوس عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • atan()‎: این تابع، مقدار آرک تانژانت عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.

در کدهای زیر، روش استفاده از هر یک از توابع بیان شده، آموزش داده شده است.

1# Python code to demonstrate the working of  
2# asin(), acos(), atan() 
3   
4# importing "cmath" for complex number operations 
5import cmath 
6   
7# Initializing real numbers 
8x = 1.0
9   
10y = 1.0
11  
12# converting x and y into complex number z 
13z = complex(x,y); 
14  
15# printing arc sine of the complex number 
16print ("The arc sine value of complex number is : ",end="") 
17print (cmath.asin(z)) 
18  
19# printing arc cosine of the complex number 
20print ("The arc cosine value of complex number is : ",end="") 
21print (cmath.acos(z)) 
22  
23# printing arc tangent of the complex number 
24print ("The arc tangent value of complex number is : ",end="") 
25print (cmath.atan(z))

خروجی قطعه کد بالا، به صورت زیر است.

The arc sine value of complex number is : (0.6662394324925153+1.0612750619050357j)
The arc cosine value of complex number is : (0.9045568943023814-1.0612750619050357j)
The arc tangent value of complex number is : (1.0172219678978514+0.40235947810852507j)
  • sinh()‎: این تابع، سینوس هذلولوی عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • cosh()‎: این تابع، کسینوس هذلولوی عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • tanh()‎: این تابع، تانژانت هذلولوی عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.

در ادامه، روش استفاده از این توابع در کدهای پایتون، بیان شده است.

1# Python code to demonstrate the working of  
2# sinh(), cosh(), tanh() 
3   
4# importing "cmath" for complex number operations 
5import cmath 
6   
7# Initializing real numbers 
8x = 1.0
9   
10y = 1.0
11  
12# converting x and y into complex number z 
13z = complex(x,y); 
14  
15# printing hyperbolic sine of the complex number 
16print ("The hyperbolic sine value of complex number is : ",end="") 
17print (cmath.sinh(z)) 
18  
19# printing hyperbolic cosine of the complex number 
20print ("The hyperbolic cosine value of complex number is : ",end="") 
21print (cmath.cosh(z)) 
22  
23# printing hyperbolic tangent of the complex number 
24print ("The hyperbolic tangent value of complex number is : ",end="") 
25print (cmath.tanh(z)) 

خروجی قطعه کد بالا، به صورت زیر است.

The hyperbolic sine value of complex number is : (0.6349639147847361+1.2984575814159773j)
The hyperbolic cosine value of complex number is : (0.8337300251311491+0.9888977057628651j)
The hyperbolic tangent value of complex number is : (1.0839233273386946+0.2717525853195117j)
  • asinh()‎: این تابع، تابع وارون هذلولوی سینوس عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • acosh()‎: این تابع، تابع وارون هذلولوی کسینوس عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.
  • atanh()‎: این تابع، تابع وارون هذلولوی تانژانت عدد مختلطی که به عنوان آرگومان به آن داده شده است را باز می‌گرداند.

در کدهای زیر، روش استفاده از هر یک از این توابع، آموزش داده شده است.

1# Python code to demonstrate the working of  
2# asinh(), acosh(), atanh() 
3   
4# importing "cmath" for complex number operations 
5import cmath 
6   
7# Initializing real numbers 
8x = 1.0
9   
10y = 1.0
11  
12# converting x and y into complex number z 
13z = complex(x,y); 
14  
15# printing inverse hyperbolic sine of the complex number 
16print ("The inverse hyperbolic sine value of complex number is : ",end="") 
17print (cmath.asinh(z)) 
18  
19# printing inverse hyperbolic cosine of the complex number 
20print ("The inverse hyperbolic cosine value of complex number is : ",end="") 
21print (cmath.acosh(z)) 
22  
23# printing inverse hyperbolic tangent of the complex number 
24print ("The inverse hyperbolic tangent value of complex number is : ",end="") 
25print (cmath.atanh(z)) 

خروجی قطعه کد بالا، به صورت زیر است.

The inverse hyperbolic sine value of complex number is : (1.0612750619050357+0.6662394324925153j)
The inverse hyperbolic cosine value of complex number is : (1.0612750619050357+0.9045568943023813j)
The inverse hyperbolic tangent value of complex number is : (0.40235947810852507+1.0172219678978514j)

اگر نوشته بالا برای شما مفید بوده است، آموزش‌های زیر نیز به شما پیشنهاد می‌شوند:

^^

بر اساس رای ۰ نفر
آیا این مطلب برای شما مفید بود؟
اگر بازخوردی درباره این مطلب دارید یا پرسشی دارید که بدون پاسخ مانده است، آن را از طریق بخش نظرات مطرح کنید.
منابع:
GeeksforGeeks
نظر شما چیست؟

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *