Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:09:56) >>> os.chdir('') KeyboardInterrupt >>> print(1.23+4.56) 5.789999999999999 >>> from visual.graph import * >>> gdisplay(foreground=color.black,background=color.white,title='ex1106') >>> Func=gcurve() >>> for X in arange(0.0,2.001*pi,pi/100.0): Funcplot(pos=(X,sin(X))) Traceback (most recent call last): File "", line 2, in Funcplot(pos=(X,sin(X))) NameError: name 'Funcplot' is not defined >>> for X in arange(0.0,2.001*pi,pi/100.0): Func.plot(pos=(X,sin(X))) >>> ================================ RESTART ================================ >>> ================================ RESTART ================================ >>> >>> ================================ RESTART ================================ >>> # {x | x [0..9], x mod 2 /= 0} >>> {x for x in range(11) if x % 2} {1, 3, 9, 5, 7} >>> {x for x in range(11) if x % 2==0} {0, 2, 4, 6, 8, 10} >>> [x for x in range(11) if x % 2==0] [0, 2, 4, 6, 8, 10] >>> l = {1,2,3] SyntaxError: invalid syntax >>> l = [1,2,3] >>> l1 = [l,4,5,6] >>> l1 [[1, 2, 3], 4, 5, 6] >>> l1[0] [1, 2, 3] >>> l1[0][0] 1 >>> l1[0][1] 2 >>> l1[0][3] Traceback (most recent call last): File "", line 1, in l1[0][3] IndexError: list index out of range >>> l1[0][2] 3 >>> l1[2] 5 >>> l1[1] 4 >>> >>> dir() ['__builtins__', '__doc__', '__name__', '__package__', 'eigos', 'kanjis', 'kotae', 'l', 'l1', 'qa', 'random', 'seikai', 'situmon', 't1'] >>> import matplotlib.pyplot as plt Traceback (most recent call last): File "", line 1, in import matplotlib.pyplot as plt ImportError: No module named matplotlib.pyplot >>> ================================ RESTART ================================ >>> Move the stack to the white pole. >>> ================================ RESTART ================================ >>> print(1.23+4.56) 5.789999999999999 >>> from visual import * >>> A=array([[1.0+0j,3.5,5.0]]) >>> print A SyntaxError: invalid syntax >>> print (A) [[ 1.0+0.j 3.5+0.j 5.0+0.j]] >>> B=array([-3.0,5.7,-5.0]) >>> C=array([[4.0,8.0,8.0]]) >>> X1=(-B+(B**2-4*A*C)**0.5)/(2*A) >>> X2=(-B-(B**2-4*A*C)**0.5)/(2*A) >>> print ('X1=',(X1)) X1= [[ 1.50000000+1.32287566j -0.81428571+1.273834j 0.50000000+1.161895j ]] >>> X1[0] array([ 1.50000000+1.32287566j, -0.81428571+1.273834j , 0.50000000+1.161895j ]) >>> x1[0][0] Traceback (most recent call last): File "", line 1, in x1[0][0] NameError: name 'x1' is not defined >>> X1[0][0] (1.5+1.3228756555322954j) >>> S=sum(arange(1,101)) >>> print (S) 5050 >>> from visual.graph import * >>> N=arange(0,101) >>> A=1000000 >>> R=0.01 >>> gdisplay(foreground=color.black,background=color.white,title='test') >>> Func=gcurve() >>> for X in N: Func.plot(pos=(X,A*(1+R)**X-A)) >>> ================================ RESTART ================================ >>> from visual import * >>> D=display(width=400,height=400,range=2.0) >>> D.up=vector(0,0,1) >>> D.forward=vector(-1,-1,-1) >>> D.background=color.white >>> D.title='test' >>> T=arange(0.0,2*pi+0.5+pi/100,pi/100) >>> X=cos(2.0*T) >>> Y=cos(3.0*T) >>> Z=sin(5.0*T) >>> curve(x=X,y=Y,z=Z,radius=0.02) >>> ================================ RESTART ================================ >>> B=transpose(array([[-1,0,0.0,1.0]])) Traceback (most recent call last): File "", line 1, in B=transpose(array([[-1,0,0.0,1.0]])) NameError: name 'transpose' is not defined >>> from visual import * >>> B=transpose(array([[-1,0,0.0,1.0]])) >>> print (B) [[-1.] [ 0.] [ 0.] [ 1.]] >>> array(B) array([[-1.], [ 0.], [ 0.], [ 1.]]) >>> type(B) >>> A=array([[1.0,2.0,3.0],[2.0,3.0,1.0],[3.0,1.0,2.0]]) >>> X=dot(linalg.inv(A),B) Traceback (most recent call last): File "", line 1, in X=dot(linalg.inv(A),B) File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/visual/visual_all.py", line 75, in _dot return numpy(x,y) # arrays rather than Visual vectors ValueError: matrices are not aligned >>> print (A) [[ 1. 2. 3.] [ 2. 3. 1.] [ 3. 1. 2.]] >>> print (B) [[-1.] [ 0.] [ 0.] [ 1.]] >>> Traceback (most recent call last): SyntaxError: invalid syntax >>> B=transpose(array([[-1.0,0.0,1.0]])) >>> X=dot(linalg.inv(A),B) >>> print (X) [[ 0.66666667] [-0.33333333] [-0.33333333]] >>> X=linalg.solve(A,B) >>> print (X) [[ 0.66666667] [-0.33333333] [-0.33333333]] >>>