Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F7879462
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/test/testPython2D b/test/testPython2D
--- a/test/testPython2D
+++ b/test/testPython2D
@@ -1,35 +1,38 @@
#! /usr/bin/env python
import numpy as np
def f(x,y):
return 3*x**3 + 4*y**3 - 10*x*y**2 - 2*x**2 + 0.5*y**2 + 2*x + 9*y - 2*x*y + 1
A = np.linspace(0, 20, 20)
M_X, M_Y = np.meshgrid(A, A)
M_Z = np.empty(M_X.shape)
P, Y = [], []
for i in xrange(M_X.shape[0]):
for j in xrange(M_X.shape[1]):
P.append([i,j])
Y.append(f(i,j))
import professor2 as prof
import sys
order = int(sys.argv[1]) if len(sys.argv) > 1 else 3
ipol = prof.Ipol(P, Y, order)
for i in xrange(M_X.shape[0]):
for j in xrange(M_X.shape[1]):
M_Z[i,j] = ipol.value([M_X[i,j], M_Y[i,j]])
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
+ax.set_xlabel("x")
+ax.set_ylabel("y")
+ax.set_zlabel("f(x,y")
X1, Y1 = zip(*P)
Z1 = Y
ax.scatter(X1, Y1, Z1, c="r")
ax.plot_wireframe(M_X, M_Y, M_Z, rstride=1, cstride=1)
plt.show()
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 19, 8:28 PM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3806036
Default Alt Text
(1 KB)
Attached To
rPROFESSORHG professorhg
Event Timeline
Log In to Comment