Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: SingularException(4) #199

Closed
LH1389 opened this issue Mar 20, 2024 · 3 comments
Closed

ERROR: SingularException(4) #199

LH1389 opened this issue Mar 20, 2024 · 3 comments

Comments

@LH1389
Copy link

LH1389 commented Mar 20, 2024

using LinearAlgebra 
    f(x) = (x[1]+10*x[2])^2 + 5*(x[3]-x[4])^2 + (x[2]-2*x[3])^4 + 10*(x[1]-x[4])^4
    f1(x) = 2(x[1]+10*x[2]) + 40(x[1]-x[4])^3
    f2(x) = 20(x[1]+10*x[2]) + 4(x[2]-2*x[3])^3
    f3(x) = 10(x[3]-x[4]) - 8(x[2]-2*x[3])^3
    f4(x) = -10(x[3]-x[4]) - 40(x[1]-x[4])^3
    X(x)  = [f1(x);f2(x);f3(x);f4(x)]
    ;
    f11(x) = 2+120(x[1]-x[4])^2
    f12(x) = 20
    f13(x) = 0
    f14(x) = -120(x[1]-x[4])^2
    f15(x) = [f11(x);f12(x);f13(x);f14(x)]
    f21(x) = 20
    f22(x) = 200+12(x[2]-2*x[3])^2
    f23(x) = -24(x[2]-2*x[3])^2
    f24(x) = 0
    f25(x) = [f21(x);f22(x);f23(x);f24(x)]
    f31(x) = 0
    f32(x) = -24(x[2]-2*x[3])^2
    f33(x) = 10 + 48(x[2]-2*x[3])^2
    f34(x) = -10
    f35(x) = [f31(x);f32(x);f33(x);f34(x)]
    f41(x) = -120(x[1]-x[4])^2
    f42(x) = 0
    f43(x) = -10
    f44(x) = 10 + 120(x[1]-x[4])^2
    f45(x) = [f41(x);f42(x);f43(x);f44(x)]
    F(x) = [f15(x) f25(x) f35(x) f45(x)]
    x = [3,-1,0,1]
    t1 = inv(F(x))
    F([3,-1,0,1])
    dis=1
function newton(x)
while dis > 0.01
    g = X(x)
    t1 = inv(F(x))
    x1 = x - t1 * g
    dis = sqrt((x1[1]-x[1])^2+(x1[2]-x[2])^2+(x1[3]-x[3])^2+(x1[4]-x[4])^2)
    x = x1
    println(x,f(x)) 
end
end
x = [3,-1,0,1]
newton(x)
@LH1389
Copy link
Author

LH1389 commented Mar 20, 2024

ERROR: SingularException(4)
Stacktrace:

checknonsingular at [factorization.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

checknonsingular at [factorization.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

#lu!#170 at [lu.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
lu! at [lu.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

#lu#176 at [lu.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

lu at [lu.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html) (repeats 2 times)

inv(A::Matrix{Float64}) at [dense.jl](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

newton(x::Vector{Int64}) at [Untitled-3](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

top-level scope at [Untitled-3](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

@LH1389
Copy link
Author

LH1389 commented Mar 20, 2024

Why it cannot stop?

@Kolaru
Copy link
Collaborator

Kolaru commented Apr 19, 2024

The error comes from the fact that sometimes F(x) is not invertible (resulting in a SinguarException).

However this seems to be unrelated to IntervalRootFinding.jl, so I am closing the issue.

@Kolaru Kolaru closed this as completed Apr 19, 2024
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

No branches or pull requests

2 participants