0
function [X,Y,n] = PC(A,B,p)
% This function m-file finds and plots all the points that lie in E_p(A,B)
% These points are on the curve y^2 = x^3 + AX + b (mod p)
    RHS = zeros(3,1);
    LHS = zeros(3,1);
    X = zeros(2,1);
    Y = zeros(2,1);
    for i=0:1:(p-1)
        RHS(i+1) = (i)^3 + A*(i) + B;
        RHS(i+1) = rmp(RHS(i+1),p);
        LHS(i+1) = (i)^2;
        LHS(i+1) = rmp(LHS(i+1),p);

    end
    ii=1;
    for z=0:1:(p-1)
        I=find(RHS==z);
        J=find(LHS==z);
        q1 = isempty(I);
        q2 = isempty(J);
        if (q1) == 0
            if q2 == 0
                n=length(I);
                m=length(J);
                for h=1:1:n
                    for g=1:m
                        X(ii)=I(h)-1;
                        Y(ii)=J(g)-1;
                        ii=ii+1;
                    end
                end
            end
        end
    end
    n=length(X) + 1;
    %%%%%%%PLOTTING%%%%%%%%%%%
    h=plot(X,Y,'ko');
    set(h(1),'LineWidth',1.5)
    axis([0, (max(X)+1), 0,(max(Y)+1) ])
    xlabel('X','FontSize',15,'FontWeight','bold')
    ylabel('Y','FontSize',15,'FontWeight','bold')
    title(['The points in E_{',int2str(p),'}',int2str(A),',',int2str(B),')'],'FontSize',12,'FontWeight','bold')

the code will find and plot all the points on a specific prime curve. This m-file takes as its inputs, A,B and p and produces two vectors X, Y which contain all the points (x, y) that lie on y2 x3 + Ax + B (mod p).

i just want to know the what is the rmp function and why it is used. i try to find it in matlab documentation, but i couldn't find it.

posdef
  • 6,498
  • 11
  • 46
  • 94
  • rmp is not a function that ships with Matlab. I assume that it has been written by the author of the function you posted - you should contact them. – Jonas Jun 12 '12 at 16:25
  • thanx Jonas for ur reply, i got it. i think rmp works as a mod function. so i directly use mod function instead rmp. – Suman Bala Jun 13 '12 at 07:13

0 Answers0