#  MethodError

**URL:** <https://discourse.julialang.org/t/methoderror/15873>\
**Category:** New to Julia\
**Created:** [October 4, 2018, 12:53pm UTC](https://discourse.julialang.org/t/methoderror/15873 "2018-10-04T12:53:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bishu1991](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bishu1991](https://discourse.julialang.org/u/Bishu1991)\
**Post date:** [October 4, 2018, 12:53pm UTC](https://discourse.julialang.org/t/methoderror/15873/1 "2018-10-04T12:53:30Z")

</div>

using Nemo  
function lift(x::FinFieldElem)  
Fl = parent(x)  
[@Assert](https://github.com/Assert) Nemo.isprime(order(Fl))  
i = 0  
while i != x  
i += 1  
end  
return i  
end

function order(x::FinFieldElem)  
K = parent(x)  
if x == Nemo.zero(K)  
throw(ArgumentError(“Argument must be non-zero”))  
else  
k = 1  
z = x  
while z != Nemo.one(K)  
z \*= x  
k += 1  
end  
return k  
end  
end  
function roots(f::PolyElem{T}) where {T \<: FinFieldElem}  
fac = Nemo.factor(f)  
res = Dict{T, Int}()  
for index in fac  
P, exp = index  
if degree(P) == 1  
res[- coeff(P, 0)] = exp  
end  
end  
res = collect(res)  
return res  
end  
p = ZZ(2)^128 + 51  
F, \_ = FiniteField(p, 1, “u”)  
FX, X = PolynomialRing(F, “X”)

E0 = EllipticCurve(F(1), F(9))  
ZZY, Y = PolynomialRing(ZZ, “Y”)  
frob\_poly = Y^2 + ZZ(13815554068038022463)\*Y + ZZ(340282366920938463463374607431768211507)  
Card = ZZ(340282366920938463477190161499806233971)  
primes\_use\_step =   
eigenvalues = Dict()  
primes\_use\_step\_torsion =   
orders = Dict()

for ell in primes(2, 100)  
Fl, \_ = FiniteField(ell, 1, “u”)  
FlZ, Z = PolynomialRing(Fl, “Z”)  
frob\_poly\_mod\_ell = FlZ(frob\_poly)  
rts = roots(frob\_poly\_mod\_ell)  
if length(rts)==2  
rts = (rts[1][1], rts[2][1])  
order1 = order(rts[1])  
order2 = order(rts[2])  
if ((order1 != order2) & (min(order1, order2) \< 10))  
append!(primes\_use\_step\_torsion, [ell])  
orders[ell] = min(order1, order2)  
else  
append!(primes\_use\_step, ell)  
eigenvalues[ell] = (lift(rts[1]), lift(rts[2]))  
end  
end  
end

When I run this I get the error message as follows:

LoadError: MethodError: no method matching order(::FqNmodFiniteField)  
Closest candidates are:  
order(::FinFieldElem) at /home/cssc/exp.jl:13  
Stacktrace:  
[1] lift(::fq\_nmod) at /home/cssc/exp.jl:4  
[2] top-level scope at /home/cssc/exp.jl:65  
[3] include at ./boot.jl:317 [inlined]  
[4] include\_relative(::Module, ::String) at ./loading.jl:1038  
[5] include(::Module, ::String) at ./sysimg.jl:29  
[6] include(::String) at ./client.jl:388  
[7] top-level scope at none:0  
in expression starting at /home/cssc/exp.jl:51

I don’t understand the problem. can any one help with this?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 4, 2018, 1:06pm UTC](https://discourse.julialang.org/t/methoderror/15873/2 "2018-10-04T13:06:17Z")

</div>

I can’t get your code to run but it looks like your problem is here:

```julia
order1 = order(rts[1])
order2 = order(rts[2])

```

I’m not sure what `typeof(rts[1])` gives, but it seems that it is `FqNmodFiniteField`, while your order function is only defined for `FinFieldElem` inputs.

Your `roots` function seems to accept subtypes of `FinFieldElem`, you might want to define the `order` function in a saimilar way? (Note that I have no understanding of the type hierarchy here given that I can’t get Nemo to work on 0.7!)
