From b0b2c5f12f84ca4d5241531e9e8ae5672b3091fd Mon Sep 17 00:00:00 2001 From: Aron T Date: Thu, 16 Jul 2026 18:07:11 +0300 Subject: [PATCH 1/4] Use CalculusWithJuliaSquared instead of a direct Plots dependency Adds CalculusWithJuliaSquared (personal pure-Julia fork of CalculusWithJulia.jl, unregistered -- installed from its GitHub URL, Manifest pins repo-url tracking master) and reexports it from the Calculus module. It brings Plots, Symbolics, Roots, LinearAlgebra, SpecialFunctions, and IntervalSets through its own reexport chain, plus calculus utilities (riemann, fubini, lim, sign_chart, tangent, secant, D/f' notation) and plotting recipes (plotif, trimplot, riemann_plot, newton_plot!, ...), so: - Plots removed from Project.toml (arrives transitively) - The module's GKSwstype headless-CI block removed -- CalculusWithJuliaSquared runs the same pattern at its own load time - copilot-instructions.md gains a "What CalculusWithJuliaSquared Provides" section so future sessions know what already exists before writing new functions; source.instructions.md dependency/module sections updated to match reality (also drops BlockArrays/LAlatex mentions that were template leftovers never actually in Project.toml) Test suite passes; verified `using Calculus` alone provides plot, @variables, riemann, and the L"..." macro. Co-Authored-By: Claude Fable 5 --- .github/copilot-instructions.md | 13 ++++++++++++- .github/instructions/source.instructions.md | 12 ++++++------ Project.toml | 3 ++- src/Calculus.jl | 13 ++++--------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5fa9bb3..45e6717 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`, installed **from its GitHub URL** (it's unregistered — the Manifest pins `repo-url`, tracking `master`). 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/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..1f110bb 100644 --- a/Project.toml +++ b/Project.toml @@ -7,9 +7,10 @@ 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" [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) From 7f4eb137b0f69af2cbf71730f245d0352cc000af Mon Sep 17 00:00:00 2001 From: Aron T Date: Thu, 16 Jul 2026 18:13:51 +0300 Subject: [PATCH 2/4] Add [sources] entry so CI can resolve the unregistered dependency CI failed with "expected package CalculusWithJuliaSquared to be registered": Pkg.add(url=...) records the GitHub source only in the Manifest, which is gitignored in this repo, so CI resolving from Project.toml alone looked for the package in the General registry. The [sources] section (Julia 1.11+) declares the URL in the committed Project.toml, making instantiation work from a clean clone. Co-Authored-By: Claude Fable 5 --- Project.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Project.toml b/Project.toml index 1f110bb..3caf882 100644 --- a/Project.toml +++ b/Project.toml @@ -11,6 +11,9 @@ CalculusWithJuliaSquared = "f826098b-d57e-4440-b91e-2a05d35c24ae" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +[sources] +CalculusWithJuliaSquared = { url = "https://github.com/FourMInfo/CalculusWithJuliaSquared.jl" } + [compat] CalculusWithJuliaSquared = "0.5.0" julia = "1.12" From 3465d4a8a18dec4def459308e2729ae4697d2c78 Mon Sep 17 00:00:00 2001 From: Aron T Date: Thu, 16 Jul 2026 18:15:21 +0300 Subject: [PATCH 3/4] Instructions: document the [sources] requirement for the unregistered dep Co-Authored-By: Claude Fable 5 --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 45e6717..baf2cce 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -15,7 +15,7 @@ ### What CalculusWithJuliaSquared Provides -[`CalculusWithJuliaSquared`](https://github.com/FourMInfo/CalculusWithJuliaSquared.jl) is a personal, pure-Julia (zero-Python) fork of `CalculusWithJulia.jl`, installed **from its GitHub URL** (it's unregistered — the Manifest pins `repo-url`, tracking `master`). 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`: +[`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` From 3ac66f31364fa8124398b3ea39ed08983eac87d4 Mon Sep 17 00:00:00 2001 From: Aron T Date: Thu, 16 Jul 2026 18:35:19 +0300 Subject: [PATCH 4/4] Truth up notebooks.instructions.md: LAlatex/BlockArrays are not reexported The claim that LAlatex, BlockArrays, and LaTeXStrings are re-exported by the module was never true (inherited from the canonical template, where it is false for Linear_Algebra as well -- only LaTeXStrings is reexported). LAlatex and BlockArrays live in notebooks/Project.toml only and need their own `using` in the setup cell. Also fixes a leftover "using Linear_Algebra" mention and the plot_param_line example from the template, pointing at the CalculusWithJuliaSquared recipes instead. Co-Authored-By: Claude Fable 5 --- .github/instructions/notebooks.instructions.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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