The printf(...) function in Maple is identical to that of the corresponding function in C and C++, but there are a few more additional formats that are specific to Maple, the most useful are the four shown here:
The format %a will convert any Maple expression to valid 1-D Maple input (what we use in this tutorial).
[> printf( "expr := %a;\n", 1/(1 + 1/c) );
expr := 1/(1+1/c);
[> printf( "u1 := %a;\n", <1.1, 2.2, 3.3> );
u1 := Vector(3, [1.1,2.2,3.3]);
The format %La (%a with the L modifier) will convert all remaining arguments into an expression sequence of valid 1-D Maple inputs. There is one problem, however, the output will not always be valid Maple 1-D input, for if there are no arguments, it will have a blank instead of NULL.
[> printf( "%a := %La;\n", some_name, 1, 2, 1/3 );
some_name := 1, 2, 1/3;
This final one is really useful only on its own: it will create output that pretty-prints the Maple expression, or an expression sequence of Maple expressions pretty printed:
[> printf( "%P\n", sum( sin( 1/(1 + 1/k) ), k = 0..N ) );
N ----- \ 1 ) sin(-------) / 1 + 1/k ----- k = 0
[> printf( "%LP\n", a, 1/(1 + a), 1/(1 + 1/(1 + a)), 1/(1 + 1/(1 + 1/(1 + a))) );
1 1 1 a, -----, ---------, ------------- 1 + a 1 1 1 + ----- 1 + --------- 1 + a 1 1 + ----- 1 + a