# How to find x-coordinate of the curve If y-coordinate is given?

조회 수: 35(최근 30일)
Noor Bano 2021년 3월 27일
댓글: Noor Bano 2021년 3월 28일
disp('y^2 = x^3 + 14 mod 17')
y=0:16
for i=1:17
left_side = mod(y(i).^2,17);
right_side = mod(x.^3+14,17;
end
If I have y-coordinates from 0 to 16, how can I find the corresponding x-coordinate that satifies 'y^2 = x^3 + 14 mod 17'

댓글을 달려면 로그인하십시오.

### 채택된 답변

Image Analyst 2021년 3월 28일
I understand now. Try this:
for k1 = 0 : 16
for k2 = 0 : 16
equation1 = k1 .^ 2;
equation2 = k2 .^ 3 + 14;
eqn1mod = mod(equation1, 17);
eqn2mod = mod(equation2, 17);
indexes = find(eqn1mod == eqn2mod);
if ~isempty(indexes)
fprintf('Match at k1 = %d and k2 = %d.\n', k1, k2);
fprintf(' equation1 = %d and equation2 = %d.\n', equation1, equation2);
fprintf(' mod(equation1, 17) = %d and mod(equation2, 17) = %d.\n', eqn1mod, eqn2mod);
end
end
end
You'll see
Match at k1 = 0 and k2 = 7.
equation1 = 0 and equation2 = 357.
mod(equation1, 17) = 0 and mod(equation2, 17) = 0.
Match at k1 = 1 and k2 = 13.
equation1 = 1 and equation2 = 2211.
mod(equation1, 17) = 1 and mod(equation2, 17) = 1.
Match at k1 = 2 and k2 = 14.
equation1 = 4 and equation2 = 2758.
mod(equation1, 17) = 4 and mod(equation2, 17) = 4.
Match at k1 = 3 and k2 = 6.
equation1 = 9 and equation2 = 230.
mod(equation1, 17) = 9 and mod(equation2, 17) = 9.
Match at k1 = 4 and k2 = 8.
equation1 = 16 and equation2 = 526.
mod(equation1, 17) = 16 and mod(equation2, 17) = 16.
Match at k1 = 5 and k2 = 12.
equation1 = 25 and equation2 = 1742.
mod(equation1, 17) = 8 and mod(equation2, 17) = 8.
Match at k1 = 6 and k2 = 11.
equation1 = 36 and equation2 = 1345.
mod(equation1, 17) = 2 and mod(equation2, 17) = 2.
Match at k1 = 7 and k2 = 1.
equation1 = 49 and equation2 = 15.
mod(equation1, 17) = 15 and mod(equation2, 17) = 15.
Match at k1 = 8 and k2 = 16.
equation1 = 64 and equation2 = 4110.
mod(equation1, 17) = 13 and mod(equation2, 17) = 13.
Match at k1 = 9 and k2 = 16.
equation1 = 81 and equation2 = 4110.
mod(equation1, 17) = 13 and mod(equation2, 17) = 13.
Match at k1 = 10 and k2 = 1.
equation1 = 100 and equation2 = 15.
mod(equation1, 17) = 15 and mod(equation2, 17) = 15.
Match at k1 = 11 and k2 = 11.
equation1 = 121 and equation2 = 1345.
mod(equation1, 17) = 2 and mod(equation2, 17) = 2.
Match at k1 = 12 and k2 = 12.
equation1 = 144 and equation2 = 1742.
mod(equation1, 17) = 8 and mod(equation2, 17) = 8.
Match at k1 = 13 and k2 = 8.
equation1 = 169 and equation2 = 526.
mod(equation1, 17) = 16 and mod(equation2, 17) = 16.
Match at k1 = 14 and k2 = 6.
equation1 = 196 and equation2 = 230.
mod(equation1, 17) = 9 and mod(equation2, 17) = 9.
Match at k1 = 15 and k2 = 14.
equation1 = 225 and equation2 = 2758.
mod(equation1, 17) = 4 and mod(equation2, 17) = 4.
Match at k1 = 16 and k2 = 13.
equation1 = 256 and equation2 = 2211.
mod(equation1, 17) = 1 and mod(equation2, 17) = 1.
##### 댓글 수: 3표시숨기기 이전 댓글 수: 2
Noor Bano 2021년 3월 28일
Thank you very much for such a help.

댓글을 달려면 로그인하십시오.

### 추가 답변(1개)

Image Analyst 2021년 3월 27일
Because of missing parentheses regarding mod, and a poorly worded question, it's unclear what you want and exactly what is to be moded. But let's start here, then you can explain further.
disp('y^2 = x^3 + 14 mod 17')
y=0:16
x = (y .^ 2 - 14) .^ (1/3)
nexttile;
plot(x, y, 'b.-', 'LineWidth', 2, 'MarkerSize', 25);
grid on
xlabel('x', 'Interpreter', 'none', 'FontSize', 15);
ylabel('y', 'Interpreter', 'none', 'FontSize', 15);
for k=1:17
left_side(k) = mod(y(k).^2,17)
right_side(k) = mod(real(x(k).^3+14),17)
% If I have y-coordinate from 0 to 16
% how can I find corresponding x-coordinate that
% satisfies 'y^2 = x^3 + 14 mod 17'
end
nexttile;
plot(right_side, left_side, 'b.-', 'LineWidth', 2, 'MarkerSize', 25);
grid on
xlabel('right_side', 'Interpreter', 'none', 'FontSize', 15);
ylabel('left_side', 'Interpreter', 'none', 'FontSize', 15); ##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Image Analyst 2021년 3월 27일
So if x=1 and y=7,
y^2 = 49 and mod(49,17) is 15
x^3+14 = 17 and mod(17,17) is 0
So explain again in detail why point (1,7) is a point where this condition is true.
And please make clear whether y^2 is also supposed to be moded by 17, or if it's just the right hand (x) side of the equation that's supposed to be moded with 17. In other words is it
mod(y^2, 17)
AND
mod(x.^3+14,17)
OR JUST the right hand side (because you did not use mod explicitly on the left hand side).
mod(x.^3+14,17)
In other word did you mean
y^2 = x^3 + 14 mod 17
or did you mean
y^2 mod 17 = x^3 + 14 mod 17
So, since y^2 = x.^3+14, whenever y^2 is mod 17, then x.^3+14 will also be mod 17 since y^2 = x.^3+14. They will both be mod 17 at the same time.
And finally, you might want to look at rem() rather than mod.

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!