-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7c927f
commit e98ca1a
Showing
54 changed files
with
4,154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq.Expressions; | ||
using System.Text; | ||
|
||
namespace YourNamespace | ||
{ | ||
public class ExpressionParser | ||
{ | ||
private readonly DataTable dataTable; | ||
|
||
public ExpressionParser() | ||
{ | ||
this.dataTable = new DataTable(); | ||
} | ||
|
||
public Expression Parse(string expression) | ||
{ | ||
try | ||
{ | ||
return new DataTable().Compute(expression, null) as double?; | ||
} | ||
catch | ||
{ | ||
throw new ArgumentException("Invalid expression"); | ||
} | ||
} | ||
|
||
public Func<double> Compile(Expression expression) | ||
{ | ||
try | ||
{ | ||
var lambda = Expression.Lambda<Func<double>>(expression); | ||
var compiled = lambda.Compile(); | ||
return compiled; | ||
} | ||
catch | ||
{ | ||
throw new ArgumentException("Invalid expression"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{A0F3C94E-C3AA-48A6-9ECD-D45C6C1E1850}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Sigmath</RootNamespace> | ||
<AssemblyName>Sigmath</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="calculus\ap.cs" /> | ||
<Compile Include="calculus\calculus.cs" /> | ||
<Compile Include="calculus\equations.cs" /> | ||
<Compile Include="calculus\matrix.cs" /> | ||
<Compile Include="computing\basic.cs" /> | ||
<Compile Include="computing\complex.cs" /> | ||
<Compile Include="computing\computing.cs" /> | ||
<Compile Include="computing\nums.cs" /> | ||
<Compile Include="computing\sets.cs" /> | ||
<Compile Include="engineering\civil.cs" /> | ||
<Compile Include="engineering\electrical.cs" /> | ||
<Compile Include="engineering\kinematics.cs" /> | ||
<Compile Include="engineering\mechanical.cs" /> | ||
<Compile Include="imp\constants.cs" /> | ||
<Compile Include="imp\equify.cs" /> | ||
<Compile Include="imp\ExpressionParser.cs" /> | ||
<Compile Include="imp\geometry.cs" /> | ||
<Compile Include="imp\logarithm.cs" /> | ||
<Compile Include="imp\polynomial.cs" /> | ||
<Compile Include="imp\time.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="imp\random.cs" /> | ||
<Compile Include="statistics\algorithms.cs" /> | ||
<Compile Include="statistics\stats.cs" /> | ||
<Compile Include="trig\const.cs" /> | ||
<Compile Include="trig\hyperbolic.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<ProjectView>ShowAllFiles</ProjectView> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.33627.172 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sigmath", "Sigmath.csproj", "{A0F3C94E-C3AA-48A6-9ECD-D45C6C1E1850}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A0F3C94E-C3AA-48A6-9ECD-D45C6C1E1850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A0F3C94E-C3AA-48A6-9ECD-D45C6C1E1850}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A0F3C94E-C3AA-48A6-9ECD-D45C6C1E1850}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A0F3C94E-C3AA-48A6-9ECD-D45C6C1E1850}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {32E5C266-A2F0-41F0-A51E-768F9ED98F5A} | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.