-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need the python equivalent code in c# #45
Comments
Sure, where is your problem? This test passes fine [TestMethod]
public void QuestionByGurelsoycaner()
{
//>>> import numpy as np
//>>> P1 = np.array([1, 2, 3, 4])
//>>> P2 = np.array([4, 3, 2, 1])
//>>> ex = (P2 - P1) / (np.linalg.norm(P2 - P1))
//>>> ex
//array([0.67082039, 0.2236068, -0.2236068, -0.67082039])
var P1 = np.array(new[] { 1, 2, 3, 4 });
var P2 = np.array(new[] { 4, 3, 2, 1 });
var ex = (P2 - P1) / (np.linalg.norm(P2 - P1));
Assert.AreEqual("array([ 0.67082039, 0.2236068 , -0.2236068 , -0.67082039])", ex.repr);
} |
thanks for responding this fast, In python you can do "ex = (P2 - P1)/(numpy.linalg.norm(P2 - P1)) and ez = numpy.cross(ex,ey)" and I need to perform the same operation in my c# code. should u try it yourself I'm sure you will see what I mean. pls your help it needed. |
I just tried, but from the source code. which nuget package version? |
yeah, I see, NumSharp is a different repository. This is Numpy.NET. |
NumpyDotNet is not right either. Install this: https://www.nuget.org/packages/Numpy/ |
thank you very very much sir, GOD BLESS. |
I'm having problem convert this py code
and
d = numpy.linalg.norm(P2 - P1)
and
ez = numpy.cross(ex,ey)
I'm using .net core 3.1 and I've installed this.
please I need the python equivalent of the above code in c#.
thanks in advance.
Nelly
The text was updated successfully, but these errors were encountered: