Difference between revisions of "ApCoCoA-1:Dec"
From ApCoCoAWiki
(New page: <command> {{PAGENAME}} </command>) |
m (replaced <quotes> tag by real quotes) |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Version|1}} | ||
<command> | <command> | ||
+ | <title>Dec</title> | ||
+ | <short_description>Pretty Printing of Objects.</short_description> | ||
+ | <syntax> | ||
+ | Dec(X:Object, Digits:INT):Object | ||
+ | </syntax> | ||
− | [[Category:ApCoCoA Manual|{{PAGENAME}}]] | + | <description> |
+ | This function prints (rational) numbers within the object <tt>X</tt> as a floating point number up to <tt>Digits</tt> Digits. The floating point numbers are represented as strings. | ||
+ | |||
+ | <itemize> | ||
+ | <item>@param <em>X</em> The object whose numbers should be printed as floating points. <tt>X</tt> can be <tt>MAT</tt>, <tt>LIST</tt>, <tt>POLY</tt>, <tt>INT</tt>, <tt>RAT</tt> or iteration thereof.</item> | ||
+ | <item>@param <em>Digits</em> Gives the exactness of printing.</item> | ||
+ | <item>@return The given object with floating point numbers represented as strings instead of (rational) numbers.</item> | ||
+ | </itemize> | ||
+ | |||
+ | <example> | ||
+ | Use P::=Q[x,y,z]; | ||
+ | |||
+ | Dec(1,4); | ||
+ | 1 | ||
+ | ------------------------------- | ||
+ | Dec(1/2,4); | ||
+ | 0.5 | ||
+ | ------------------------------- | ||
+ | A:=Mat([[17/13, 6/11], [5/3, 1/9]]); | ||
+ | Dec(A,4); | ||
+ | Mat([ | ||
+ | ["1.3076", "0.5454"], | ||
+ | ["1.6666", "0.1111"] | ||
+ | ]) | ||
+ | ------------------------------- | ||
+ | </example> | ||
+ | |||
+ | </description> | ||
+ | |||
+ | <types> | ||
+ | <type>matrix</type> | ||
+ | <type>list</type> | ||
+ | <type>polynomial</type> | ||
+ | <type>integer</type> | ||
+ | <type>rat</type> | ||
+ | </types> | ||
+ | |||
+ | <seealso> | ||
+ | <see>ApCoCoA-1:Print|Print</see> | ||
+ | <see>ApCoCoA-1:Print On|Print On</see> | ||
+ | <see>ApCoCoA-1:PrintLn|PrintLn</see> | ||
+ | </seealso> | ||
+ | |||
+ | <key>Dec</key> | ||
+ | <key>Print</key> | ||
+ | <key>printing</key> | ||
+ | <key>float</key> | ||
+ | |||
+ | [[Category:ApCoCoA-1 Manual|{{PAGENAME}}]] | ||
</command> | </command> |
Latest revision as of 13:31, 29 October 2020
This article is about a function from ApCoCoA-1. |
Dec
Pretty Printing of Objects.
Syntax
Dec(X:Object, Digits:INT):Object
Description
This function prints (rational) numbers within the object X as a floating point number up to Digits Digits. The floating point numbers are represented as strings.
@param X The object whose numbers should be printed as floating points. X can be MAT, LIST, POLY, INT, RAT or iteration thereof.
@param Digits Gives the exactness of printing.
@return The given object with floating point numbers represented as strings instead of (rational) numbers.
Example
Use P::=Q[x,y,z]; Dec(1,4); 1 ------------------------------- Dec(1/2,4); 0.5 ------------------------------- A:=Mat([[17/13, 6/11], [5/3, 1/9]]); Dec(A,4); Mat([ ["1.3076", "0.5454"], ["1.6666", "0.1111"] ]) -------------------------------
See also