#NEWLINE# def plot_and_save( name ) : #NEWLINE# #INDENT# tmp_file = TmpFileManager . tmp_file #NEWLINE# x = Symbol ( 'x' ) #NEWLINE# y = Symbol ( 'y' ) #NEWLINE# z = Symbol ( 'z' ) #NEWLINE# p = plot ( x ) #NEWLINE# p = plot ( ( x * sin ( x ) ) , ( x * cos ( x ) ) ) #NEWLINE# p . extend ( p ) #NEWLINE# p [ 0 ] . line_color = ( lambda a : a ) #NEWLINE# p [ 1 ] . line_color = 'b' #NEWLINE# p . title = 'Big title' #NEWLINE# p . xlabel = 'the x axis' #NEWLINE# p [ 1 ] . label = 'straight line' #NEWLINE# p . legend = True #NEWLINE# p . aspect_ratio = ( 1 , 1 ) #NEWLINE# p . xlim = ( ( - 15 ) , 20 ) #NEWLINE# p . save ( tmp_file ( ( '%s_basic_options_and_colors' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p . extend ( plot ( ( x + 1 ) ) ) #NEWLINE# p . append ( plot ( ( x + 3 ) , ( x ** 2 ) ) [ 1 ] ) #NEWLINE# p . save ( tmp_file ( ( '%s_plot_extend_append' % name ) ) ) #NEWLINE# p [ 2 ] = plot ( ( x ** 2 ) , ( x , ( - 2 ) , 3 ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_plot_setitem' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot ( sin ( x ) , ( x , ( ( - 2 ) * pi ) , ( 4 * pi ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_line_explicit' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot ( sin ( x ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_line_default_range' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot ( ( ( x ** 2 ) , ( x , ( - 5 ) , 5 ) ) , ( ( x ** 3 ) , ( x , ( - 3 ) , 3 ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_line_multiple_range' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# raises ( ValueError , ( lambda : plot ( x , y ) ) ) #NEWLINE# p = plot ( Piecewise ( ( 1 , ( x > 0 ) ) , ( 0 , True ) ) , ( x , ( - 1 ) , 1 ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_plot_piecewise' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# plot_parametric ( sin ( x ) , cos ( x ) ) . save ( tmp_file ( ) ) #NEWLINE# p = plot_parametric ( sin ( x ) , cos ( x ) , ( x , ( - 5 ) , 5 ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_parametric_range' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot_parametric ( ( sin ( x ) , cos ( x ) ) , ( x , sin ( x ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_parametric_multiple' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot_parametric ( ( sin ( x ) , cos ( x ) , ( x , ( - 3 ) , 3 ) ) , ( x , sin ( x ) , ( x , ( - 5 ) , 5 ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_parametric_multiple_ranges' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot_parametric ( x , sin ( x ) , depth = 13 ) #NEWLINE# p . save ( tmp_file ( ( '%s_recursion_depth' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot_parametric ( cos ( x ) , sin ( x ) , adaptive = False , nb_of_points = 500 ) #NEWLINE# p . save ( tmp_file ( ( '%s_adaptive' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_line ( sin ( x ) , cos ( x ) , x ) #NEWLINE# p . save ( tmp_file ( ( '%s_3d_line' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_line ( ( sin ( x ) , cos ( x ) , x , ( x , ( - 5 ) , 5 ) ) , ( cos ( x ) , sin ( x ) , x , ( x , ( - 3 ) , 3 ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_3d_line_multiple' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_line ( sin ( x ) , cos ( x ) , x , nb_of_points = 30 ) #NEWLINE# p . save ( tmp_file ( ( '%s_3d_line_points' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d ( ( x * y ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_surface' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d ( ( ( - x ) * y ) , ( x * y ) , ( x , ( - 5 ) , 5 ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_surface_multiple' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d ( ( ( x * y ) , ( x , ( - 3 ) , 3 ) , ( y , ( - 3 ) , 3 ) ) , ( ( ( - x ) * y ) , ( x , ( - 3 ) , 3 ) , ( y , ( - 3 ) , 3 ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_surface_multiple_ranges' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_surface ( sin ( ( x + y ) ) , cos ( ( x - y ) ) , ( x - y ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_parametric_surface' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_surface ( ( ( x * sin ( z ) ) , ( x * cos ( z ) ) , z , ( x , ( - 5 ) , 5 ) , ( z , ( - 5 ) , 5 ) ) , ( sin ( ( x + y ) ) , cos ( ( x - y ) ) , ( x - y ) , ( x , ( - 5 ) , 5 ) , ( y , ( - 5 ) , 5 ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_parametric_surface' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot ( sin ( x ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a : a ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_line_arity1' % name ) ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a , b : b ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_line_arity2' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot ( ( x * sin ( x ) ) , ( x * cos ( x ) ) , ( x , 0 , 10 ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a : a ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_param_line_arity1' % name ) ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a , b : a ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_param_line_arity2a' % name ) ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a , b : b ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_param_line_arity2b' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_line ( ( sin ( x ) + ( ( 0.1 * sin ( x ) ) * cos ( ( 7 * x ) ) ) ) , ( cos ( x ) + ( ( 0.1 * cos ( x ) ) * cos ( ( 7 * x ) ) ) ) , ( 0.1 * sin ( ( 7 * x ) ) ) , ( x , 0 , ( 2 * pi ) ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a : sin ( ( 4 * a ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_3d_line_arity1' % name ) ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a , b : b ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_3d_line_arity2' % name ) ) ) #NEWLINE# p [ 0 ] . line_color = ( lambda a , b , c : c ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_3d_line_arity3' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d ( ( sin ( x ) * y ) , ( x , 0 , ( 6 * pi ) ) , ( y , ( - 5 ) , 5 ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a : a ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_surface_arity1' % name ) ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a , b : b ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_surface_arity2' % name ) ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a , b , c : c ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_surface_arity3a' % name ) ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a , b , c : sqrt ( ( ( ( a - ( 3 * pi ) ) ** 2 ) + ( b ** 2 ) ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_surface_arity3b' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot3d_parametric_surface ( ( x * cos ( ( 4 * y ) ) ) , ( x * sin ( ( 4 * y ) ) ) , y , ( x , ( - 1 ) , 1 ) , ( y , ( - 1 ) , 1 ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a : a ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_param_surf_arity1' % name ) ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a , b : ( a * b ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_param_surf_arity2' % name ) ) ) #NEWLINE# p [ 0 ] . surface_color = ( lambda a , b , c : sqrt ( ( ( ( a ** 2 ) + ( b ** 2 ) ) + ( c ** 2 ) ) ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_colors_param_surf_arity3' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# with warnings . catch_warnings ( record = True ) as w : #NEWLINE# #INDENT# i = Integral ( log ( ( ( ( sin ( x ) ** 2 ) + 1 ) * sqrt ( ( ( x ** 2 ) + 1 ) ) ) ) , ( x , 0 , y ) ) #NEWLINE# p = plot ( i , ( y , 1 , 5 ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_advanced_integral' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# assert ( len ( w ) == 1 ) #NEWLINE# assert issubclass ( w [ ( - 1 ) ] . category , UserWarning ) #NEWLINE# assert ( 'The evaluation of the expression is problematic' in str ( w [ 0 ] . message ) ) #NEWLINE# #UNINDENT# s = Sum ( ( 1 / ( x ** y ) ) , ( x , 1 , oo ) ) #NEWLINE# p = plot ( s , ( y , 2 , 10 ) ) #NEWLINE# p . save ( tmp_file ( ( '%s_advanced_inf_sum' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# p = plot ( Sum ( ( 1 / x ) , ( x , 1 , y ) ) , ( y , 2 , 10 ) , show = False ) #NEWLINE# p [ 0 ] . only_integers = True #NEWLINE# p [ 0 ] . steps = True #NEWLINE# p . save ( tmp_file ( ( '%s_advanced_fin_sum' % name ) ) ) #NEWLINE# p . _backend . close ( ) #NEWLINE# plot ( ( sin ( x ) + ( I * cos ( x ) ) ) ) . save ( tmp_file ( ) ) #NEWLINE# plot ( sqrt ( sqrt ( ( - x ) ) ) ) . save ( tmp_file ( ) ) #NEWLINE# plot ( LambertW ( x ) ) . save ( tmp_file ( ) ) #NEWLINE# plot ( sqrt ( LambertW ( x ) ) ) . save ( tmp_file ( ) ) #NEWLINE# plot ( ( ( meijerg ( ( ( ( 1 / 2 ) , ) , ( ) ) , ( ( 5 , 0 , ( 1 / 2 ) ) , ( ) ) , ( ( ( 5 * ( x ** 2 ) ) * exp_polar ( ( ( - I ) * pi ) ) ) / 2 ) ) + meijerg ( ( ( ( 1 / 2 ) , ) , ( ) ) , ( ( 5 , 0 , ( 1 / 2 ) ) , ( ) ) , ( ( ( 5 * ( x ** 2 ) ) * exp_polar ( ( I * pi ) ) ) / 2 ) ) ) / ( 48 * pi ) ) , ( x , 1e-06 , 0.01 ) ) . save ( tmp_file ( ) )