Skip to content

Add ArrayDifferentialOperators for Vector calculus - #942

Open
xtalax wants to merge 13 commits into
JuliaSymbolics:masterfrom
xtalax:vector-calc
Open

Add ArrayDifferentialOperators for Vector calculus#942
xtalax wants to merge 13 commits into
JuliaSymbolics:masterfrom
xtalax:vector-calc

Conversation

@xtalax

@xtalax xtalax commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Adds Vector calculus operators which are composable by the dot and cross product.

A request for comment on a good design so that equations with these display intelligibly

@codecov-commenter

codecov-commenter commented Aug 4, 2023

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 1.72414% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.80%. Comparing base (60d26bb) to head (068ad64).
⚠️ Report is 2005 commits behind head on master.

Files with missing lines Patch % Lines
src/diff.jl 0.00% 57 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #942      +/-   ##
=========================================
+ Coverage    8.35%   8.80%   +0.44%     
=========================================
  Files          26      26              
  Lines        3267    3318      +51     
=========================================
+ Hits          273     292      +19     
- Misses       2994    3026      +32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ChrisRackauckas
ChrisRackauckas requested a review from shashi August 12, 2023 20:45
@xtalax

xtalax commented Aug 21, 2023

Copy link
Copy Markdown
Contributor Author

Core fails look unrelated

@xtalax xtalax changed the title WIP Add ArrayDifferentialOperators for Vector calculus [Awaiting Review] Add ArrayDifferentialOperators for Vector calculus Aug 21, 2023
Comment thread src/diff.jl Outdated
@@ -1,4 +1,5 @@
abstract type Operator <: Function end
abstract type AbstractOperator <: Function end
abstract type Operator <: AbstractOperator end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need 2 of these?

Comment thread src/diff.jl Outdated
abstract type ArrayOperator end

struct ArrayDifferentialOperator <: ArrayOperator
"""The variables to differentiate with resp≈ect to."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@shashi

shashi commented Aug 25, 2023

Copy link
Copy Markdown
Member

2 things:

  1. There are extra Abstract types, I don't like creating type hierarchy until it leads to code reuse with dispatch. Until then, just use concrete types.
  2. Ideally I'd want to give Differential itself dimensions. So Differential(x) behaves like d/dx for scalar, but Differential(x) behaves like Nabla for x::Vector. Can achieve nabla by just parameterizing Differential with the type of x. It seems like all the other operators you added can still be expressed in these terms.

Comment thread src/diff.jl
Base.:*(D1::Differential, D2::Differential) = D1 ∘ D2
Base.:^(D::Differential, n::Integer) = _repeat_apply(D, n)
Base.:*(D1, D2::Operator) = D1 ∘ D2
Base.:*(D1::Operator, D2) = D1 ∘ D2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why we have these methods @ChrisRackauckas ? this does not make sense in general, only maybe for 2 operators

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a case where they don't make sense?

@xtalax

xtalax commented Aug 25, 2023

Copy link
Copy Markdown
Contributor Author

Ideally I'd want to give Differential itself dimensions. So Differential(x) behaves like d/dx for scalar, but Differential(x) behaves like Nabla for x::Vector. Can achieve nabla by just parameterizing Differential with the type of x. It seems like all the other operators you added can still be expressed in these terms.

The reason I have done this is that operators are often combined together, so the elements of differentials are not necessarily differentials, but can in general be other functions too.

Comment thread src/diff.jl Outdated
@xtalax xtalax changed the title [Awaiting Review] Add ArrayDifferentialOperators for Vector calculus Add ArrayDifferentialOperators for Vector calculus Sep 4, 2023
@ChrisRackauckas

Copy link
Copy Markdown
Member

What's left here?

@raphaelchinchilla

Copy link
Copy Markdown
Contributor

What is the status of this PR?

@ChrisRackauckas

Copy link
Copy Markdown
Member

Stale, someone would need to revive it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants