In [2]:
import time
time.sleep(10)
In [4]:
!gcc?
In [6]:
from ctypes import CDLL
In [7]:
CDLL?
In [9]:
dll = 'dylib'
libc = CDLL("libc.%s" % dll)
In [10]:
libc?
In [16]:
libc?
In [17]:
message = 'The IPython notebook is great!'
# note: the echo command does not run on Windows, it's a unix command.
!echo $message
In [18]:
%load?
In [19]:
%load http://matplotlib.sourceforge.net/mpl_examples/pylab_examples/integral_demo.py
In [20]:
#!/usr/bin/env python
# implement the example graphs/integral from pyx
from pylab import *
from matplotlib.patches import Polygon
def func(x):
return (x-3)*(x-5)*(x-7)+85
ax = subplot(111)
a, b = 2, 9 # integral area
x = arange(0, 10, 0.01)
y = func(x)
plot(x, y, linewidth=1)
# make the shaded region
ix = arange(a, b, 0.01)
iy = func(ix)
verts = [(a,0)] + list(zip(ix,iy)) + [(b,0)]
poly = Polygon(verts, facecolor='0.8', edgecolor='k')
ax.add_patch(poly)
text(0.5 * (a + b), 30,
r"$\int_a^b f(x)\mathrm{d}x$", horizontalalignment='center',
fontsize=20)
axis([0,10, 0, 180])
figtext(0.9, 0.05, 'x')
figtext(0.1, 0.9, 'y')
ax.set_xticks((a,b))
ax.set_xticklabels(('a','b'))
ax.set_yticks([])
show()
In [2]:
x = 0
houses = 100000
oneHouseProfit = 100000
newHouses = houses - 0.1*x*10000
totalProfit = x/100*newHouses*oneHouseProfit
In [3]:
#x = 0
x = 0
houses = 100000
oneHouseProfit = 100000
newHouses = houses - 0.1*x*10000
totalProfit = x/100*newHouses*oneHouseProfit
print ("当税率为",x,"时:")
print ("可销售房屋数量为:", newHouses)
print ("税收为:", totalProfit)
In [4]:
#x = 100
x = 100
houses = 100000
oneHouseProfit = 100000
newHouses = houses - 0.1*x*10000
totalProfit = x/100*newHouses*oneHouseProfit
print ("当税率为",x,"时:")
print ("可销售房屋数量为:", newHouses)
print ("税收为:", totalProfit)
In [5]:
totalProfit = x/100 * (houses - 0.1*x*10000) * oneHouseProfit
In [10]:
fig, axes = subplots(1,2)
x = np.linspace(0,100,50)
totalProfit = x/100 * (houses - 0.1*x*10000) * oneHouseProfit
newHouses = houses - 0.1*x*10000
axes[0].plot(x, totalProfit)
axes[0].set_xlabel("X")
axes[0].set_ylabel("totalProfit")
axes[1].plot(x, newHouses)
axes[1].set_xlabel("x")
axes[1].set_ylabel("newHouses")
fig.tight_layout()
fig.show()
In [49]:
k = axes[0]
In [33]:
In [33]:
In [7]:
%pylab inline
In [ ]: