diff --git a/CHANGELOG.md b/CHANGELOG.md index e859dce..25db6e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.1 + +- `DynamicNumber`: + - Added `sin` and `cos`. + +- test: ^1.25.8 +- coverage: ^1.8.0 + ## 1.1.0 - sdk: '>=3.3.0 <4.0.0' diff --git a/lib/src/statistics_decimal.dart b/lib/src/statistics_decimal.dart index 0b0d4df..8e3adef 100644 --- a/lib/src/statistics_decimal.dart +++ b/lib/src/statistics_decimal.dart @@ -1417,6 +1417,12 @@ class Decimal implements DynamicNumber { @override DynamicInt operator ~() => ~toDynamicInt(); + @override + Decimal get sin => Decimal.fromDouble(math.sin(toDouble())); + + @override + Decimal get cos => Decimal.fromDouble(math.cos(toDouble())); + @override Decimal get square => this * this; diff --git a/lib/src/statistics_dynamic_int.dart b/lib/src/statistics_dynamic_int.dart index 876efa6..c177e98 100644 --- a/lib/src/statistics_dynamic_int.dart +++ b/lib/src/statistics_dynamic_int.dart @@ -313,6 +313,12 @@ abstract class DynamicNumber> /// Euclidean modulo for [DynamicInt] [n2]. T moduloDynamicInt(DynamicInt n2); + /// The sine of this number. + Decimal get sin; + + /// The cosine of this number. + Decimal get cos; + /// The square of this number. T get square; @@ -815,6 +821,12 @@ abstract class DynamicInt implements DynamicNumber { @override DynamicInt moduloDynamicInt(DynamicInt other); + @override + Decimal get sin => Decimal.fromDouble(math.sin(toInt())); + + @override + Decimal get cos => Decimal.fromDouble(math.cos(toInt())); + @override DynamicInt get square => (this * this).toDynamicInt(); diff --git a/lib/src/statistics_forecast.dart b/lib/src/statistics_forecast.dart index 304b4ce..fcfcd28 100644 --- a/lib/src/statistics_forecast.dart +++ b/lib/src/statistics_forecast.dart @@ -168,7 +168,7 @@ abstract class EventForecaster { if (dependencyNotificationRatio >= 1 || _random.nextDouble() < dependencyNotificationRatio) { var dependentObservations = - combination.map((id) => observationsByID[id]).whereNotNull(); + combination.map((id) => observationsByID[id]).nonNulls; _notifyConclusion(source, dependentObservations, event, value, dependency: true); diff --git a/pubspec.yaml b/pubspec.yaml index 0363898..5dfadd3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: statistics description: Statistics package for easy and efficient data manipulation with built-in Bayesian Network (Bayes Net), many mathematical functions and tools. -version: 1.1.0 +version: 1.1.1 homepage: https://github.com/gmpassos/statistics environment: @@ -13,9 +13,9 @@ dependencies: dev_dependencies: lints: ^3.0.0 - test: ^1.25.2 + test: ^1.25.8 dependency_validator: ^3.2.3 - coverage: ^1.7.2 + coverage: ^1.8.0 #dependency_overrides: # data_serializer: