GithubHelp home page GithubHelp logo

mathsnotes.jl's Introduction

MathsNotes

Some notes taken when I am studying Mathematical skills, still updating.

Highlights

These codes will make it more convenient while programming on Maths (Mainly calculus).

Usage

Add dependencies

julia> ]
(@v1.10) pkg> add Calculus
(@v1.10) pkg> add ForwardDiff

Download and include the codes.

(Actually I don't want to upload these codes to Julia Packages, since they are too simple)

julia> include("Desktop/MathsNotes.jl") # Here I put the codes on Desktop
Main.MathsNotes

julia> using .MathsNotes

Select a library (Calculus/ForwardDiff)

Note: The reason I made the macro is that both those two library have their advantages and disadvantages. Therefore, when you find it wrong using one lib, you can change the library you use at any time.

This macro (@uselib) will define (or redefine) the function d, which all the other functions depend on.

(As reference, I found that the library Calculus support more kinds of functions, while the library ForwardDiff is more accurate)

julia> @uselib Calculus
d (generic function with 2 method)

Now use it!

The codes contains functions providing these features:

Real Analysis: derivative, derivative function, second and higher derivative (and their corresponding functions), partial derivative (function), l'Hospital's rule.

Numeric Analysis: Lagrange's Interpolation, ASR (Adaptive Simpson's Rule)

Harmonic Analysis: CFS (Continuous Fourier Series), Whittaker-Shannon's Interpolation

Differential Geometry: curvature

Elementary Number Theory: Rational Root Theorem.

Note: the derivative function calculator will NOT do any symbolic calculations, as it is just a abbreviation for x -> d(f, x)

julia> @uselib ForwardDiff
d (generic function with 2 methods)

julia> f = d(x -> x)
#1 (generic function with 1 method)

julia> f(8)
1

julia> d(x -> x, Inf)
1.0

julia> (sin, π)
-1.2246467991473532e-16

julia> (sin, π/2)
-1.0

julia> dⁿ(sin, 4, π/2)
1.0

julia> ((x, y) -> x^2 + y^2, 2)(6) # Same as `∂((x, y) -> x^2 + y^2, 2; n=1)(6)`, which `(6)` is the other variable(s).
4

julia> κ(x -> x - sin(x), x -> 1 - cos(x), π) # Curvature
-0.25

julia> lHôpital(x -> sind(180*x), x -> x^2-1, 1)
-1.5707963267948966

julia> @uselib Calculus
d (generic function with 2 methods)

julia> lHôpital(x -> exp(-1/x^2), x -> x^2, 0)
0.0

julia> rrt([3, -31, 102, -111, -1, 30]) # Finding the rational roots of 30x⁵-x⁴-111x³+102x²-31x+3=0, and return the polynomial formed from the irrational roots of the original polynomial additionally.
(Rational[1//2, 1//3, 1//5], Polynomial(-90//1 + 30//1*x + 30//1*x^2))

Need to improve

  1. L'Hospital's Rule calculator sometimes gives different answers using different libs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.