qx_icon_32x32 QxCalculator for Windows™

qxcalc.exe on the command line

Command line arguments

qxcalc.exe is the backend of QxCalculator, qxcg.exe. You can use the qxcalc.exe without the user interface(qxcg.exe), but not the other way around.

Below is the help text, 'qxcalc.exe -h', of qxcalc.exe:
*************************************
qxcalc - A scriptable calculator
Version 59

http://qxcalc.sourceforge.net/
*************************************

	-h            help
	-v            version
	-d            debug information
	-p  run script
	-cd           create latex document
	-ch           create html document
	-ca           create ascii text document
	-cx           create xml document
	-nh           do not create document header nor footer
	-w            reserved words
	-c            physical constants

How to create a script?

A script is a text file, and can be created with any text editor, for example notepad, vim, emacs, nano. Specific to the vim editor there is a syntax highlight file calc.vim, which makes it my favourite.

When you write the script, you typically create variables, and perform calculations with these variables. Typically, you save the script to file, with extension '.calc', and run it with the qxcalc.exe command.

An example:

We have the electrical circuit below, and we need to determine the energy dissipated in the resistors given current and resistance.


 
We create variables i(current 10 A), and rp(one resistor 5 ohms). We calculate resistance (rres) of two parallell resistors(of 5 ohms each)), and voltage from current(10A) over the resistors.

We calculate the power twice with the help of two different approaches:
  • power knowing current and parallell resistance
  • and power2 knowing voltage and parallell resistance

We save the script to file, in this example we name the file cli-e2.calc. We want results as both HTML and latex.

to create LaTeX, use -cd
to create HTML, use -ch

Running the sample script

Let's run the above script with the following line(you need to do this in a console):

qxcalc.exe -p cli-e2.calc -cd -ch

Results of the above example are:



The variables power, and power2, yield that the power is 250 Watts, power and power2 are the same, which they also should be.

Generated files

We chose the script name to cli-e2.calc, the generated files are so:
  • cli-e2.calc.html
  • cli-e2.calc.tex
  • cli-e2.calc.pdf (generated with, e.g. pdflatex, from cli-e2.calc.tex)
cli-e2.calc.html | cli-e2.calc.tex | pdf file(generated from *.tex file)

QxCalc! and file names

File name extensions and files generated by qxcalc.exe.
  • When creating an html fragment of a script(as well as page), the file generated is <scriptname>.calc.html
  • When creating a latex fragment of a script(as well as document), the file generated is <scriptname>.calc.tex
  • latex files (*.calc.tex) need to be converted to pdf by e.g. pdflatex for better viewing.
  • xml files(*.calc.xml)
  • ascii files(*.calc.ascii)

Last modified: January 16 2022 04:25:21.