Giter Club home page Giter Club logo

algebraicnumbers.jl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

algebraicnumbers.jl's Issues

i+1 == 2

The composed sum of (the coeffs of) 1 and i gives a wrong result.

Reproduce like:

i = sqrt(AlgebraicNumber(-1))
# ≈0.0 + 1.0im
uno  = AlgebraicNumber(1)
# ≈1.0 + 0.0im
two = AlgebraicNumber(2)
# ≈2.0 + 0.0im
ipu = 1+i

[ipu == two, two.coeff == ipu.coeff, two.prec == ipu.prec, two.apprx == ipu.apprx]'
#  true  true  true  false

(i+1).coeff'
# -2  1
AlgebraicNumbers.composed_sum(uno.coeff, i.coeff)'
# -2  1

The polynomial should be x²-2x+2, thus the coeffs [2,-2,1]

Maintenance?

Hi,

is this project still maintained?
Would you mind either taking a look at my PR (#8) or considering giving me commit rights?
I find this package very useful and would like to register it on the General registry.

Install Pkg not found

Hello,
Your package is exactly what i'm looking for! However your package could not be found in Pkg

julia> using Pkg
julia> Pkg.add("AlgebraicNumber")
ERROR: The following package names could not be resolved:
 * AlgebraicNumber (not found in project, manifest or registry)
Please specify by known `name=uuid`.

Cannot use `I` (`UniformScaling` from LinearAlgebra) with AlgebraicNumbers

Consider the following MWE:

using LinearAlgebra
using AlgebraicNumbers


A = AlgebraicNumber.([
    1 2
    3 4
])

λ = AlgebraicNumber(2)

B = A - λ*I # error here

Error arises:

ERROR: LoadError: MethodError: promote_rule(::Type{Bool}, ::Type{AlgebraicNumber{BigInt, BigFloat}}) is ambiguous.

Candidates:
  promote_rule(x::Type{T}, y::Type{AlgebraicNumber{S, F}}) where {T<:Integer, S, F}
    @ AlgebraicNumbers ~/.julia/packages/AlgebraicNumbers/H0atE/src/promote.jl:14
  promote_rule(::Type{Bool}, ::Type{T}) where T<:Number
    @ Base bool.jl:4

Possible fix, define
  promote_rule(::Type{Bool}, ::Type{AlgebraicNumber{S, F}}) where {S, F}

Stacktrace:
 [1] promote_type(#unused#::Type{AlgebraicNumber{BigInt, BigFloat}}, #unused#::Type{Bool})
   @ Base ./promotion.jl:307
 [2] _promote
   @ ./promotion.jl:357 [inlined]
 [3] promote
   @ ./promotion.jl:381 [inlined]
 [4] *(x::AlgebraicNumber{BigInt, BigFloat}, y::Bool)
   @ Base ./promotion.jl:411
 [5] *(x::AlgebraicNumber{BigInt, BigFloat}, J::UniformScaling{Bool})
   @ LinearAlgebra ~/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/uniformscaling.jl:263
 [6] top-level scope
   @ ~/MSU/Code/Quadrics/bug.jl:12
 [7] include(fname::String)
   @ Base.MainInclude ./client.jl:478
 [8] top-level scope
   @ REPL[14]:1

I expected that I will work just like with, e.g., NiceNumbers:

using LinearAlgebra
using NiceNumbers

A = NiceNumber.([
    1 2
    3 4
])

λ = NiceNumber(2)

B = A - λ*I

(the answer is

2×2 Matrix{NiceNumber}:
 -1  2
  3  2

what I've expected)

Install Julia Registrator

Hi @anj1,
to publish new versions to the 'General' registry, it would be easiest to install the Registrator GitHub app. Currently, new versions of AlgebraicNumbers.jl don't get deployed to the registry.
This can be done using few clicks here: install

If you want to read a bit more about it, you can take a look at the Readme here.

Have a nice day,
Felix

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

pow3

There's a TODO for efficient calculation of third power here. Please would you be so kind and explain how (if at all) it is possible to make it more efficient than pow2 and *?

Matrix multiplication and type stability

Hello! Didn't get an answer on Discourse, so hope to succeed here.

Let’s consider MVE:

using LinearAlgebra
using AlgebraicNumbers


M = AlgebraicNumber.([
    1 2
    3 4
])

b = AlgebraicNumber.([5; 6])

println(typeof(M))
println(typeof(b))

x = M * b

println(typeof(x))

Expected a Vector{AlgebraicNumber...}, not Vector{Any}, just like in this example:

using LinearAlgebra
using AlgebraicNumbers


M = Rational.([
    1 2
    3 4
])

b = Rational.([5; 6])

println(typeof(M))
println(typeof(b))

x = M * b

println(typeof(x))

That’s interesting that it works just fine with functions like det and tr, but not with matrix multiplication.

So, my question is: is it normal behavior? And if so, how should I perform this operation in order to get Vector{AlgebraicNumber...}? Should I just use conversion from type Any?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.