Toolbox
Dictionaries
CamiMath.dictSuperscript — ConstantdictSuperscriptjulia> dictSuperscript
Dict{Char, Char} with 38 entries:
'n' => 'ⁿ'
'f' => 'ᶠ'
'w' => 'ʷ'
'1' => '¹'
'd' => 'ᵈ'
'e' => 'ᵉ'
⋮ => ⋮Example:
julia> get(dictSuperscript, 'n', "not found")
'ⁿ': Unicode U+207F (category Lm: Letter, modifier)CamiMath.dictSubscript — ConstantdictSuperscriptjulia> dictSubscript
Dict{Char, Char} with 25 entries:
'n' => 'ₙ'
'1' => '₁'
'e' => 'ₑ'
'7' => '₇'
'6' => '₆'
'o' => 'ₒ'
⋮ => ⋮Example:
julia> get(dictSubscript, 'n', "not found")
'ₙ': Unicode U+2099 (category Lm: Letter, modifier)CamiMath.dictUndoSmall — ConstantdictUndoSmalljulia> dictUndoSmall
Dict{Char, Char} with 62 entries:
'ᵉ' => 'e'
'ₓ' => 'x'
'ₖ' => 'k'
'ⁿ' => 'n'
'𐞥' => 'q'
'ₕ' => 'h'
⋮ => ⋮Example:
julia> get(dictUndoSmall, 'ⁿ', "not found")
'n': ASCII/Unicode U+006E (category Ll: Letter, lowercase)Superscript tools
CamiMath.sup — Methodsup(i::T) where T<:RealSuperscript notation for integers and rational numbers and all lowercase characters
Examples:
julia> sup(3) * 'P'
"³P"
julia> 'D' * sup(5//2)
"D₅⸝₂"
julia> 'D' * sub(50//20)
"D₅⸝₂"
julia> 'D' * sub(50//21)
"D₅₀⸝₂₁"sup(str::String)Example:
julia> 'D' * sup("superscript")
"Dˢᵘᵖᵉʳˢᶜʳⁱᵖᵗ"CamiMath.undosup — Methodundosup(str::Union{Char, String})Undo conversion of Integer or Rational{Int} to superscript String Examples:
julia> undosup("⁻⁵ᐟ²")
-5//2Subscript tools
CamiMath.sub — Methodsub(i::T) where T<:RealSubscript notation for integers, rational numbers and a subset of lowercase characters ('a', 'e', 'h', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'x')
Examples:
julia> 'D' * sub(5//2)
"D₅⸝₂"
julia> 'D' * sub(50//20)
"D₅⸝₂"
julia> 'D' * sub(50//21)
"D₅₀⸝₂₁"sub(str::String)Example:
julia> "m" * sub("e")
"mₑ"
julia> 'D' * sub("50/21")
"D₅₀⸝₂₁"CamiMath.undosub — Methodundosub(str::Union{Char, String})Undo conversion of Integer or Rational{Int} to subscript String Examples:
undosub("₋₅⸝₂")
-5//2Tiny character tools
CamiMath.undosmall — Methodundosmall(str::Union{Char, String})Reset to normal size String
Examples:
julia> undosmall("ˢᵘᵖᵉʳˢᶜʳⁱᵖᵗ")
"superscript"
julia> undosmall("⁻⁵ᐟ²")
"-5/2"
julia> undosmall("₋₅⸝₂")
"-5/2"CamiMath.frac — Methodfrac(i::Rational{Int})Fraction notation for rational numbers
Examples:
julia> frac(-5//2)
"-⁵/₂"Rational covert to String
CamiMath.strRational — MethodstrRational(n::T) where T<:Union{Rational{}, Int, BigInt}Fraction notation for rational numbers and integers
Examples:
julia> strRational(-5//2)
"-5/2"logical tools
CamiMath.fwd — TypefwdSingleton type indicating forward sense
CamiMath.isforward — Methodfunction isforward(sense)Boolean status of sense, with options: fwd (forward) and bwd (backward).
Example:
julia> isforward(fwd)
trueCamiMath.bwd — TypebwdSingleton type indicating backward sense
CamiMath.isbackward — Methodfunction isbackward(sense)Boolean status of sense, with options: fwd (forward) and bwd (backward).
Example:
julia> isbackward(fwd)
falseCamiMath.reg — TyperegSingleton type indicating regular ordering
CamiMath.isregular — Methodfunction isregular(sense::Type)Boolean status of sense, with options: reg (regular) and rev (reversed).
Example:
julia> isregular(reg)
trueCamiMath.rev — TyperevSingleton type indicating reverse ordering
CamiMath.isreversed — Methodfunction isreversed(sense::Type)Boolean status of sense, with options: reg (regular) and rev (reversed).
Example:
julia> isreversed(rev)
trueMathematics tools
CamiMath.Type_IOP — FunctionType_IOP(n::Integer, nc::Integer [, a [; nam="" [; msg=true]]])BigInt if n is a BigInt or n > nc, otherwise Int; a is an auxiliary second variable.
nam: function namemsg: integer-overflow protection (IOP) - warning on activation
Examples:
julia> Type_IOP(1, 1)
Int64
julia> Type_IOP(big(1), 1)
BigInt
julia> Type_IOP(2, 1)
BigInt
julia> Type_IOP(1, 1; nam="test")
Int64
julia> Type_IOP(2, 1, 0; nam="test")
IOP capture at test(2, 0): output converted to BigInt
BigIntCamiMath.log10_characteristic — Methodlog10_characteristic(x)characteristic power-of-10 of the number x
Examples:
julia> log10_characteristic.([3,30,300])
3-element Vector{Int64}:
0
1
2CamiMath.log10_mantissa — Methodlog10_mantissa(x)log10 mantissa of the number x
Examples:
julia> log10_mantissa.([3,30,300])
3-element Vector{Float64}:
0.47712125471966244
0.4771212547196624
0.4771212547196626CamiMath.texp — Methodtexp(x::T, a::T, p::Int) where T <: RealTruncated exponential: Taylor expansion of $exp(x)$ about $x = a$ up to order p,
\[ \mathsf{texp}(x,a,p) = 1+(x-a)+\frac{1}{2}(x-a)^2+⋯+\frac{1}{p!}(x-a)^p\]
Examples:
julia> texp(1.0, 0.0, 5)
2.7166666666666663
julia> texp(1, 0, 5)
163//60Divisor
CamiMath.normalize_rationals — Methodnormalize_rationals(v::Vector{Rational{T}}) where T<:IntegerNumerators separated from divisor
Example:
julia> normalize_rationals([1//1, 1//2, 1//3])
([6, 3, 2], 6)CamiMath.divisor — Methoddivisor(v::Vector{Rational{T}}) where T<:IntegerGreatest common denominator of the set of rational numbers v
Example:
julia> divisor([1//1, 1//2, 1//3])
6CamiMath.numerators — Methodnumerators(v::Vector{Rational{T}}) where T<:IntegerNumerators for the standard devisor of the set of rational numbers v
Example:
julia> numerators([1//1, 1//2, 1//3])
3-element Vector{Int64}:
6
3
2Conversion to Big types
CamiMath.convertToBig — MethodconvertToBig(x::T) where TConversion from 64-bit-based types to BigInt-based types:
- Int => BigInt,
- Vector{Int} => Vector{BigInt},
- Vector{Vector{Int}} => Vector{Vector{BigInt}},
- Rational{Int} => Rational{BigInt},
- Vector{Rational{Int}} => Vector{Rational{BigInt}},
- Vector{Vector{Rational{Int}}} => Vector{Vector{Rational{BigInt}}},
- Float64 => BigFloat,
- Vector{Float64} => Vector{BigFloat},
- Vector{Vector{Float64}} => Vector{Vector{BigFloat}},
- Complex{Float64} => Complex{BigFloat},
- Vector{Complex{Float64}} => Vector{Complex{BigFloat}},
- Vector{Vector{Complex{Float64}}} => Vector{Vector{Complex{BigFloat}}}
Example:
julia> [[1 // 1, 1 // 2], [1 // 1, 1 // 2]]
2-element Vector{Vector{Rational{Int64}}}:
[1, 1//2]
[1, 1//2]
julia> convertToBig([[1 // 1, 1 // 2], [1 // 1, 1 // 2]])
2-element Vector{Vector{Rational{BigInt}}}:
[1, 1//2]
[1, 1//2]