/Calcpad

Free and open source software for mathematical and engineering calculations.

Primary LanguageC#MIT LicenseMIT

Calcpad Readme

Project Website: https://calcpad.eu

Calcpad is free software for mathematical and engineering calculations. It represents a flexible and modern programmable calculator with Html report generator. It is simple and easy to use, but it also includes many advanced features:

  • real and complex numbers;
  • units of measurement (SI, Imperial and USCS);
  • custom variables and units;
  • built-in library with common math functions;
  • custom functions of multiple parameters f(x; y; z; ...);
  • powerful numerical methods for root and extremum finding, numerical integration and differentiation;
  • finite sum, product and iteration procedures;
  • modules, macros and string variables;
  • program flow control with conditions and loops;
  • "titles" and 'text' comments in quotes;
  • support for Html and CSS in comments for rich formatting;
  • function plotting, images, tables, parametric SVG drawings, etc.;
  • automatic generation of Html forms for data input;
  • professional looking Html reports for viewing and printing;
  • export to Word documents (*.docx) and PDF;
  • variable substitution and smart rounding of numbers;
  • output visibility control and content folding;
  • support for plain text (*.txt, *.cpd) and binary (*.cpdz) file formats.

This software is developed using the C# programming language and the latest computer technologies. It automatically parses the input, substitutes the variables, calculates the expressions and displays the output. All results are sent to a professional looking Html report for viewing and printing.

Sample

Fields of application

This software is suitable for engineers and other professionals that need to perform repetitive calculations and present them in official documentation such as calculation notes. They can automate this task efficiently by creating powerful and reliable Calcpad worksheets. It can also help teachers to prepare calculation examples, papers, manuals, books etc. Students can use it to solve various problems, prepare homeworks, phd theses etc.

Installation

The installation is performed by the automated setup program calcpad-setup-en-x64.exe. Follow the instruction of the setup wizard. The software requires a 64 bit computer with Windows 10 and Microsoft .NET 7.0.
You can also use Calcpad directly in the browser from our website: https://calcpad.eu/Ide

Licensing and terms of use

This software is free for both commercial and non-commercial use. It is distributed under the MIT license:

Copyright © 2021 PROEKTSOFT EOOD®

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Any scripts, developed with Calcpad are property of the respective authors. They can be used without additional limitations except those appointed by the authors themselves.

Acknowledgments

This project uses some additional third party components, software and design. They are re-distributed free of charge, under the license conditions, provided by the respective authors.

  1. The new and beautiful icons are created using icons8.com.
  2. The pdf export was made possible thanks to the wkhtmltopdf.org project.
  3. Some symbols are displayed, using the Jost* font family by indestructible type*, under the SIL open font license. Square brackets are slightly modified to suit the application needs.

How it works

The software is quick and easy to use. Just follow these simple steps:

  1. Enter text and formulas into the "Code" box on the left.
  2. Press F5 or click Play to calculate. Results will appear in the "Output" box on the right as a professionally formatted Html report.
  3. Click PrintPreview to print or Copy to copy the output.
    You can also export it to Html Html, PDF PDF or MS Word Word document.

The language

Calcpad uses a simple programming language that includes the following elements:

  • Real numbers: digits 0 - 9 and decimal point ".";
  • Complex numbers: re ± imi (e.g. 3 - 2i);
  • Variables:
      - Latin letters: a - z, A - Z;
      - Greek letters: α - ω, Α - Ω;
      - digits: 0 - 9;
      - comma: " , ";
      - prime symbols: ′ , ″ , ‴ , ⁗ ;
      - superscripts: ⁰ , ¹ , ² , ³ , ⁴ , ⁵ , ⁶ , ⁷ , ⁸ , ⁹ , ⁿ , ⁺ , ⁻ ;
      - special symbols: ‾ , ø , Ø , ° , ∡ ;
      - " _ " for subscript;
    A variable name must start with a letter. Names are case sensitive.
  • Operators:
      "!" - factorial;
      "^" - exponent;
      "/" - division;
      "÷" - force division bar;
      "\" - integer division;
      "" - modulo (reminder);
      "*" - multiplication;
      "-" - minus;
      "+" - plus;
      "" - equal to;
      "" - not equal to;
      "<" - less than;
      ">" - greater than;
      "" - less or equal;
      "" - greater or equal;
      "" - logical "and";
      "" - logical "or";
      "" - logical "xor";
      "=" - assignment;
  • Custom functions of type f (x; y; z; ... );
  • Built-in functions:
      Trigonometric:
        sin(x) - sine;
        cos(x) - cosine;
        tan(x) - tangent;
        csc(x) - cosecant;
        sec(x) - secant;
        cot(x) - cotangent;
      Hyperbolic:
        sinh(x) - hyperbolic sine;
        cosh(x) - hyperbolic cosine;
        tanh(x) - hyperbolic tangent;
        csch(x) - hyperbolic cosecant;
        sech(x) - hyperbolic secant;
        coth(x) - hyperbolic cotangent;
      Inverse trigonometric:
        asin(x) - inverse sine;
        acos(x) - inverse cosine;
        atan(x) - inverse tangent;
        atan2(x; y) - the angle whose tangent is the quotient of y and x;
        acsc(x) - inverse cosecant;
        asec(x) - inverse secant;
        acot(x) - inverse cotangent;
      Inverse hyperbolic:
        asinh(x) - inverse hyperbolic sine;
        acosh(x) - inverse hyperbolic cosine;
        atanh(x) - inverse hyperbolic tangent;
        acsch(x) - inverse hyperbolic cosecant;
        asech(x) - inverse hyperbolic secant;
        acoth(x) - inverse hyperbolic cotangent;
      Logarithmic, exponential and roots:
        log(x) - decimal logarithm;
        ln(x) - natural logarithm;
        log_2(x) - binary logarithm;
        exp(x) - natural exponent;
        sqr(x) / sqrt(x) - square root;
        cbrt(x) - cubic root;
        root(x; n) - n-th root;
      Rounding:
        round(x) - round to the nearest integer;
        floor(x) - round to the smaller integer (towards -∞);
        ceiling(x) - round to the greater integer (towards +∞);
        trunc(x) - round to the smaller integer (towards zero);
      Integer:
        mod(x; y) - the reminder of an integer division;
        gcd(x; y) - the greatest common divisor of two integers;
        lcm(x; y) - the least common multiple of two integers;
      Complex:
        abs(x) - absolute value/magnitude;
        re(x) - the real part of a complex number;
        im(x) - the imaginary part of a complex number;
        phase(x) - the phase of a complex number;
      Aggregate and interpolation:
        min(x; y; z...) - minimum of multiple values;
        max(x; y; z...) - maximum of multiple values;
        sum(x; y; z...) - sum of multiple values = x + y + z...;
        sumsq(x; y; z...) - sum of squares = x² + y² + z²...;
        srss(x; y; z...) - square root of sum of squares = sqrt(x² + y² + z²...);
        average(x; y; z...) - average of multiple values = (x + y + z...)/n;
        product(x; y; z...) - product of multiple values = x·y·z...;
        mean(x; y; z...) - geometric mean = n-th root(x·y·z...);
        take(n; a; b; c...) - returns the n-th element from the list;
        line(x; a; b; c...) - linear interpolation;
        spline(x; a; b; c...) - Hermite spline interpolation;
      Conditional and logical:
        if(cond; value-if-true; value-if-false) - conditional evaluation;
        switch(cond1; value1; cond2; value2; … ; default) - selective evaluation;
        not(x) - logical "not";
        and(x; y; z...) - logical "and";
        or(x; y; z...) - logical "or";
        xor(x; y; z...) - logical "xor";
      Other:
        sign(x) - the sign of a number;
        random(x) - random number between 0 and x;
  • Comments: "Title" or 'text' in double or single quotes, respectively. HTML, CSS, JS and SVG are allowed.
  • Graphing and plotting:
      $Plot { f(x) @ x = a : b } - simple plot;
      $Plot { x(t) | y(t) @ t = a : b } - parametric;
      $Plot { f1(x) & f2(x) & ... @ x = a : b } - multiple;
      $Plot { x1(t) | y1(t) & x2(t) | y2(t) & ... @ x = a : b } - multiple parametric;
      $Map { f(x; y) @ x = a : b & y = c : d } - 2D color map of a 3D surface;
      PlotHeight - height of plot area in pixels;
      PlotWidth - width of plot area in pixels;
  • Iterative and numerical methods:
      $Root { f(x) = const @ x = a : b } - root finding for f(x) = const;
      $Root { f(x) @ x = a : b } - root finding for f(x) = 0;
      $Find { f(x) @ x = a : b } - similar to above, but x is not required to be a precise solution;
      $Sup { f(x) @ x = a : b } - local maximum of a function;
      $Inf { f(x) @ x = a : b } - local minimum of a function;
      $Area { f(x) @ x = a : b } - adaptive Gauss-Lobatto numerical integration;
      $Integral { f(x) @ x = a : b } - Tanh-Sinh numerical integration;
      $Slope { f(x) @ x = a } - numerical differentiation;
      $Sum { f(k) @ k = a : b } - iterative sum;
      $Product { f(k) @ k = a : b } - iterative product;
      $Repeat { f(k) @ k = a : b } - general inline iterative procedure;
      Precision - relative precision for numerical methods [10-2; 10-16] (default is 10-12)
  • Program flow control:
      Simple:
        #if condition
          Your code goes here
        #end if
      Alternative:
        #if condition
          Your code goes here
        #else
          Some other code
        #end if
      Complete:
        #if condition1
          Your code goes here
        #else if condition2
          Your code goes here
        #else
          Some other code
        #end if
    You can add or omit as many "#else if's" as needed. Only one "#else" is allowed. You can omit this too.
  • Iteration blocks:
      Simple:
        #repeat number of repetitions
          Your code goes here
        #loop
      With conditional break/coutinue:
        #repeat number of repetitions
          Your code goes here
          #if condition
            #break or #continue
          #end if
          Some more code
        #loop
  • Modules and macros/string variables:
      Modules:
        #include filename - include external file (module);
        #local - start local section (not to be included);
        #global - start global section (to be included);
      Inline string variable:
        #def variable_name$ = content
      Multiline string variable:
        #def variable_name$
          content line 1
          content line 2
          ...
        #end def
      Inline string macro:
        #def macro_name$(param1$; param2$;...) = content
      Multiline string macro:
        #def macro_name$(param1$; param2$;...)
          content line 1
          content line 2
          ...
        #end def
  • Output control:
      #hide - hide the report contents;
      #show - always show the contents (default);
      #pre - show the next contents only before calculations;
      #post - show the next contents only after calculations;
      #val - show only the final result, without the equation;
      #equ - show complete equations and results (default);
      #noc - show only equations without results (no calculations);
      #round n - rounds to n digits after the decimal point.
      Each of the above commands is effective after the current line until the end of the report or another command that overwrites it.
  • Breakpoints for step-by-step execution:
      #pause - calculates to the current line and waits until resumed manually;
      #input - renders an input form to the current line and waits for user input.
  • Switches for trigonometric units: #deg - degrees, #rad - radians, #gra - gradians;
  • Separator for target units: |, for example: 3ft + 12in|cm will show 121.92 cm;
  • Dimensionless: %, ‰;
  • Angle units: °, ′, ″, deg, rad, grad, rev;
  • Metric units (SI and compatible):
      Mass: g, hg, kg, t, kt, Mt, Gt, dg, cg, mg, μg, Da, u;
      Length: m, km, dm, cm, mm, μm, nm, pm, AU, ly;
      Time: s, ms, μs, ns, ps, min, h, d;
      Frequency: Hz, kHz, MHz, GHz, THz, mHz, μHz, nHz, pHz, rpm;
      Speed: kmh;
      Electric current: A, kA, MA, GA, TA, mA, μA, nA, pA;
      Temperature: °C, Δ°C, K;
      Amount of substance: mol;
      Luminous intensity: cd;
      Area: a, daa, ha;
      Volume: L, daL, hL, dL, cL, mL, μL, nL, pL;
      Force: dyn N, daN, hN, kN, MN, GN, TN, gf, kgf, tf;
      Moment: Nm, kNm;
      Pressure: Pa, daPa, hPa, kPa, MPa, GPa, TPa, dPa, cPa, mPa, μPa, nPa, pPa,
           bar, mbar, μbar, atm, at, Torr, mmHg;
      Viscosity: P, cP, St, cSt;
      Energy work: J, kJ, MJ, GJ, TJ, mJ, μJ, nJ, pJ, Wh, kWh, MWh, GWh, TWh,
            cal, kcal, erg, eV, keV, MeV, GeV, TeV, PeV, EeV;
      Power: W, kW, MW, GW, TW, mW, μW, nW, pW, hpM, ks;
          VA, kVA, MVA, GVA, TVA, mVA, μVA, nVA, pVA,
          VAR, kVAR, MVAR, GVAR, TVAR, mVAR, μVAR, nVAR, pVAR, hpM, ks;
      Electric charge: C, kC, MC, GC, TC, mC, μC, nC, pC, Ah, mAh;
      Potential: V, kV, MV, GV, TV, mV, μV, nV, pV;
      Capacitance: F, kF, MF, GF, TF, mF, μF, nF, pF;
      Resistance: Ω, kΩ, MΩ, GΩ, TΩ, mΩ, μΩ, nΩ, pΩ;
      Conductance: S, kS, MS, GS, TS, mS, μS, nS, pS, ℧, k℧, M℧, G℧, T℧, m℧, μ℧, n℧, p℧;
      Magnetic flux: Wb , kWb, MWb, GWb, TWb, mWb, μWb, nWb, pWb;
      Magnetic flux density: T, kT, MT, GT, TT, mT, μT, nT, pT;
      Inductance: H, kH, MH, GH, TH, mH, μH, nH, pH;
      Luminous flux: lm;
      Illuminance: lx;
      Radioactivity: Bq, kBq, MBq, GBq, TBq, mBq, μBq, nBq, pBq, Ci, Rd;
      Absorbed dose: Gy, kGy, MGy, GGy, TGy, mGy, μGy, nGy, pGy;
      Equivalent dose: Sv, kSv, MSv, GSv, TSv, mSv, μSv, nSv, pSv;
      Catalytic activity: kat;
  • Non-metric units (Imperial/US):
      Mass: gr, dr, oz, lb (or lbm, lb_m), klb, kipm (or kip_m), st, qr,
          cwt (or cwt_UK, cwt_US), ton (or ton_UK, ton_US), slug;
      Length: th, in, ft, yd, ch, fur, mi, ftm (or ftm_UK, ftm_US),
           cable (or cable_UK, cable_US), nmi, li, rod, pole, perch, lea;
      Speed: mph, knot;
      Temperature: °F, Δ°F, °R;
      Area: rood, ac;
      Volume, fluid: fl_oz, gi, pt, qt, gal, bbl, or:
          fl_oz_UK, gi_UK, pt_UK, qt_UK, gal_UK, bbl_UK,
          fl_oz_US, gi_US, pt_US, qt_US, gal_US, bbl_US,
      Volume, dry: (US) pt_dry, (US) qt_dry, (US) gal_dry, (US) bbl_dry,
          pk (or pk_UK, pk_US), bu (or bu_UK, bu_US);
      Force: ozf (or oz_f), lbf (or lb_f), kip (or kipf, kip_f), tonf (or ton_f), pdl;
      Pressure: osi, osf psi, psf, ksi, ksf, tsi, tsf, inHg;
      Energy/work: BTU, therm, (or therm_UK, therm_US), quad;
      Power: hp, hpE, hpS;
  • Custom units - .Name = expression.
    Names can include currency symbols: €, £, ₤, ¥, ¢, ₽, ₹, ₩, ₪.