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
Copy link
Copy Markdown
Contributor

@xtalax xtalax commented Aug 1, 2023

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
Copy link
Copy Markdown

codecov-commenter commented Aug 4, 2023

Codecov Report

Merging #942 (068ad64) into master (60d26bb) will increase coverage by 0.44%.
The diff coverage is 1.72%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            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     
Files Changed Coverage Δ
src/diff.jl 0.29% <0.00%> (-0.06%) ⬇️
src/arrays.jl 12.18% <100.00%> (+0.55%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ChrisRackauckas ChrisRackauckas requested a review from shashi August 12, 2023 20:45
@xtalax
Copy link
Copy Markdown
Contributor Author

xtalax commented Aug 21, 2023

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
Copy link
Copy Markdown
Member

shashi commented Aug 25, 2023

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
Copy link
Copy Markdown
Contributor Author

xtalax commented Aug 25, 2023

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