JJ.Framework.Mathematics
1.5.6877.41334
Interpolator Smooth Bezier Cubic Hermite TextPlotter NumberBases ToBase FromBase ToHex FromHex ToLetterSequence FromLetterSequence Randomizer GetRandomItem GetInt32 GetDouble GetSingle IsInRectangle GetCenter AbsoluteDistance IsPowerOf2 LogRatio RoundToSignificantDigits RoundWithStep ScaleLinearly SpeadItems SpreadIntegers SpreadDoubles. Integer variation of Pow and Log.
InstallPackage JJ.Framework.Mathematics Version 1.5.6877.41334
dotnet add package JJ.Framework.Mathematics version 1.5.6877.41334
<PackageReference Include="JJ.Framework.Mathematics" Version="1.5.6877.41334" />
paket add JJ.Framework.Mathematics version 1.5.6877.41334
JJ.Framework.Mathematics
Helpers for calculations.
 Plotting graphs in text output.
 Interpolation
 Basen numbering systems
 Special rounding methods
 Use the
Random
class more easily  Simple geometric calculations
 Other basic math helpers.
TextPlotter
Plot function output in text mode. Example call:
IList<string> plot = TextPlotter.Plot(
new[] { 0.0, 0.7, 1.0, 0.7, 0.0, 0.7, 1.0, 0.7, 0.0 },
columnCount: 5,
lineCount: 7);
Example output:
■■■■■■
■■ ■■
■ ■
■■ ■■
■ ■ ■
■■ ■■
■ ■
■■ ■■
■■■■■■
(There is also a variation that takes x and y coordinates.)
Interpolator
For (sound) curves.
Hermite4pt3oX
: Pretty good sound interpolation.
 Derived from: http://stackoverflow.com/questions/1125666/howdoyoudobicubicorothernonlinearinterpolationofresampledaudioda
CubicFromT
 Also know as Bezier curves.
CubicSmoothSlope
 Super nice interpolation.
 Thanks to my brother for giving me some of the math long ago.
There are also separate methods for precalculating values once when you start interpolating between two numbers and then doing a faster calculation to derive the points in between.
NumberBases
ToBase
 Converts an
int
to an nbase number in usually string format.
 Converts an
FromBase
 Converts an nbased number to an
int
. The input is usually in string format.
 Converts an nbased number to an
 You could convert from one base to another by first calling
FromBase
and thenToBase
.  Several overloads to handle it differently.
FromHex
/ToHex
ToLetterSequence
/FromLetterSequence
 Does spreadsheetstyle letter sequences. This is not the same as a base26 numbering system. After the range AZ is depleted, the next value is 'AA',
which is equivalent to 00, so you basically start counting at 0 again, but you get 26 for free.
 Does spreadsheetstyle letter sequences. This is not the same as a base26 numbering system. After the range AZ is depleted, the next value is 'AA',
Randomizer
GetRandomItem
 Gets a random item out of a collection.
Return a random number out of a range:
GetInt32
GetDouble
GetSingle
Geometry
IsInRectangle
GetCenter
AbsoluteDistance
MathHelper
Misc math helpers.
Pow
with integersLog
with integers It will only return integers, but will prevent rounding errors such as 1000 log 10 = 2.99999999996.
IsPowerOf2
 With help of: http://www.lomont.org/Software/Misc/FFT/LomontFFT.html
LogRatio
 Calculates where x is in between x0 and x1 on a logarithmic scale. 0 means it is on point x0. 1 means it is on pont x1. between 0 and 1 means it is somewhere in between. 0.5 means it is precisely halfway x0 and x1 logarithmically. Note that it can also be outside the bounds 0 and 1 if it is not in between those numbers.
RoundToSignificantDigits
 Source: https://stackoverflow.com/questions/374316/roundadoubletoxsignificantfigures
RoundWithStep
 Rounds to multiples of step, with an offset. It uses
Math.Round
as a helper, which supports a wide range of values.
 Rounds to multiples of step, with an offset. It uses
RoundWithStepWithInt64Bounds
 Same as above, but uses a cast to
Int64
as a helper, which might be faster thanMath.Round
, but means you are stuck within the value bounds oflong
.
 Same as above, but uses a cast to
ScaleLinearly
 Converts one range of numbers to another, both making a number bigger or smaller and shifting it over.
SpeadItems
 Equally spreads out items over another set of items. For instance the numbers {1,2,3} could be spread over 10 items, the first ones getting 1, the middle ones getting 2 and the last ones being assigned 3.
SpreadIntegers
 Equally spreads out a number of indices over a different number of indices. For instance the numbers {1,2,3} could be spread over 10 items, the first ones getting 1, the middle ones getting 2 and the last ones being assigned 3.
SpreadDoubles
 Equally spreads out a number of points over a range of values.
 It takes a
startValue
,endValue
andpointCount
and returns adouble[]
.
JJ.Framework.Mathematics
Helpers for calculations.
 Plotting graphs in text output.
 Interpolation
 Basen numbering systems
 Special rounding methods
 Use the
Random
class more easily  Simple geometric calculations
 Other basic math helpers.
TextPlotter
Plot function output in text mode. Example call:
IList<string> plot = TextPlotter.Plot(
new[] { 0.0, 0.7, 1.0, 0.7, 0.0, 0.7, 1.0, 0.7, 0.0 },
columnCount: 5,
lineCount: 7);
Example output:
■■■■■■
■■ ■■
■ ■
■■ ■■
■ ■ ■
■■ ■■
■ ■
■■ ■■
■■■■■■
(There is also a variation that takes x and y coordinates.)
Interpolator
For (sound) curves.
Hermite4pt3oX
: Pretty good sound interpolation.
 Derived from: http://stackoverflow.com/questions/1125666/howdoyoudobicubicorothernonlinearinterpolationofresampledaudioda
CubicFromT
 Also know as Bezier curves.
CubicSmoothSlope
 Super nice interpolation.
 Thanks to my brother for giving me some of the math long ago.
There are also separate methods for precalculating values once when you start interpolating between two numbers and then doing a faster calculation to derive the points in between.
NumberBases
ToBase
 Converts an
int
to an nbase number in usually string format.
 Converts an
FromBase
 Converts an nbased number to an
int
. The input is usually in string format.
 Converts an nbased number to an
 You could convert from one base to another by first calling
FromBase
and thenToBase
.  Several overloads to handle it differently.
FromHex
/ToHex
ToLetterSequence
/FromLetterSequence
 Does spreadsheetstyle letter sequences. This is not the same as a base26 numbering system. After the range AZ is depleted, the next value is 'AA',
which is equivalent to 00, so you basically start counting at 0 again, but you get 26 for free.
 Does spreadsheetstyle letter sequences. This is not the same as a base26 numbering system. After the range AZ is depleted, the next value is 'AA',
Randomizer
GetRandomItem
 Gets a random item out of a collection.
Return a random number out of a range:
GetInt32
GetDouble
GetSingle
Geometry
IsInRectangle
GetCenter
AbsoluteDistance
MathHelper
Misc math helpers.
Pow
with integersLog
with integers It will only return integers, but will prevent rounding errors such as 1000 log 10 = 2.99999999996.
IsPowerOf2
 With help of: http://www.lomont.org/Software/Misc/FFT/LomontFFT.html
LogRatio
 Calculates where x is in between x0 and x1 on a logarithmic scale. 0 means it is on point x0. 1 means it is on pont x1. between 0 and 1 means it is somewhere in between. 0.5 means it is precisely halfway x0 and x1 logarithmically. Note that it can also be outside the bounds 0 and 1 if it is not in between those numbers.
RoundToSignificantDigits
 Source: https://stackoverflow.com/questions/374316/roundadoubletoxsignificantfigures
RoundWithStep
 Rounds to multiples of step, with an offset. It uses
Math.Round
as a helper, which supports a wide range of values.
 Rounds to multiples of step, with an offset. It uses
RoundWithStepWithInt64Bounds
 Same as above, but uses a cast to
Int64
as a helper, which might be faster thanMath.Round
, but means you are stuck within the value bounds oflong
.
 Same as above, but uses a cast to
ScaleLinearly
 Converts one range of numbers to another, both making a number bigger or smaller and shifting it over.
SpeadItems
 Equally spreads out items over another set of items. For instance the numbers {1,2,3} could be spread over 10 items, the first ones getting 1, the middle ones getting 2 and the last ones being assigned 3.
SpreadIntegers
 Equally spreads out a number of indices over a different number of indices. For instance the numbers {1,2,3} could be spread over 10 items, the first ones getting 1, the middle ones getting 2 and the last ones being assigned 3.
SpreadDoubles
 Equally spreads out a number of points over a range of values.
 It takes a
startValue
,endValue
andpointCount
and returns adouble[]
.
Dependencies

 JetBrains.Annotations (>= 2018.2.1)
 JJ.Framework.Collections (>= 1.5.0 && < 1.6.0)
 JJ.Framework.Common (>= 1.5.0 && < 1.6.0)
 JJ.Framework.Exceptions (>= 1.5.0 && < 1.6.0)
 JJ.Framework.Reflection (>= 1.5.0 && < 1.6.0)
 System.ValueTuple (>= 4.5.0)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version History
Version  Downloads  Last updated  

1.5.6877.41334  752  10/31/2018  
1.4.6873.32669  240  10/26/2018  
1.4.6870.37051  232  10/23/2018  
1.4.6862.41387  353  10/15/2018  
1.3.6689.35854  682  4/25/2018 