Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 3e6b8da
Author: Aron T <aront@fourm.info>
Date:   Fri Nov 15 16:20:22 2024 +0200

    accrued

commit 6a9d63f
Author: Aron T <aront@fourm.info>
Date:   Fri Nov 15 16:15:36 2024 +0200

    20241115 update

commit 2bd882a
Author: Aron T <aront@fourm.info>
Date:   Fri Nov 15 16:13:22 2024 +0200

    accrued apr

commit 07763e6
Author: Aron T <aront@fourm.info>
Date:   Thu Nov 14 18:13:30 2024 +0200

    20241114 update

commit 5279231
Author: Aron T <aront@fourm.info>
Date:   Thu Nov 14 18:11:53 2024 +0200

    exponential

commit 2d2fc62
Author: Aron T <aront@fourm.info>
Date:   Thu Nov 14 17:18:39 2024 +0200

    change parabola w/roots

commit ac92112
Author: Aron T <aront@fourm.info>
Date:   Thu Nov 14 17:18:13 2024 +0200

    add Plots folder

commit 9cd21ff
Author: Aron T <aront@fourm.info>
Date:   Mon Nov 11 15:15:56 2024 +0200

    roots

commit 5844c7a
Author: Aron T <aront@fourm.info>
Date:   Mon Nov 11 15:01:11 2024 +0200

    add Polynomials

commit 37d51f9
Author: Aron T <aront@fourm.info>
Date:   Mon Nov 11 14:12:36 2024 +0200

    fix docs source
  • Loading branch information
AronT-TLV committed Nov 15, 2024
1 parent bfd997e commit 864f1b2
Show file tree
Hide file tree
Showing 6 changed files with 574 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Folders to ignore - files may be too large, too many, etc. NOTE: EDIT IF NEEDED.
/data
/videos
/plots
plots
/_research

################################################################################
Expand Down
94 changes: 43 additions & 51 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "90b2ff267ca57a6669dd82dd30248ae9a31dd782"
project_hash = "4603c5eb6fc9480892a4fdc252eef7958ebc9cf6"

[[deps.ADTypes]]
git-tree-sha1 = "eea5d80188827b35333801ef97a40c2ed653b081"
git-tree-sha1 = "30bb95a372787af850addf28ac937f1be7b79173"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "1.9.0"
version = "1.10.0"

[deps.ADTypes.extensions]
ADTypesChainRulesCoreExt = "ChainRulesCore"
ADTypesConstructionBaseExt = "ConstructionBase"
ADTypesEnzymeCoreExt = "EnzymeCore"

[deps.ADTypes.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"

[[deps.AMRVW]]
Expand All @@ -29,10 +31,10 @@ uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
version = "0.0.1"

[[deps.AbstractAlgebra]]
deps = ["InteractiveUtils", "LinearAlgebra", "MacroTools", "Preferences", "Random", "RandomExtensions", "SparseArrays", "Test"]
git-tree-sha1 = "f2ed325e84ff435220a1dd93c421e1d8ca2e5da0"
deps = ["LinearAlgebra", "MacroTools", "Preferences", "Random", "RandomExtensions", "SparseArrays", "Test"]
git-tree-sha1 = "505ccfd5cd579ff05b4d7299759fca7a61b0fde1"
uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
version = "0.43.9"
version = "0.43.10"

[[deps.AbstractTrees]]
git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177"
Expand Down Expand Up @@ -80,12 +82,6 @@ git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff"
uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8"
version = "1.1.3"

[[deps.Aqua]]
deps = ["Compat", "Pkg", "Test"]
git-tree-sha1 = "49b1d7a9870c87ba13dc63f8ccfcf578cb266f95"
uuid = "4c88cf16-eb10-579e-8560-4a9242c79595"
version = "0.8.9"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.2"
Expand Down Expand Up @@ -122,16 +118,6 @@ version = "7.17.0"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"

[[deps.ArrayLayouts]]
deps = ["FillArrays", "LinearAlgebra"]
git-tree-sha1 = "492681bc44fac86804706ddb37da10880a2bd528"
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
version = "1.10.4"
weakdeps = ["SparseArrays"]

[deps.ArrayLayouts.extensions]
ArrayLayoutsSparseArraysExt = "SparseArrays"

[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"
Expand All @@ -156,18 +142,6 @@ git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d"
uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
version = "0.1.9"

[[deps.BlockArrays]]
deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra"]
git-tree-sha1 = "d434647f798823bcae510aee0bc0401927f64391"
uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
version = "1.1.1"

[deps.BlockArrays.extensions]
BlockArraysBandedMatricesExt = "BandedMatrices"

[deps.BlockArrays.weakdeps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"

[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "8873e196c2eb87962a2048b3b8e08946535864a1"
Expand Down Expand Up @@ -373,9 +347,9 @@ version = "0.9.3"

[[deps.Documenter]]
deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"]
git-tree-sha1 = "5a1ee886566f2fa9318df1273d8b778b9d42712d"
git-tree-sha1 = "d0ea2c044963ed6f37703cead7e29f70cba13d7e"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "1.7.0"
version = "1.8.0"

[[deps.DomainSets]]
deps = ["CompositeTypes", "IntervalSets", "LinearAlgebra", "Random", "StaticArrays"]
Expand Down Expand Up @@ -460,9 +434,9 @@ version = "300.100.300+0"

[[deps.FileIO]]
deps = ["Pkg", "Requires", "UUIDs"]
git-tree-sha1 = "62ca0547a14c57e98154423419d8a342dca75ca9"
git-tree-sha1 = "91e0e5c68d02bcdaae76d3c8ceb4361e8f28d2e9"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.16.4"
version = "1.16.5"

[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
Expand Down Expand Up @@ -643,10 +617,10 @@ uuid = "c817782e-172a-44cc-b673-b171935fbb9e"
version = "0.1.7"

[[deps.ImageCore]]
deps = ["Aqua", "BlockArrays", "ColorVectorSpace", "Colors", "FixedPointNumbers", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "PrecompileTools", "Reexport"]
git-tree-sha1 = "661ca04f8df633e8a021c55a22e96cf820220ede"
deps = ["ColorVectorSpace", "Colors", "FixedPointNumbers", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "PrecompileTools", "Reexport"]
git-tree-sha1 = "8c193230235bbcee22c8066b0374f63b5683c2d3"
uuid = "a09fc81d-aa75-5fe9-8630-4744c3626534"
version = "0.10.4"
version = "0.10.5"

[[deps.ImageIO]]
deps = ["FileIO", "IndirectArrays", "JpegTurbo", "LazyModules", "Netpbm", "OpenEXR", "PNGFiles", "QOI", "Sixel", "TiffImages", "UUIDs", "WebP"]
Expand Down Expand Up @@ -1176,9 +1150,9 @@ version = "1.4.3"

[[deps.Plots]]
deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "TOML", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"]
git-tree-sha1 = "45470145863035bb124ca51b320ed35d071cc6c2"
git-tree-sha1 = "dae01f8c2e069a683d3a6e17bbae5070ab94786f"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
version = "1.40.8"
version = "1.40.9"

[deps.Plots.extensions]
FileIOExt = "FileIO"
Expand All @@ -1194,6 +1168,24 @@ version = "1.40.8"
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[[deps.Polynomials]]
deps = ["LinearAlgebra", "RecipesBase", "Requires", "Setfield", "SparseArrays"]
git-tree-sha1 = "1a9cfb2dc2c2f1bd63f1906d72af39a79b49b736"
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
version = "4.0.11"

[deps.Polynomials.extensions]
PolynomialsChainRulesCoreExt = "ChainRulesCore"
PolynomialsFFTWExt = "FFTW"
PolynomialsMakieCoreExt = "MakieCore"
PolynomialsMutableArithmeticsExt = "MutableArithmetics"

[deps.Polynomials.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"

[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f"
Expand Down Expand Up @@ -1376,15 +1368,15 @@ version = "0.7.0"

[[deps.SIMD]]
deps = ["PrecompileTools"]
git-tree-sha1 = "98ca7c29edd6fc79cd74c61accb7010a4e7aee33"
git-tree-sha1 = "52af86e35dd1b177d051b12681e1c581f53c281b"
uuid = "fdea26ae-647d-5447-a871-4b548cad5224"
version = "3.6.0"
version = "3.7.0"

[[deps.SciMLBase]]
deps = ["ADTypes", "Accessors", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "Expronicon", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"]
git-tree-sha1 = "7527b9adb22904f0f51d8ab85d826f81ebb6f78d"
git-tree-sha1 = "cacc7bc54bab8749b1fc1032c4911fe80cffb959"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
version = "2.59.2"
version = "2.61.0"

[deps.SciMLBase.extensions]
SciMLBaseChainRulesCoreExt = "ChainRulesCore"
Expand Down Expand Up @@ -1568,9 +1560,9 @@ version = "7.7.0+0"

[[deps.SymbolicIndexingInterface]]
deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"]
git-tree-sha1 = "20cf607cafb31f922bce84d60379203e7a126911"
git-tree-sha1 = "6c6761e08bf5a270905cdd065be633abfa1b155b"
uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
version = "0.3.34"
version = "0.3.35"

[[deps.SymbolicLimits]]
deps = ["SymbolicUtils"]
Expand All @@ -1594,9 +1586,9 @@ version = "3.7.2"

[[deps.Symbolics]]
deps = ["ADTypes", "ArrayInterface", "Bijections", "CommonWorldInvalidations", "ConstructionBase", "DataStructures", "DiffRules", "Distributions", "DocStringExtensions", "DomainSets", "DynamicPolynomials", "IfElse", "LaTeXStrings", "Latexify", "Libdl", "LinearAlgebra", "LogExpFunctions", "MacroTools", "Markdown", "NaNMath", "PrecompileTools", "Primes", "RecipesBase", "Reexport", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArraysCore", "SymbolicIndexingInterface", "SymbolicLimits", "SymbolicUtils", "TermInterface"]
git-tree-sha1 = "0caef7687abf7094132fa3112bf5514c36a99226"
git-tree-sha1 = "24e006074ef13894ed23d006f55e6082998c9035"
uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7"
version = "6.18.3"
version = "6.19.0"

[deps.Symbolics.extensions]
SymbolicsForwardDiffExt = "ForwardDiff"
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DrWatson
using Documenter

# Here you may include files from the source directory
include(srcdir("dummy_src_file.jl"))
include(srcdir("basic_maths.jl"))

@info "Building Documentation"
makedocs(;
Expand Down
501 changes: 472 additions & 29 deletions notebooks/Basics.ipynb

Large diffs are not rendered by default.

60 changes: 56 additions & 4 deletions src/basic_maths.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Symbolics
using Plots; gr
using Latexify
using LaTeXStrings
using Dates
using AMRVW
# using AMRVW
using Polynomials

"""
nth_root(x,n) → c
Expand All @@ -21,9 +23,10 @@ function nth_root(x, n)
end

"""
plot_parabola(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0)
plot_parabola_roots_1(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0) -> [ComplexF64, ComplexF64]
AMRVW version of plotting parabola with roots
"""
function plot_parabola(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0)
function plot_parabola_roots_1(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0)
gr()
@variables x
f = a₂*x^2 + a₁*x + a₀
Expand All @@ -32,6 +35,55 @@ function plot_parabola(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0)
plot(f,legend=false,xlims=[-4,4],ylims=[-4,4],framestyle = :origin)
title!(L"Plot\ of\ %$a₂ * x^2 + %$a₁ * x + %$a₀\\")
scatter!(r3c,series_annotations = text.(r3, 8, :bottom))
savefig("plots/"* Dates.format(now(),"yyyymmdd-HHMMSS") * "parabola.png")
savefig("plots/"* Dates.format(now(),"yyyymmdd-HHMMSS") * "parabolaAMRVW.png")
r3c
end
"""
plot_parabola_roots_2(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0) -> [ComplexF64, ComplexF64]
Polynomial version of plotting parabola with roots
"""
function plot_parabola_roots_2(a₂::Float64, a₁::Float64=0.0, a₀::Float64=0.0)
gr()
@variables x
f = a₂*x^2 + a₁*x + a₀
r3 = round.(roots(Polynomial([a₀,a₁,a₂], :x)), digits=12)
plot(f,legend=false,xlims=[-4,4],ylims=[-4,4],framestyle = :origin)
title!(L"Plot\ of\ %$a₂ * x^2 + %$a₁ * x + %$a₀\\")
scatter!(r3,series_annotations = text.(r3, 8, :bottom))
savefig("plots/"* Dates.format(now(),"yyyymmdd-HHMMSS") * "parabolaPoly.png")
r3
end
"""
function plot_hyperbola(n::Integer)
plot hyperbola 1/x^n
"""
function plot_hyperbola(n::Integer)
@variables x
f = 1/(x^n)
plot(f,legend=false, xlims=[-6,6],ylims=[-6,6],framestyle = :origin)
title!(L"Plot\ of\ 1/x^%$n")
savefig("plots/"* Dates.format(now(),"yyyymmdd-HHMMSS") * "hyperbola.png")
end
"""
expa2x(a::Real,x::Real)
exponential function where a > 0 and x is any Real
"""
expa2x(a::Real,x::Real) = a>0 ? a^x : println("a must be a positive real")
"""
function accrued_apr(i::Real,p::Real,c::Int64) -> Float64
i is interest, p is period (1 = one year), c is capital
return accrued value using daily apr for interest
"""
function accrued_apr(i::Real,p::Real,c::Int64)
# calculate daily apr interest rate for a year
apr = expa2x(1+(i/100)/365,365)
c * expa2x(apr,p)
end
"""
function accrued(i::Real,p::Real,c::Int64) -> Float64
i is interest, p is period (1 = one year), c is capital
return accrued value
"""
function accrued(i::Real,p::Real,c::Int64)
c * expa2x(1+(i/100),p)
end

0 comments on commit 864f1b2

Please sign in to comment.