diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5fa9bb3..baf2cce 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -8,11 +8,22 @@ ### Core Architecture -- **`src/Calculus.jl`**: Main module; uses `@reexport` to re-export `Plots`, `BlockArrays`, `LAlatex`, `LaTeXStrings` — consumers get all exported names with a single `using Calculus` +- **`src/Calculus.jl`**: Main module; uses `@reexport` to re-export `CalculusWithJuliaSquared` and `LaTeXStrings` — consumers get all exported names with a single `using Calculus` - **`test/`**: Tests using `Calculus` and `Test` only — re-exported names are available via `@reexport`, no explicit `using` needed in test files - **`docs/`**: Documenter.jl deploying to `https://study.fourm.info/calculus/` (cross-repo to `math_tech_study`) - **`notebooks/`**: Jupyter notebooks for exploration (not tested in CI) +### What CalculusWithJuliaSquared Provides + +[`CalculusWithJuliaSquared`](https://github.com/FourMInfo/CalculusWithJuliaSquared.jl) is a personal, pure-Julia (zero-Python) fork of `CalculusWithJulia.jl`. It's **unregistered**, so its GitHub URL is declared in `Project.toml`'s `[sources]` section — required because Manifests are gitignored here, and without `[sources]` a clean clone (e.g. CI) tries the General registry and fails. Keep that section intact. It reexports `Plots`, `Symbolics`, `Roots`, `LinearAlgebra`, `SpecialFunctions`, and `IntervalSets`, and auto-configures the GR backend for headless CI at load time — so this repo needs **no direct `Plots` dependency and no GKS setup of its own**. Available after `using Calculus`: + +- **Plotting recipes**: `plotif`, `trimplot`, `signchart`, `plot_parametric`(`!`), `plot_polar`(`!`), `implicit_plot`(`!`), `vectorfieldplot`(`3d`), `arrow`(`!`), `riemann_plot`(`!`), `newton_plot!`, `plot_implicit_surface` +- **Calculus utilities**: `riemann` (8 methods), `fubini`, `lim` (limit tables), `sign_chart`, `tangent`, `secant`, `D` and the `f'` prime notation (via ForwardDiff), `unzip`, `rangeclamp`, `const e` +- **Symbolic math** (pure Julia): `@variables` etc. via Symbolics, plus symbolic `gradient`/`divergence`/`curl` for `Symbolics.Num`; `∇`, `∇⋅`, `∇×` operators work numerically and symbolically +- **Root finding**: `fzero`/`fzeros` via Roots + +To update to a newer CWJS commit: `julia --project=. -e 'using Pkg; Pkg.update("CalculusWithJuliaSquared")'`. Never re-add `Plots`/`SymPy` directly here — plotting comes through CWJS, and CWJS's whole purpose is keeping Python out. + ## Julia Workspace Layout This repository uses a Julia workspace. The root `Project.toml` has a `[workspace]` table listing diff --git a/.github/instructions/notebooks.instructions.md b/.github/instructions/notebooks.instructions.md index aef4431..daad19f 100644 --- a/.github/instructions/notebooks.instructions.md +++ b/.github/instructions/notebooks.instructions.md @@ -10,12 +10,17 @@ All notebooks should start with the standard setup cell: ```julia using Revise using Calculus +using LAlatex, BlockArrays LAlatex.set_backend!(:symbolics) LAlatex.reset_display_defaults!() ``` -`LAlatex`, `BlockArrays`, and `LaTeXStrings` are re-exported by `Calculus`, so no separate `using` is needed. In particular, the `L"..."` string macro is available immediately after `using Linear_Algebra`. +What comes from where: + +- `using Calculus` provides everything the module reexports — `LaTeXStrings` (the `L"..."` macro) plus the full `CalculusWithJuliaSquared` chain (`Plots`, `Symbolics`, `Roots`, calculus utilities and plotting recipes — see "What CalculusWithJuliaSquared Provides" in `copilot-instructions.md`). +- `LAlatex` and `BlockArrays` are **notebooks-environment dependencies only** (in `notebooks/Project.toml`, not the root project), so they need their own `using` line — they are *not* re-exported by `Calculus`. + `set_backend!(:symbolics)` is required because this package uses Symbolics.jl; the default `:latexify` backend gives worse output for symbolic expressions. `reset_display_defaults!()` ensures a clean display state on every kernel restart. @@ -32,11 +37,11 @@ LAlatex.reset_display_defaults!() - Plots render inline in Jupyter notebooks - No need for headless mode configuration -- Use the same plotting functions from the package (`plot_param_line`, etc.) +- Prefer the ready-made recipes from `CalculusWithJuliaSquared` (`plotif`, `riemann_plot`, `plot_parametric`, `vectorfieldplot`, …) and this package's own plotting functions before writing new ones ## LAlatex Display -[LAlatex.jl](https://github.com/ea42gh/LAlatex.jl) (by ea42gh) is re-exported by `Linear_Algebra` and provides clean LaTeX rendering of linear algebra objects in notebooks. Use it instead of raw `println` or `display` whenever presenting mathematical results. +[LAlatex.jl](https://github.com/ea42gh/LAlatex.jl) (by ea42gh) is available in the notebooks environment (`using LAlatex` in the setup cell) and provides clean LaTeX rendering of mathematical objects in notebooks. Use it instead of raw `println` or `display` whenever presenting mathematical results. ### Core functions diff --git a/.github/instructions/source.instructions.md b/.github/instructions/source.instructions.md index d12e0f8..5d80157 100644 --- a/.github/instructions/source.instructions.md +++ b/.github/instructions/source.instructions.md @@ -10,7 +10,7 @@ All code uses `@reexport` pattern and exports both computational + plotting func ```julia # Main module uses @reexport for clean interface using Reexport -@reexport using Plots, BlockArrays, LAlatex, LaTeXStrings +@reexport using CalculusWithJuliaSquared, LaTeXStrings # Pure computational functions (no plotting dependencies) export calculate_derivative, calculate_integral @@ -19,9 +19,11 @@ export calculate_derivative, calculate_integral export plot_function, plot_derivative ``` +`CalculusWithJuliaSquared` brings `Plots`, `Symbolics`, `Roots`, `LinearAlgebra`, `SpecialFunctions`, and `IntervalSets` with it, plus ready-made calculus utilities and plotting recipes (see the "What CalculusWithJuliaSquared Provides" section in `copilot-instructions.md`). **Check there before writing a new function — it may already exist** (e.g. `riemann_plot`, `plotif`, `tangent`, `lim`). + ## CI/Interactive Detection -Module auto-configures at load time using `GKSwstype`. See the `julia-coding-conventions` skill for the canonical pattern. The check goes in the main module file (`Calculus.jl`) after the `@reexport` block. +Handled by `CalculusWithJuliaSquared` at its own load time (the canonical `GKSwstype` pattern from the `julia-coding-conventions` skill lives there now). This module needs no GKS configuration of its own. ## Julia Coding Standards @@ -65,11 +67,9 @@ end ## Dependencies & Libraries -**Main Dependencies**: Plots, BlockArrays, LAlatex, LaTeXStrings, Reexport, DrWatson +**Main Dependencies**: CalculusWithJuliaSquared (unregistered, installed by GitHub URL), LaTeXStrings, Reexport ### Libraries Used -- **Plots.jl**: For visualization functions -- **BlockArrays.jl**: For block-structured arrays -- **LAlatex.jl**: For LaTeX rendering in notebooks +- **CalculusWithJuliaSquared.jl**: calculus utilities, plotting recipes, and the full reexport chain (Plots, Symbolics, Roots, LinearAlgebra, SpecialFunctions, IntervalSets) — pure Julia, zero Python by design; never add `Plots` or `SymPy` directly here - **LaTeXStrings.jl**: For `L"..."` string macro - **Reexport.jl**: For `@reexport` clean module interface diff --git a/Project.toml b/Project.toml index c6ce2ec..3caf882 100644 --- a/Project.toml +++ b/Project.toml @@ -7,9 +7,13 @@ authors = ["Aron T"] projects = ["test", "docs"] [deps] +CalculusWithJuliaSquared = "f826098b-d57e-4440-b91e-2a05d35c24ae" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" -Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +[sources] +CalculusWithJuliaSquared = { url = "https://github.com/FourMInfo/CalculusWithJuliaSquared.jl" } + [compat] +CalculusWithJuliaSquared = "0.5.0" julia = "1.12" diff --git a/src/Calculus.jl b/src/Calculus.jl index e70cbfc..ed947e3 100644 --- a/src/Calculus.jl +++ b/src/Calculus.jl @@ -1,14 +1,9 @@ module Calculus using Reexport -@reexport using Plots, LaTeXStrings - -# GR backend — auto-configures for CI or interactive use -if haskey(ENV, "CI") || get(ENV, "GKSwstype", "") == "100" - ENV["GKSwstype"] = "100" - gr(show=false) -else - gr() -end +# CalculusWithJuliaSquared reexports Plots, Symbolics, Roots, LinearAlgebra, +# SpecialFunctions, and IntervalSets, and auto-configures the GR backend for +# CI/interactive use at load time — no separate `using Plots` or GKS setup needed. +@reexport using CalculusWithJuliaSquared, LaTeXStrings # Pure computational functions (no plotting dependencies)