JuliaApproximation / JuliaApproximation/ApproxFun.jl

What is the difference between adjoint and a Derivative (newton solver)?

Open
#935 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
559
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Not so much of an issue, but a highly confusing point. Apparently both ' and Derivative() compute the derivative but in different ways:

> Fun(x -> x^2)'
Fun(Chebyshev(), [0.0, 2.0])

and

> Derivative() * Fun(x -> x^2)
Fun(Ultraspherical(1), [0.0, 1.0])

This is the most confusing while using newton(). The example from the docs with ' works:

using ApproxFun
using Plots

N1(u, x = Fun()) = [u(-1.)-1., u(1.)+0.5, 0.001u'' + 6(1-x^2)u' + u^2 - 1];
u = newton(N1, 0 * Fun())

plot(u)

but changing it to

∂x = Derivative()
N1(u, x = Fun()) = [u(-1.)-1., u(1.)+0.5, 0.001 * (∂x^2 * u) + 6(1-x^2) * (∂x * u) + u^2 - 1];

throws an error:

MethodError: no method matching space(::ApproxFun.DualFun{Fun{Chebyshev{ChebyshevInterval{Float64}, Float64}, Float64, Vector{Float64}}, ConstantOperator{Float64, Chebyshev{ChebyshevInterval{Float64}, Float64}}})

Closest candidates are:
  space(::LowRankFun, ::Integer)
   @ ApproxFunBase [~/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl:348](http://localhost:8888/home/grigory/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl#line=347)
  space(::LowRankFun)
   @ ApproxFunBase [~/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl:349](http://localhost:8888/home/grigory/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl#line=348)
  space(::Fun)
   @ ApproxFunBase [~/.julia/packages/ApproxFunBase/clvO0/src/Fun.jl:339](http://localhost:8888/home/grigory/.julia/packages/ApproxFunBase/clvO0/src/Fun.jl#line=338)
  ...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two derivative examples and the Newton solver example shown in the issue. Compare the ' syntax with Derivative() and investigate the reported space(::ApproxFun.DualFun...) error. Done means documenting their distinction, explaining the Newton solver failure, and identifying the relevant documentation location to update.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.