0% found this document useful (0 votes)
7 views

Math Function

Uploaded by

ismailovich1904
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Math Function

Uploaded by

ismailovich1904
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Math function

Tuesday, May 28, 2024 2:18 PM

dart:math is one of Dart’s core libraries. Adding the import


statement tells the compiler that you want to use something
from that library.

import 'dart:math';

Note: Remember that if you want to see the values of


these mathematical expressions, you need to put them
inside a print statement like this:
print(sin(45 * pi / 180));

. Constants 2. Basic Mathematical Functions


• e: The base of natural logarithms, approximately • sqrt(num x): Returns the square root of x.
2.718. • pow(num x, num exponent): Returns x raised to
• pi: The ratio of the circumference of a circle to its the power of exponent.
diameter, approximately 3.14159. • exp(num x): Returns e raised to the power of x.
• sqrt2: The square root of 2, approximately 1.414. • log(num x): Returns the natural logarithm of x.
• log2e: The base-2 logarithm of e. • max(num a, num b): Returns the larger of two
• log10e: The base-10 logarithm of e. numbers.
• ln2: The natural logarithm of 2. • min(num a, num b): Returns the smaller of two
• ln10: The natural logarithm of 10. numbers.
• abs(num x): Returns the absolute value of x.
• sign(num x): Returns the sign of x (-1, 0, or 1).

Trigonometric Functions
• sin(num x): Returns the sine of x (x is in 4. Random Number Generation
radians). • Random: A class to generate random numbers. You can
• cos(num x): Returns the cosine of x (x is in create an instance of Random and use its methods:
radians). • nextInt(int max): Returns a random integer from
• tan(num x): Returns the tangent of x (x is in 0 (inclusive) to max (exclusive).
radians). • nextDouble(): Returns a random double between
• asin(num x): Returns the arc sine of x in 0.0 (inclusive) and 1.0 (exclusive).
radians. • nextBool(): Returns a random boolean value.
• acos(num x): Returns the arc cosine of x in
radians.
• atan(num x): Returns the arc tangent of x in
radians.
• atan2(num y, num x): Returns the angle (in
radians) between the positive x-axis and the
point (x, y).

Dart Page 1

You might also like