JuliaApproximation / JuliaApproximation/ApproxFun.jl

Newton for simple PDE gives NaN result

Open
#887 1 comment 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

This simple test gives a NaN result:

using ApproxFun

xdom = Chebyshev(-1..1)
x = Fun(identity, xdom)

N(u, v) = [u - x; v + x]

u0 = 0*x
v0 = 0*x
newton(N, [u0, v0])

Result:

2-element Vector{Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}}}:
 Fun(Chebyshev(-1..1), [NaN, NaN, NaN, NaN])
 Fun(Chebyshev(-1..1), [NaN, NaN, NaN])

And I don't know if it's related, but with a two-dimensional domain it gives a different error:

using ApproxFun

xdom = Chebyshev(-1..1)
ydom = Chebyshev(-1..1)
x, y = Fun(identity, xdom*ydom)

N(u, v) = [u - x; v + y]

u0 = 0*x
v0 = 0*x
newton(N, [u0, v0])

Result:

ERROR: LoadError: ArgumentError: invalid argument #4 to LAPACK call
Stacktrace:
  [1] chklapackerror
    @ ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:38 [inlined]
  [2] gesdd!(job::Char, A::Matrix{Float64})
    @ LinearAlgebra.LAPACK ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:1665
  [3] _svd!
    @ ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/svd.jl:125 [inlined]
  [4] svd!(A::Matrix{Float64}; full::Bool, alg::LinearAlgebra.DivideAndConquer)
    @ LinearAlgebra ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/svd.jl:105
  [5] svd!
    @ ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/svd.jl:100 [inlined]
  [6] #svd#114
    @ ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/svd.jl:179 [inlined]
  [7] svd
    @ ~/apps/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/svd.jl:178 [inlined]
  [8] LowRankFun(X::Matrix{Float64}, dx::Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, dy::Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64})
    @ ApproxFunBase ~/.julia/packages/ApproxFunBase/9nGis/src/Multivariate/LowRankFun.jl:59

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

Reproduce the one-dimensional and two-dimensional examples from the issue, then inspect the Newton entry point and ApproxFunBase's Multivariate/LowRankFun.jl around line 59. Determine why the first case produces NaN values and why the second reaches the LAPACK error; done means both examples return valid results without those failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.