Skip to content

Commit db4213a

Browse files
committed
+ figure
1 parent 721acf9 commit db4213a

File tree

8 files changed

+27346
-2
lines changed

8 files changed

+27346
-2
lines changed

ErrorFunctionApproximation.sln

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ VisualStudioVersion = 17.3.32922.545
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ErrorFunctionApproximation", "ErrorFunctionApproximation\ErrorFunctionApproximation.csproj", "{290642DE-3B29-4E63-B7EF-84D140D302CB}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErrorFunctionFP64", "ErrorFunctionFP64\ErrorFunctionFP64.csproj", "{FF9ACC99-FBB4-4646-A4D9-F5598538AAFD}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ErrorFunctionFP64", "ErrorFunctionFP64\ErrorFunctionFP64.csproj", "{FF9ACC99-FBB4-4646-A4D9-F5598538AAFD}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErrorFunctionFP64Tests", "ErrorFunctionFP64Tests\ErrorFunctionFP64Tests.csproj", "{62247D87-1BD6-48B2-8D68-F1F06F22B48D}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ErrorFunctionFP64Tests", "ErrorFunctionFP64Tests\ErrorFunctionFP64Tests.csproj", "{62247D87-1BD6-48B2-8D68-F1F06F22B48D}"
11+
EndProject
12+
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "PlotSummary", "PlotSummary\PlotSummary.pyproj", "{44142E82-5DEC-4BF8-B3FC-492D04C582F4}"
1113
EndProject
1214
Global
1315
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -27,6 +29,8 @@ Global
2729
{62247D87-1BD6-48B2-8D68-F1F06F22B48D}.Debug|Any CPU.Build.0 = Debug|Any CPU
2830
{62247D87-1BD6-48B2-8D68-F1F06F22B48D}.Release|Any CPU.ActiveCfg = Release|Any CPU
2931
{62247D87-1BD6-48B2-8D68-F1F06F22B48D}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{44142E82-5DEC-4BF8-B3FC-492D04C582F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{44142E82-5DEC-4BF8-B3FC-492D04C582F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
3034
EndGlobalSection
3135
GlobalSection(SolutionProperties) = preSolution
3236
HideSolutionNode = FALSE

PlotSummary/PlotSummary.pyproj

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
2+
<PropertyGroup>
3+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4+
<SchemaVersion>2.0</SchemaVersion>
5+
<ProjectGuid>44142e82-5dec-4bf8-b3fc-492d04c582f4</ProjectGuid>
6+
<ProjectHome>.</ProjectHome>
7+
<StartupFile>_main.py</StartupFile>
8+
<SearchPath>
9+
</SearchPath>
10+
<WorkingDirectory>.</WorkingDirectory>
11+
<OutputPath>.</OutputPath>
12+
<Name>PlotSummary</Name>
13+
<RootNamespace>PlotSummary</RootNamespace>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
22+
</PropertyGroup>
23+
<ItemGroup>
24+
<Compile Include="_main.py" />
25+
</ItemGroup>
26+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
27+
<!-- Uncomment the CoreCompile target to enable the Build command in
28+
Visual Studio and specify your pre- and post-build commands in
29+
the BeforeBuild and AfterBuild targets below. -->
30+
<!--<Target Name="CoreCompile" />-->
31+
<Target Name="BeforeBuild">
32+
</Target>
33+
<Target Name="AfterBuild">
34+
</Target>
35+
</Project>

PlotSummary/_main.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import numpy as np
2+
import pandas as pd
3+
import matplotlib.pyplot as plt
4+
5+
dirpath_summary = '../results/'
6+
suffix_summary = '.csv'
7+
8+
dirpath_figure = '../figures/'
9+
suffix_figure = '.svg'
10+
11+
targets = [
12+
'erf_approx',
13+
'erfc_approx',
14+
'inverf_approx',
15+
'inverfc_approx',
16+
]
17+
18+
for target in targets:
19+
data = pd.read_csv(dirpath_summary + target + suffix_summary)
20+
21+
x, y, err = data['x'], data['y_actual'], data['error(rate)']
22+
err = np.where(np.abs(y) < 1e-305, 0, err)
23+
24+
plt.clf()
25+
fig = plt.figure(figsize=(12, 6))
26+
27+
ax1 = fig.add_subplot(2, 1, 1)
28+
ax2 = fig.add_subplot(2, 1, 2)
29+
30+
ax1.plot(x, y)
31+
ax1.grid()
32+
ax1.set_ylabel('actual')
33+
34+
ax2.plot(x, err)
35+
ax2.grid()
36+
ax2.set_ylabel('error(rate)')
37+
38+
plt.savefig(dirpath_figure + target + suffix_figure, bbox_inches='tight')

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@ Let N be the recursion times (Fn+4(z) to Fn(z)), and N until convergence is as f
8282

8383
## Double Precision (IEEE 754) Approx
8484
[C# code](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/ErrorFunctionFP64/ErrorFunction.cs)
85+
8586
[erf result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/results/erf_approx.csv)
87+
[erf result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/figures/erf_approx.svg)
8688
[erfc result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/results/erfc_approx.csv)
89+
[erfc result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/figures/erfc_approx.svg)
8790
[inverse erf result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/results/inverf_approx.csv)
91+
[inverse erf result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/figures/inverf_approx.svg)
8892
[inverse erfc result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/results/inverfc_approx.csv)
93+
[inverse erfc result](https://github.com/tk-yoshimura/ErrorFunctionApproximation/blob/main/figures/inverfc_approx.svg)
8994

9095
The following is used to approximate the error of machine epsilon in the entire domain.
9196

0 commit comments

Comments
 (0)