{{{id=26| # Copyright 2009, P. Lutus # Released under the GPL (http://www.gnu.org/copyleft/gpl.html) /// }}} {{{id=0| #auto # reset() # commented out for now -- ticket 7255 # special equation rendering def render(x,name = "temp.png",size = "normal"): if(type(x) != type("")): x = latex(x) latex.eval("\\" + size + " $" + x + "$",{},"",name) var('a d v R r y L') forget() assume(R >= 0) assume(r >= 0) assume(L >= 0) assume(y >= 0) /// }}} {{{id=50| var('a d v R r y L') /// (a, d, v, R, r, y, L) }}} {{{id=23| #auto acaps(y,R) = pi*(2*R-y)*y render(a == acaps(y,R),"equ_area_caps.png","large") /// }}} {{{id=3| #auto vcaps(y,r,R) = integrate(acaps(y,R)*r/R,y) render(v == vcaps(y,r,R),"equ_vol_caps.png","large") /// }}} {{{id=35| plot(vcaps(y,10,10),(y,0,20),figsize=(4,3)) /// }}} {{{id=36| render(latex("$v\_{sphere} = \\frac {4}{3}\pi r^3 $"),"equ_sphere_volume.png","large") /// }}} {{{id=37| vcaps(20,10,10) /// 4000/3*pi }}} {{{id=24| #auto dcyl(y,R) = 2*sqrt((2*R-y)*y) render(d == dcyl(y,R),"equ_dia_cyl.png","large") /// }}} {{{id=28| plot(dcyl(y,10),(y,0,20),figsize=(4,2.5)) /// }}} {{{id=29| #auto vcyl(y,R,L) = ((integrate(dcyl(y,R),y)) * L).full_simplify() render(v == vcyl(y,R,L),"equ_vol_cylinder1.png","large") /// }}} {{{id=30| plot(vcyl(y,10,1),(y,0,20),figsize=(4,3)) /// }}} {{{id=32| render(latex("$\int cos(x) dx = sin(x) + C $"),"equ_integration_constant.png","large") /// }}} {{{id=33| render(latex("$v\_{cyl} = \pi R^2 L $"),"equ_cylinder_volume.png","large") /// }}} {{{id=7| %auto vcyl(y,R,L) = ((integrate(dcyl(y,R),y) + pi*R^2) * L).full_simplify() render(v == vcyl(y,R,L),"equ_vol_cylinder2.png","large") /// }}} {{{id=34| vcyl(20,10,10) /// 1000*pi }}} {{{id=31| plot(vcyl(y,10,1),(y,0,20),figsize=(4,3)) /// }}} {{{id=25| %auto vfull(y,r,R,L) = (vcaps(y,r,R,L) + vcyl(y,R,L)).full_simplify() render(v == vfull(y,r,R,L),"equ_vol_full.png","large") /// }}} {{{id=40| render(latex(v == pi * R^2 * L + 4/3 * pi * R^3 * r/R)) /// }}} {{{id=41| N(pi * 31 * 13^2 + 4/3 * pi * 13^2 * 7) /// 21414.1427244192 }}} {{{id=43| N(vfull(26,7,13,31)) /// 21414.1427244192 }}} {{{id=17| plot(vfull(y,5,10,10),y,0,20,figsize=(4,3)) /// }}} {{{id=47| /// }}} {{{id=48| render(latex("$\\frac {y} {(3x)} $"),"equ_simplify_target.png","Large") /// }}} {{{id=49| render(latex("$\\frac {y} {3x} $"),"equ_simplify_mathematica.png","Large") /// }}} {{{id=45| render((y/(3*x)).full_simplify(),"equ_simplify_fail.png","Large") /// }}} {{{id=46| /// }}}