Skip to content

Commit

Permalink
Merge pull request #752 from sys27/dev
Browse files Browse the repository at this point in the history
xFunc 4.4.1
  • Loading branch information
sys27 authored Dec 10, 2023
2 parents 108f240 + 91c05a1 commit 9263f6e
Show file tree
Hide file tree
Showing 49 changed files with 307 additions and 487 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: "7.0.x"
dotnet-version: "8.0.x"

- run: |
dotnet restore xFunc.sln
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x'
dotnet-version: '8.x'

- run: dotnet build -c Release xFunc.sln
- run: dotnet tool update -g docfx
Expand Down
4 changes: 2 additions & 2 deletions CI/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:

steps:
- task: UseDotNet@2
displayName: 'Install .NET 7'
displayName: 'Install .NET 8'
inputs:
packageType: 'sdk'
version: '7.0.x'
version: '8.0.x'

- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
Expand Down
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit.Analyzers" Version="3.6.1" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit.Analyzers" Version="3.9.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<PackageVersion Include="System.Collections.Immutable" Version="7.0.0" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.8" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.11" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="ReportGenerator" Version="5.1.25" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="ReportGenerator" Version="5.2.0" />
</ItemGroup>
</Project>
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ Note: The WPF application (xFunc UI) was migrated to a separate repository [xFun

## Features:

* Calculating expressions ([supported functions and operators](https://sys27.github.io/xFunc/articles/supported-functions-and-operations.html));
* Supporting measures of angles;
* Derivative and simplifying expressions;
* Plotting graphs;
* Truth tables;
* Evaluate expressions (see all [supported functions and operators](https://sys27.github.io/xFunc/articles/supported-functions-and-operations.html)):
* basic arithmetic operators: `+`, `-`, `*`, `/`, `^`, etc.
* trigonometric functions: `sin(x)`, `cos(x)`, `tan(x)`, etc.
* inverse trigonometric functions: `arcsin(x)`, `arccos(x)`, `arctan(x)`, etc.
* hyperbolic functions:`sinh(x)`, `cosh(x)`, `tanh(x)`, etc.
* inverse hyperbolic functions: `arsinh(x)`, `arcosh(x)`, `artanh(x)`, etc.
* complex numbers: `1 + 2i`, `im(x)`, `re(x)`, etc.
* vector/matrix: `{1, 2, 3}`, `{{1, 2}, {3, 4}}`, etc.
* statistical: `sum(a, b, c)`, `avg(a, b, c)`, etc.
* bitwise operators: `x or y`, `x and y`, etc.
* units: `90 'deg'` - angles, `10 'm'` - length, `10 'min'` - time, etc.
* lambdas: `f := (x) => x ^ 2`, `((x) => x ^ 2)(3)`, `curry(f)`, etc.
* Derivative calculation;
* Simplify expressions ([simplification rules](https://sys27.github.io/xFunc/articles/simplification-rules.html));
* Supported Framework: .NET 6+;

## Usage
Expand Down Expand Up @@ -85,8 +94,6 @@ processor.Simplify("arcsin(sin(x))");
// will return simplified expression = "x"
```

_Detailed [simplification rules](https://sys27.github.io/xFunc/articles/simplification-rules.html)_

**Differentiate:**

```csharp
Expand Down
8 changes: 8 additions & 0 deletions docs/articles/change-log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ChangeLog

## xFunc v4.5.0 (dev)

## xFunc v4.4.1

* [#733](https://github.com/sys27/xFunc/pull/733) - Lexer optimization.
* [#743](https://github.com/sys27/xFunc/issues/743) - Upgrade to .NET 8. ([#744](https://github.com/sys27/xFunc/pull/744))
* [#749](https://github.com/sys27/xFunc/issues/749) - Remove the obsolete serialization APIs. ([#750](https://github.com/sys27/xFunc/pull/750))

## xFunc v4.4.0

* [#680](https://github.com/sys27/xFunc/issues/680) - Remove Moq. ([#651](https://github.com/sys27/xFunc/pull/651)).
Expand Down
293 changes: 146 additions & 147 deletions docs/articles/supported-functions-and-operations.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "4.4.0",
"version": "4.4.1",
"assemblyVersion": {
"precision": "revision"
},
Expand Down
2 changes: 1 addition & 1 deletion xFunc.Benchmark/xFunc.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
10 changes: 5 additions & 5 deletions xFunc.Cli/xFunc.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<PackAsTool>true</PackAsTool>
<ToolCommandName>xfunc</ToolCommandName>
<PackageId>xFunc.Cli</PackageId>
<Version>4.4.0</Version>
<Version>4.4.1</Version>
<Product>xFunc.Maths</Product>
<Authors>Dmytro Kyshchenko</Authors>
<Company />
<Copyright>Copyright ©2012-2023 Dmytro Kyshchenko</Copyright>
<Description>xFunc provides a powerful parser and analyzer for mathematical expressions. It excels at calculating derivatives, simplifying expressions, and achieving high performance.</Description>
<PackageProjectUrl>https://github.com/sys27/xFunc</PackageProjectUrl>
<PackageIcon>xFunc.png</PackageIcon>
<PackageTags>math formula parse parser math-parser logic simplification derivative differentiation truth-table condition complex-numbers trigonometry unit-converter</PackageTags>
<AssemblyVersion>4.4.0</AssemblyVersion>
<FileVersion>4.4.0</FileVersion>
<PackageTags>math formula parse parser math-parser logic simplification derivative differentiation condition complex-numbers trigonometry unit-converter</PackageTags>
<AssemblyVersion>4.4.1</AssemblyVersion>
<FileVersion>4.4.1</FileVersion>
<RepositoryUrl>https://github.com/sys27/xFunc</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<PackageReleaseNotes>https://sys27.github.io/xFunc/articles/change-log.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Globalization;
using System.Runtime.Serialization;

namespace xFunc.Maths.Analyzers.TypeAnalyzers;

Expand Down Expand Up @@ -79,14 +78,4 @@ public BinaryParameterTypeMismatchException(string message, Exception inner)
: base(message, inner)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="BinaryParameterTypeMismatchException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected BinaryParameterTypeMismatchException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Globalization;
using System.Runtime.Serialization;

namespace xFunc.Maths.Analyzers.TypeAnalyzers;

Expand Down Expand Up @@ -48,14 +47,4 @@ public DifferentParameterTypeMismatchException(string message, Exception inner)
: base(message, inner)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="DifferentParameterTypeMismatchException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected DifferentParameterTypeMismatchException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Globalization;
using System.Runtime.Serialization;

namespace xFunc.Maths.Analyzers.TypeAnalyzers;

Expand Down Expand Up @@ -64,16 +63,6 @@ public ParameterTypeMismatchException(string message, Exception inner)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ParameterTypeMismatchException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected ParameterTypeMismatchException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

/// <summary>
/// Gets the expected parameter type.
/// </summary>
Expand Down
14 changes: 7 additions & 7 deletions xFunc.Maths/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Builder Add(IExpression summand)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Add(double summand)
=> Add((IExpression)new Number(summand));
=> Add(new Number(summand));

/// <summary>
/// Creates the <seealso cref="Expressions.Add"/> operation. The Current state is used as summand.
Expand Down Expand Up @@ -109,7 +109,7 @@ public Builder Div(IExpression denominator)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Div(double denominator)
=> Div((IExpression)new Number(denominator));
=> Div(new Number(denominator));

/// <summary>
/// Creates the <seealso cref="Expressions.Div"/> operation. The Current state is used as numerator.
Expand Down Expand Up @@ -152,7 +152,7 @@ public Builder Mul(IExpression factor)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Mul(double factor)
=> Mul((IExpression)new Number(factor));
=> Mul(new Number(factor));

/// <summary>
/// Creates the <seealso cref="Expressions.Mul"/> operation. The Current state is used as factor.
Expand Down Expand Up @@ -183,7 +183,7 @@ public Builder Log(IExpression @base)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Log(double @base)
=> Log((IExpression)new Number(@base));
=> Log(new Number(@base));

/// <summary>
/// Creates the <seealso cref="Expressions.Log"/> operation. The Current state is used as argument.
Expand Down Expand Up @@ -250,7 +250,7 @@ public Builder Pow(IExpression exponent)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Pow(double exponent)
=> Pow((IExpression)new Number(exponent));
=> Pow(new Number(exponent));

/// <summary>
/// Creates the <seealso cref="Expressions.Pow"/> operation. The Current state is used as base of power.
Expand Down Expand Up @@ -281,7 +281,7 @@ public Builder Root(IExpression degree)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Root(double degree)
=> Root((IExpression)new Number(degree));
=> Root(new Number(degree));

/// <summary>
/// Creates the <seealso cref="Expressions.Root"/> operation. The Current state is used as radicand.
Expand Down Expand Up @@ -324,7 +324,7 @@ public Builder Sub(IExpression subtrahend)
/// <returns>The builder.</returns>
/// <exception cref="ArgumentNullException">The Current builder is empty.</exception>
public Builder Sub(double subtrahend)
=> Sub((IExpression)new Number(subtrahend));
=> Sub(new Number(subtrahend));

/// <summary>
/// Creates the <seealso cref="Expressions.Sub"/> operation. The Current state is used as minuend.
Expand Down
11 changes: 0 additions & 11 deletions xFunc.Maths/Expressions/ExecutionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;

namespace xFunc.Maths.Expressions;

Expand Down Expand Up @@ -40,16 +39,6 @@ public ExecutionException(string message, Exception inner)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ExecutionException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected ExecutionException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

/// <summary>
/// Creates an instance of <see cref="ExecutionException"/> with the message of unsupported result.
/// </summary>
Expand Down
12 changes: 0 additions & 12 deletions xFunc.Maths/Expressions/Matrices/InvalidMatrixException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Runtime.Serialization;

namespace xFunc.Maths.Expressions.Matrices;

/// <summary>
Expand Down Expand Up @@ -36,14 +34,4 @@ public InvalidMatrixException(string message, Exception inner)
: base(message, inner)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InvalidMatrixException"/> class.
/// </summary>
/// <param name="info">The object that holds the serialized object data.</param>
/// <param name="context">The contextual information about the source or destination.</param>
protected InvalidMatrixException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
8 changes: 4 additions & 4 deletions xFunc.Maths/Expressions/Matrices/VectorValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ public NumberValue Average()
/// <returns>The sum of the values in the vector.</returns>
public NumberValue Sum()
{
var sum = NumberValue.Zero;
var sum = 0.0;

for (var i = 0; i < Size; i++)
sum += array[i];
for (var i = 0; i < array.Length; i++)
sum += array[i].Number;

return sum;
return new NumberValue(sum);
}

/// <summary>
Expand Down
12 changes: 0 additions & 12 deletions xFunc.Maths/Expressions/Parameters/ParameterIsReadOnlyException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Runtime.Serialization;

namespace xFunc.Maths.Expressions.Parameters;

/// <summary>
Expand Down Expand Up @@ -60,16 +58,6 @@ public ParameterIsReadOnlyException(string message, string parameterName, Except
ParameterName = parameterName;
}

/// <summary>
/// Initializes a new instance of the <see cref="ParameterIsReadOnlyException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected ParameterIsReadOnlyException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

/// <summary>
/// Gets the parameter name.
/// </summary>
Expand Down
Loading

0 comments on commit 9263f6e

Please sign in to comment.