File: plugin-calculator.page

package info (click to toggle)
kupfer 328-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,324 kB
  • sloc: python: 37,434; makefile: 88; sh: 78; xml: 3
file content (67 lines) | stat: -rw-r--r-- 1,889 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      id="plugin-calculator">

  <info>
   <link type="guide" xref="index#plugins"/>
   <desc>Using the calculator plugin.</desc>
  </info>

  <title><app>Calculator</app></title>

 <section>
  <title>Calculator Plugin</title>
  <p>
    The calculator plugin lets you calculate expressions quickly. It can evaluate 
    expressions entered as text starting with "=". Entering = from command mode will 
    start text mode directly with = prefixed for quick access.
  </p>
  </section>
  <section>
  <title>Basic Usage</title>
  <steps>
    <item><p>
        Activate Kupfer and type <key>=</key>
    </p></item>
    <item><p>Type in a mathematical expression using
        <key>+</key>,<key>-</key>,<key>/</key>,<key>*</key> (and
        <key>**</key> for exponentiation)
    </p></item>
    <item><p>
        Press <key>Return</key> to get the result.
    </p></item>
  </steps>

 </section>
  <section>
    <title>Notes</title>
    <p>
      The Calculator uses python's math and complex math modules, 
      and parses expressions as Python expressions. You may use common 
      mathematical functions, such as <cmd>sqrt</cmd>, <cmd>sin</cmd>,
      <cmd>exp</cmd> and <cmd>log</cmd>; the command <cmd>=help</cmd> will
      show a list of all defined functions and constants. 
    </p>
    <list>
     <item>
      <p>
       Notice that the power operator in Python is double stars, for example 
       <code>=3**3</code> will evaluate to 27.
      </p>
     </item>
     <item>
      <p>
       To calculate trig functions for angles, convert to radians first: 
      </p>
      <code>sin(radians(30)) -> 0.5</code>
     </item>
     <item>
      <p>
       The last result is stored as the name _ (an underscore, just like in 
       the Python console).
      </p>
     </item>
     </list>
   </section>
  
</page>