HS

35 Reputation

3 Badges

0 years, 288 days

MaplePrimes Activity


These are replies submitted by HS

@Christian Wolinski    okay but then why doesn't maple just do the cancellation?    

@Christian Wolinski 

yes that works  why is the first equality in brackets though?  I'm not familiar with how maple work with regards to this  would  P2=Q2 not first return true or false?

@Carl Love 


EAdd := proc(f, x, p, P1,P2,Q1,Q2)      #elliptic curve addition 
     local a,mm,R1,R2;
     a := coeff( f,x,1);
  
if P1=infinity    
then 
    return [Q1,Q2];
  elif     Q1=infinity
    then
    return [P1,P2];
  elif Q1=P1 mod p
    then
        if Q2=-P2 mod p
        then 
          return    [infinity, infinity]
          elif Q2=P2 
          then mm:= (3*P1^2+a)/(2*P2) mod p;
      R1 := Normal( mm^2  - P1 - Q1 ) mod p;
     R2 := Normal( mm*(P1-R1) - P2 ) mod p;
     return  [R1,R2] mod p ;   
         end if ;
        else  mm := (Q2-P2)/(Q1-P1)  mod p;

   R1 := Normal( mm^2  - P1 - Q1 ) mod p;
   R2 := Normal( mm*(P1-R1) - P2 ) mod p;
     return  [R1,R2] mod p ;
 end if ;
   # mm := (Q2-P2)/(Q1-P1);
     
 end proc:

 


f:=x^3-x-1;


p:=11; 
k:=2;

alias(q = RootOf( Poly, z ) );
WeilP(m, 1, q, 8, 5*q, f, 11);

@Carl Love 

I'm getting a weird error, 

field:= proc(p,k)    
local Poly  ;
Poly:= Randprime(k,z) mod p;  # polynomial that we mod out by

alias(q = RootOf( Poly, z ) );

return [q, Poly] ;
    end proc ;

vv := field(13, 2);
Warning, alias or macro q defined in terms of RootOf(_Z^2+10*_Z+7)
                        vv := [q, z^2 + 12*z + 3]
q = vv[1];
                             q = q
q^2 + 12*q + 3;
                                     
                         

vv := field(13, 2);
Warning, alias or macro q defined in terms of RootOf(_Z^2+10*_Z+7)
                       

vv := [q, z^2 + 12*z + 3]
q = vv[1];
                             q = q
q^2 + 12*q + 3;
                        q^2 + 12*q + 3

simplify(q^2 + 12*q + 3, 'symbolic');
                            2 q - 4
Normal(q^2 + 12*q + 3) mod p;
                  2*q + 9

would you happen to know why this does not seem to work when I put it in a procedure?

@vv thanks . and yes this is not a good example I just tried the simplest thing that was causing trouble

@Carl Love   Expand((x - 1)/(x - 3)) mod 13;
Error, (in mod/Expand) polynomial over a finite field expected

f is a rational function so what would be the easiest way to just have maple "mod out by q" on both the numerator and denominator

@Carl Love  Can I use expand for rational functions?  e.g. 

m:= Expand*( *((x-1)/((x-3)))   ) mod 13;
Error, invalid product/quotient

Is expand the best way to "mod out by the minimal polynomial"?

@Carl Love   this time I'm running maple 19 

 

@Carl Love   I'm finding that maple often forgets  what q is until I ask it to simplify   also it seems to forget or perhaps it was not made explicit that this is over mod p   e.g

 

(p,d):= (7,3): 
irr:= Randprime(d,z) mod p; 
                   irr := z  + 5 z  + 5 z + 2
f := (x^3 + x + 1) mod p;
                        
alias(q = RootOf(irr, z));
                               q
eval(f, x = q^2) mod p;
                        q^6 + q^2 + 1

simplify(q^6 + q^2 + 1) mod p;
                   2*q^2 + 2*q + 1  

Further I seem to be getting weird errors

 

f := (x^3 + x + 1) mod p;
                                      
                        f := x^3  + x + 1

alias(q = RootOf(irr, z));
                               q
eval(f, x = q^2) mod p;
                             
                      q^6 + q^2 + 1

simplify(q^6 + q^2 + 1) mod p;
                                      
                         2 q^2  + 2 q + 1

if q^6 + q^2 + 1 = (2*q^2 + 2*q + 1) mod p then
    return 1;
else
    return 0;
end if;
I get 0 not 1

@Carl Love   Sorry you're right I overlooked the  alias(q = RootOf(irr, z))  step  

I'm getting a weird error with your code however 

`mod/Generators`:= (q::RootOf, p::prime)->
    local 
        x, n:= p^degree(op(q))-1, 
        Ns:= n/~NumberTheory:-PrimeFactors(n):
    select(
        e-> not 1 in Expand~(e^~Ns) mod p,
        index~(Roots(x^n-1, q) mod p, 1)
    )
:
Error, reserved word `local` unexpected

p.s.   how do you look stuff up in maple?  like I tried to look for index~   but  found nothing   also is there like keyword/builtin function highlighting or something

@Carl Love  Okay is there a way to just "work" over finite fields of non prime order. 

Your way  for computing Gcd over non prime order fields does not work since your not moding out by an irreducible polynomial of degree 2 it won't even recognize when your polynomial is 0.

And there is the matter of how to use your method with the built in GF system to find generators, inverses etc
 

What is CovertIn ?

 

p.s. am I the only person that finds maple documentation really hard to understand?

@Carl Love  the actual  polynomials I had were long and complicated and I didn't bother writing it out here I just wanted to know how to do it on a toy example

@Mac Dude  you mean where the worksheet is saved?

@acer No unless there is no way to use maple like a normal programming language.  I mean how to open a code editor in a new window or tab (not the weird code region thing) .  function templates   debugging tools etc

Page 1 of 1