The present invention relates to tools for both: (1), converting dimensional quantities from one set of units to another quickly and efficiently; and (2), correctly and automatically performing mathematical computations using dimensional and dimensionless quantities, variables, and functions. More particularly, it relates to improved, computer-based systems, methods and software for: (1), performing mathematical calculations with both dimensional and dimensionless quantities; (2), allowing extensive flexibility and customization so that both the user input and the computer output use the units that are most useful and convenient for the user with all other required unit conversions performed correctly by the computer; and (3), providing meaningful error messages and feedback to the user so that he or she can edit, correct, alter, and improve a set of calculations with as little chance of human error as possible. The current embodiments accomplish these goals with as much simplicity as possible so that use of the tool is as quick, easy, and error free as possible.
In numerous human endeavors and quantitative fields, mathematical calculations are performed on both dimensional and dimensionless values. These necessary and fundamental calculations include converting values from one kind of units to another. For example, as the global economy expands, there is an urgent need to be able to convert from the United States Customary System of Units (inches, feet, pounds, etc.; also known as English units) to equivalent metric units such as meters, kilograms and Newtons. It also includes a vast number of calculations using dimensional values in order to calculate area, volume, mass, weight, and the like. Such computations are required for purposes ranging from shipping and transport to sophisticated engineering calculations needed for the design, construction, as well as testing of complex machines such as airplanes and advanced medical devices.
In all of these situations, there is a pressing need to perform the calculations quickly, efficiently, and accurately. The cost of inaccurate calculations can be considerable. For example, in 1999, NASA's Mars Climate Orbiter, part of a 125 million dollar planetary exploration program, crashed into the planet Mars. In the subsequent investigation, it was determined that the primary cause of the crash was incorrectly converting the engine's impulse from English to metric units.
For units conversion, there are reference texts, online unit converters, and stand-alone computer programs that users can purchase and use. Use of these tools is time consuming and error-prone. For dimensional calculations, there are expensive computer software programs that will perform specific computations within their software. This software and its proprietary data formats are not readily accessible to the public and do not allow collaboration between groups of people unless they all have access to the same platform.
Consequently, despite the wide spread availability of related computer tools, a substantial proportion of dimensional computations are still performed manually. Many introductory undergraduate engineering textbooks give numerical problems that are substantially exercises in changing from one unit to another. See, for example, J. A. Wickert, An Introduction to Mechanical Engineering (Second Edition), Nelson-Thomson Learning, 2005. While the time and effort expended on such exercises can be valuable pedagogically for familiarizing students with different kinds of units, the actual process of conversion is dreary, tedious, and error-prone.
Other textbooks include example problems that are done twice: once in metric units, and then, immediately thereafter in the text, the same problem entirely in English units. See, for example, R. E. Sonntag, C. Borgnakke, and G. J. Van Wylen, Fundamentals of Thermodynamics (Sixth Edition), John Wiley & Sons, 2003. Again, such writing may serve a pedagogical purpose in familiarizing students with how dimensional computations may be performed using two different unit systems. But it is tedious and error-prone. Furthermore, there is an implicit message in this kind of presentation that all computations need to be performed exclusively and entirely in one set of units (e.g., metric or English). While it may be that people are less likely to make a manual mistake if all values are in the same unit system, there is no inherent reason why any set of calculations need be done using the same unit system for all input quantities. A well designed computer tool would not require all values in the same unit system.
Consequently, there is a need for tools that enable students and professionals to quickly, efficiently, and correctly convert numerical quantities from one set of units to another.
There is also a need for tools that can take input values in any units and compute a formula correctly whose output can be displayed in any consistent units without having the user perform or program any of the conversions. There is a need for the computer to provide information when there are any mistakes or inconsistencies in the input, the formula, or the output units so that these can be quickly corrected. Such a computer-based method or system would help prevent costly errors related to dimensional computations and the conversion of dimensional units.
There is a need for a tool that will check dimensional formulas and equations for dimensional consistency.
There is also a need for a tool that is inexpensive and easy to use.
A convenient platform for such computer based tools would be a web-based tool accessible from the Internet. Such a tool would be inexpensive to access, and can provide the needed form of input and user feedback. Another platform would be a stand-alone software program that could be run on a computer.
Existing tools and methods for assisting people when converting dimensional units and performing dimensional computations are inadequate.
There are several computer software programs that permit sophisticated computations with dimensionless values. These include Mathematica, Maple, and Matlab. These tools are powerful computational calculators with numerous sophisticated mathematical functions and tools. However, these tools cannot directly perform dimensional calculations. Of course, numbers with dimensional interpretations can be input into these programs, but the user is responsible for correctly converting any answers and for ensuring the dimensional consistency of the calculations performed. There is no feedback in these programs for dimensional errors as the programs have no knowledge of any dimensions.
Defects and disadvantages with these computer software programs include:
For converting dimensional units, many engineering textbooks contain tables with lists of conversion factors. These are often displayed on the inside of the book's covers for handy reference. There are also resource references that contain conversion factors and procedures for a wide range of different fields. For example, the CRC Handbooks and Desk Reference series covers fields as diverse of chemistry, physics, engineering and nutrition. Many introductory undergraduate engineering textbooks give numerical problems that are substantially exercises in changing from one unit to another. See, for example, J. A. Wickert, An Introduction to Mechanical Engineering (Second Edition), Nelson-Thomson Learning, 2005.
These reference materials require users to perform conversions manually. Thus, all results using these materials are subject to human error. Furthermore, the manual conversion is tedious and time consuming. In addition, once a user has performed the conversion, these tools do not assist in any computations or calculations using the results.
Defects and disadvantages with standard reference materials include:
Computer-based tools are also available for converting dimensional units. Numerous websites provide tools in which the user can choose various pre-programmed units from pull down menus in order to convert from one unit to another. One example of such a site can be found at www.onlineconversion.com.
These software tools can be helpful. However, the conversions that can be performed are limited to the units that are on the pull down menus or that are programmed into the software function. If a user has any unusual set of units, such as the case where metric and English units are mixed together, the pull down menus or software functions are unlikely to have the required conversion. Furthermore, the process can still be quite tedious, especially if more than one conversion is required. And, as with the printed references, once the conversion is performed, the user is still required to perform the calculations him or herself.
Defects and disadvantages with these online unit conversion tools include:
Microsoft Excel can convert units (using the software function “Convert” located in the Analysis ToolPak add-in). Once Excel has converted units, then the user can program various dimensional calculations using the results. However, Microsoft Excel does not perform any consistency checks on the calculations, so, once again, the accuracy of the result is subject to human error. In addition, Microsoft Excel has a number of other drawbacks. For combinations of units, the units must be converted one after another rather than all at once. This is tedious and error prone. Second, since the calculations are embedded in Microsoft Excel Worksheets, they are not immediately visible to the user and debugging them is tedious and error prone. Third, since the conversion tool is very simple, it often gives incorrect answers. For example, to convert temperature from 212 degrees Fahrenheit to degrees Celsius, the function call is CONVERT(212, “F”, “C”), which correctly gives the answer of 100. However, if the user tries to embed a calculation such as converting the difference of 212 degrees Fahrenheit and 32 degrees Fahrenheit to degrees Celsius using the function call CONVERT(212−32, “F”, “C”), the answer returned is 82.22. In this case, the computation performed by the computer is ((212−32) degrees Fahrenheit)=(212 degrees Fahrenheit)=82.2 degrees Celsius. However, it may not, and, most likely, is not what the user intended. Since 212 degrees Fahrenheit=100 degrees Celsius and 32 degrees Fahrenheit=0 degrees Celsius, the user may have wanted to obtain the result ((212 degrees Fahrenheit)−(32 degrees Fahrenheit))=((100 degrees Celsius)−(0 degrees Celsius))=100 degrees Celsius. In this case, the unwieldy syntax used by Microsoft Excel's Convert function may have caused an unintentional units conversion error.
Defects and disadvantages with Microsoft Excel Convert function include:
Octavian Micro Development Inc. (see www.octavian.com/excel.html) provides a unit conversion tool in the form of an Excel addin. Unfortunately, this tool suffers a number of disadvantages. The syntax chosen is cumbersome in that all compound units must be separated by the multiplication character ‘*’ and the division symbol, ‘/’, is not recognized. As a result, the input symbols are significantly different than customarily encountered. For example, rather than expressing velocity as “m/s”, one must type “m*ŝ−1”. This is significantly more typing and much more difficult to read and interpret. Furthermore, this tool does not have a separate unit to represent a relative difference in temperature. Taken together, these are major limitations.
Defects and disadvantages with these kinds of existing units conversion tools include:
There are also many large Computer-Aided Design programs that can perform a limited subset of dimensional conversions and calculations. For example, there is the Pro/ENGINEER program distributed by Parametric Technology Corp (PTC). There is the SolidWorks program sold by SolidWorks, Inc. These large software platforms allow engineers to design mechanical and electronic products in a virtual environment (i.e., on the computer) and perform specific calculations on the designs. For example, in the mechanical design platforms, tolerances, size, and mass calculations can be performed in either English or metric units. Different parts can be mated to ensure that they fit together properly. These and other tools can be valuable to large engineering and manufacturing firms. However, these software packages are very expensive. In addition, the calculations they can perform are limited only to specific pre-programmed calculations that the programmers considered important for the kinds of parts being designed. They do not represent a flexible environment for doing a wide range of dimensional calculations.
Defects and disadvantages with large Computer-Aided Design programs include:
The internet search website Google can be used to convert units by typing the conversion into the text box of the search engine. The tool can also be used for mathematical calculations. For example, to convert the sum of 2 inches and 5 feet into meters, simply type “2 inch+5 feet in m” into the search engine text box. (Google uses the keyword “in” to indicate that units conversion is desired. “in” also is the abbreviation for “inch”, which can be confusing.) The result displayed is then: “(2 inch)+(5 feet)=1.5748 meters”. However, this tool has several disadvantages. There is no feedback when the user makes a mistake. If Google decides that the input is not a calculation, then Google assumes that the input is a search request and returns a list of internet websites that are superficially related to the input text. That is, Google interprets the input text as a search request, not a unit conversion. It does not indicate in any way why the statement is not interpreted as a calculation. The tool does not recognize many common unit abbreviations such as rps and rpm. Furthermore, the input is limited to one line, and it does not handle variable names, vectors, or user defined functions. And, like Microsoft Excel, it makes errors. For example, if one inputs “212 degrees F.−32 degrees F. in degrees C.”, the result is “(212 degrees Fahrenheit)−(32 degrees Fahrenheit)=−173.15 degrees Celsius”, which is incorrect.
There is another problem with the Google calculator: you cannot do multiple conversions at once. If you type “1 in in ft”, you get the correct answer: “1 in=0.0833333333 feet”. However, if you try to convert it simultaneously into both feet and meters by entering “1 in in ft in m”, you do not get a conversion results. Instead, you are directed to the search engine results.
Defects and disadvantages with the Google calculator include:
Another software tool for performing dimensional calculations is MathCad, distributed by Parametric Technology Corp. This tool allows users to set up a MathCad worksheet which displays, either on the computer screen or in a print out, the computational work of the user. The worksheet can include equations with dimensional values in it. When the equation is dimensionally inconsistent, there is feedback requesting that the inconsistency be corrected. When any input values are changed, the complete set of computations on the worksheet is updated automatically. However, this tool also suffers from a number of deficiencies. First, the tool is expensive. Second, the tool converts all input into non-ASCII, XML-based, graphical formats. While such formats look nice, they limit the ease with which results can be edited and shared with other people. The results are stored in a proprietary XML format that is only readable by other MathCad users. This has the advantage of allowing users to embed graphics and text into their worksheets. However, it makes it hard to share the work with other people, since the work is only readable by computers that have MathCad installed. In addition, using the tool requires learning special key strokes in order to input equations properly in their proprietary software environment, as well as learning special conventions for when a result is bound to an input line. For example, the user must learn that a space is used to finish input of the denominator of a fraction.—in fact, a space may need to be input multiple times to get the cursor to the correct location when editing. Such strategic use of the space key and other special key strokes and mouse clicks is annoying and can make the program difficult to learn. In addition, special non-ASCII symbols must often be used. For example, relative temperature is indicated by ΔT. Greek letters can be used, but to use them, they must be selected from pull down menus, which is tedious. Also, since the program also allows text and graphics to be placed in the worksheet, there are numerous menus that users must learn how to use and navigate within before he or she can use the tool.
Defects and disadvantages with MathCad include:
The lack of easy to use, inexpensive tools for performing dimensional computations has resulted in a strange phenomenon in the way that undergraduate engineering is taught. Despite the fact that most undergraduate engineers possess their own computers, most students still perform engineering calculations involving units such as those assigned for homework manually. They do not use conversion tools, but still write down input values on a sheet of paper, convert then with a hand held calculator, and then do the homework problem with the calculation. While this approach may have some pedagogical value, it is extremely tedious and error prone. Furthermore, this procedure is implicitly encouraged by textbooks that give detailed directions on how to convert units in order to properly perform dimensional computations. Such pedagogical procedures would not be necessary or, perhaps even tolerated, if a readily accessible tool were available for automatically and correctly performing dimensional computations.
Therefore, there is a need for an inexpensive, readily accessible, easy to use tool that is less cumbersome than existing tools for performing dimensional computations and units conversion.
The present invention is a calculator that correctly handles and performs calculations using dimensional units, automatically converting them as necessary within equations, outputting answers in user-selected default or explicit units, and indicating when inconsistencies are present in the calculations so that errors can be identified and corrected. The input and output of the invention is entirely text based. The invention allows users to define variables and use them in user-defined functions.
This specification describes the syntax, functions, and features of the tool and gives some examples of how it can be used. A more complete understanding of the present invention, as well as further features and advantages of the invention, will be apparent from the following Detailed Description and the accompanying drawings.
The present invention may be suitably implemented as a computer-based system, in computer software which resides on computer readable media, such as solid state storage devices, such as RAM, ROM, or the like, magnetic storage devices such as a hard disk or floppy disk media or flash memory devices, optical storage devices, such as CD-ROM or the like, or as methods implemented by such systems and software.
One embodiment of the invention has been designed for use on a stand-alone personal computer running either Windows (Microsoft 2000, XP, or Vista) or Macintosh operating systems and accessing a web-hosting server.
According to one aspect of the invention, it is contemplated that the computer 12 will be operated by a user in an office, classroom, or study setting.
As illustrated in
As further illustrated in
The output information may appear on the monitor 22 or may also be printed out at the printer 24. The output information may also be electronically sent to an intermediary for interpretation. Other devices and techniques may be used to provide outputs, as desired.
In addition, both the input and output can be copied and pasted into different software objects on the computer 12. In the Windows operating system, for example, once either the input or output text has be highlighted using the mouse 16, typing Control-C on the keyboard 14 will copy the input or output onto the computer's software clipboard. The input or output can then be pasted into a file or email using the Control-V key stokes. This copying and pasting functionality of the input and output is one of the principal advantages of the present invention.
With this background in mind, we turn to a detailed discussion of a presently preferred embodiment of the invention and its context.
This invention is a calculator that correctly handles and performs calculations using dimensional units, automatically converting them appropriately within equations, outputting answers in user-selected default or explicit units, and indicating when inconsistencies are present in the input so that errors can be identified and corrected.
This tool was created so that engineering and physics problems need not be “solved by hand”, as still frequently occurs in school and in the professional workplace. The goal was to design a tool that would do this work automatically, so that the only way for an error to occur was to enter the wrong initial values or use the wrong equation. Everything else—all unit conversion, verification of dimensional consistency, and, of course, the actual calculations—would be handled correctly by the computer. This makes the invention as easy as possible to use and as hard as possible to make a mistake.
Key features and advantages of this invention are:
Unlike many on-line tools for converting units, this invention is entirely text-based. You type the units you want exactly as you would write them down; there are no pull down menus to select types of units or units themselves. You do not have to learn any special key strokes or escape sequences to enter input into the invention. You can do calculations in the most convenient units—normally the ones you are given—rather than having to convert them to an arbitrary standard system.
This invention allows units to be expressed as simple combinations of pre-programmed base units expressed with a flexible syntax. For example, this invention interprets “m/ŝ2”, “m/s/s”, “m ŝ−2”, “m/s s” , “m/s*s”, and “m/(s s)” as equivalent units for acceleration and “slug*m/ŝ2” as a force, even though it combines metric and English units.
You cannot make mistakes converting units because you never need to convert any units at all. The computer does all conversions. Furthermore, because the input is text-based, you can easily copy, paste, and exchange your work. You do not have to input your work into a special window that “formats” your input. You do not have to learn special key strokes. You format your input the way you like it.
This invention gives detailed error messages when your input is incorrect or inconsistent. If you request the output in units that are not compatible with the value calculated, this invention lets you know. It is difficult to make a mistake in your work and not realize it.
This invention allows you to define variables, and then use them in functions. You can solve nonlinear equations or optimize an objective function. A large library of standard math functions is included. This simplifies the process of engineering design, where the same set of calculations must be done iteratively to determine acceptable values. Unlike programs like Microsoft Excel, the equations are clearly visible in the input and output, so you can easily check your work, spot mistakes and correct them.
The following gives a detailed description of the invention syntax and capabilities.
As shown in
Except for user defined functions and some special commands to set options (see below), each line in the input file returns a value, which may be dimensionless or dimensional. To convert the output value into other units, simply list the units desired at the end of the line separated from the input value by a semicolon. The line can end in any number of different requested output units, each separated by semicolons.
For example, suppose we want to convert one inch into meters. The input and output (returned after hitting the “Calculate” button) would be the following:
This invention numbers the input lines and repeats the input after the line number in the output. The next line then lists the output requested. This makes it easy to follow the output.
To simultaneously see what one inch is in meters, millimeters, feet, yards, and miles, simply append each of these units one after the other, each separated by semicolons. This invention recognizes the standard abbreviations for most units.
If you do not have a preference for the output, you don't have to request any. When no output units are requested, the output is given in the default unit system, which starts as meter-kilogram-second (MKS).
If you request an output unit that is incompatible with the dimensional value, an error message is printed and the value is given in the default units.
Similarly, if you request an output unit that is not recognized by the invention, an error message is printed out and the value is given in the default units.
Because the Input and Output windows are saved separately, it is easy to go back to the Input text and correct any errors that are indicated or alter the problem. The revised input can then be re-submitted by hitting the Calculate button.
This invention recognizes four standard default unit systems:
In this example, each of the four input lines has a separate, numbered output line. In line 3, one kilogram (kg) is converted to lbf ŝ2/ft, which is the default units for mass in the FPS system.
In the above example, the output associated with the first input line, “FPS”, is “Default units—FPS with 0 exceptions.” Often, users want to define certain default output units to override the defaults. For example, the standard measurement of angle in all systems is radians, but often the user wants the output in degrees. Or, when analyzing mechanical moments, it can be preferable to display the output in “N m” rather than “kg m̂2/ŝ2”. When analyzing energy, it may be preferable to display the output in “J” rather than either “kg m̂2/ŝ2” or “N m”, all of which are equivalent. To set exceptions to the default output units, simply list them in between the parentheses following the default unit system, separated by commas.
Some of the common default exceptions are:
You can also use the MKS, cgs, IPS, and FPS as output units to force DimensionEngine to output a value in terms of the base units for each of these systems. This allows you obtain the output both in the units you want and listed using the base units of a common system of units on a single line of input. For example,
When exceptions to the default output units are set (or reset), this invention goes through the list of exceptions, in order, to see if they are equivalent to the dimensions of the line's output value. If it is, then, that set of units is used to display the output. If no matches are found in the list of exceptions, the default units are used. (Since the exceptions are tested in order and stops as soon as a match is found, the statement “MKS(cm, mm)” is equivalent to “MKS(cm)”.)
Since this invention parses the text of any units, it has no trouble interpreting mixed and non-standard combinations of units, either in the input or in the requested output. For example,
You can always enter any values in the units in which you originally have them. There is no need to convert units. In fact, it is advisable NOT to convert any units, since that increases the chances of an error occurring.
This invention uses line-based, text input. The comment character is “#”. This can occur anywhere in a line, and the rest of the line is treated as a comment that is displayed in the Output Window as part of the input line, but does not affect any computation. The line continuation character is “\”. Blank lines can occur anywhere in the input text, and are often used to make the input easier to read. For example,
This invention is more than just a tool for converting units. This invention is a calculator that automatically, consistently, and appropriately converts units within mathematical expressions to produce the correct output and give the user clear error messages when mistakes and inconsistencies are found. In other words, this invention performs dimensional computations.
The simplest example of this capability is adding, subtracting, multiplying, and dividing dimensional values. Simply type these in and this invention will correctly compute the results and display it in either the requested or default output units.
It is often easier to define a variable for a dimensional value rather than type out its dimensional value every time it is used. This is especially true when the calculation is long, or when the same dimensional value is used many times. This invention uses the “=” character to define variable names for dimensional values which can then be used in dimensional calculations. For example, the above example can be written as:
As with any programming language, this invention defines an order in which operations are performed in order to unambiguously define how to interpret mathematical expressions. In many programming languages, the order of operations or order of precedence is:
Functions include mathematical functions such as exp( ) and sin( ). The use of this order or operations is illustrated in the expression
(4+10/2)/9=(4+(10/2))/9=(4+5)/9=1
The order given matches programming languages such as Microsoft Office Excel in that negation has a higher priority than exponentiation, so −3̂2=(−3)̂2=9.
This invention adds a new operation to this list that assigns units to a dimensionless number. The full order of precedence in this invention is
Note that units can only be assigned to dimensionless numbers. Therefore, the expression
4 m
is correct and interpreted as four meters because the units “m” is assigned to the dimensionless number 4. However, the expression
(2 in+4 in)m=(6 in)m
is incorrect because evaluation of the parentheses produces a dimensional value of 6 inches, which cannot be assigned to the unit “m”. In other words, this invention does NOT interpret the expression as
(2 in+4 in)m=(6 in)m=6 in m==0.1524 m̂2
To make the syntax for this invention using the order of precedence unambiguous, we define explicitly what syntax is allowed when expressing the units that can be assigned to a dimensionless value.
Units syntax is simpler than mathematical syntax because there are fewer permissible operations. All unit expressions consist of a numerator and a denominator. The numerator and the denominator are composed of individual base units that can be raised to a power. In a units expression none of the following are allowed: variable names, functions, negation (except in the exponent), addition, or subtraction.
There are, of course, many different ways to define syntax for units expressions. This invention uses a syntax that: (a), closely matches the syntax used when people read, write, and use units; and, (b), has the least amount of typing. Sometimes, textbooks use special separators such as a dash or a dot between units that are multiplied together (m−s or m·s). These separators are not allowed in this invention.
The following rules are used to interpret unit expressions in this invention:
Of these rules, the two that were most often considered for alteration were inserting an implied value of 1.0 (i.e., m=1 m) in front of any unit expression if necessary and allowing 1 to be a base unit (i.e., 5(1/s)). This is straightforward to program, but was rejected for two primary reasons. First, this led to some odd, valid expressions such as “3 1/1 1 m /3”. Second, and more importantly, in our testing, in most cases, a missing or extra 1 was actually a typing mistake that we wanted the invention to catch and inform us about.
That completes the definition of this invention's syntax for mathematical expressions and unit expressions and unambiguously defines how this invention will interpret any input. However, there are still several important syntax rules that this invention uses.
Since this invention must be able to distinguish variable names, mathematical functions names, and dimensional base units, this invention uses the following rules for interpreting text names:
The most annoying of these rules is that variable names cannot match base units. Hence, “m”, which would be a good variable name for a mass, is not allowed, since it the base unit for meter. We have attempted to strike a balance between recognizing as many common base units as possible while also permitting as many simple variable names as possible. The full list of dimensional base units recognized by this invention is given at the end of this disclosure.
The one letter base units are A, C, D, F, G, g, H, J, L, l, m, N, s, T, and V. Below we list all 55 the one and two letter dimensional base units.
We have not include “d”=day and “h”=hour in order to permit these letters to be used as variable names. We have included “mi”=mile, but excluded “Mx”=Maxwell (a good variable name for a moment in the X direction). Because variable names are case sensitive, M, f, and a are valid variable names. Valid variable names can be composed using a letter followed by a number. So, m0, m1, and m2 are valid names for different masses.
This invention recognizes six kinds of functions:
The constants recognized by this invention must be followed by open and closed parentheses, with no arguments.
The common mathematical functions are:
For most of these functions, the argument (x) must be dimensionless. The exceptions are the inverse trigonometric functions (which require angles, but see below); a tan 2, which requires two arguments with the same dimensions, LinInterp, where x1, x2, and x must have the same dimensions, and y1 and y2 must have the same dimensions; Number(x, units), which is used to retrieve a dimensionless number for the value of x written in the units expression “units”.
The advanced mathematical functions are:
This invention also recognizes vectors of dimensional values. These are defined by listing comma separated components between square brackets. All components of the vector must have the same dimensions, although these can be expressed using any compatible units expression. Note that a vector with dimensionless components is dimensionless, so the entire vector can be assigned units just as with a scalar value. For example:
This invention recognizes the following functions that operate on vectors:
In addition, instead of using the component( ) function, one of the components of a vector with a variable name can be accessed simply by following the variable name with square brackets enclosing the component to access. For example,
Many engineering calculations involve solving linear or nonlinear equations, or determining one or more dimensional values that optimize an objective function. This invention can do both of these.
This invention defines a syntax for specifying user-defined functions. A number of programs define functions explicitly in terms of variables. For example, in Microsoft's PowerToy calculator, you can define a dimensionless function by typing “f(x)=x*x”. This creates a function called “f” that uses the variable “x” inside the function. When you call the function, “f(5)”, it will replace “x” with the value “5” and then evaluate the function. Various other programs including Mathematica use similar syntax.
This syntax works for simple, one line mathematical functions but is a poor syntax for dimensional calculations. In many if not most real world calculations, the function computes more than one value that must be displayed. For example, when solving two linear equations for two unknowns, the solution must display both unknowns in whatever output units the user requests. In even moderately complicated problems, there are also auxiliary values that are computed whose value the user would like to know in the requested output units. It is difficult to construct a syntax for a single line that easily allows the different outputs to be displayed to be specified.
Instead, this invention takes advantage of the fact that its input consists of lines of input text. In this invention, only one function can be defined at a time, and the function is defined by whatever input text lies between the commands “BEGIN” and “END”, which are not case sensitive and which must occur on their own lines.
For example, to duplicate the function “f(x)=x*x” defined above, type:
Notice that an initial value for x must be given, in this case, x=4. This is similar to programming in Excel where cells must be given initial values. This format allows us to define what units, if any, the input values have, how they should be displayed in output, and verify the dimensional consistency of any equations. Of course, in simple, purely mathematical functions, everything is dimensionless so these capabilities are not needed.
To evaluate f(5), we call the function “func(x, 5)” after the function is defined (i.e., after the END line).
Once the call to “func” has been read, this invention goes back through and re-evaluates all the input lines between the most recent BEGIN and END. When it encounters any line that defines the value of x, it ignores the input text, prints the words “UPDATED VALUE”, and then gives the specified value of the variable name. Notice that the function value “f” is simply printed out as part of the output. It does not have to be explicitly part of the func(x, 5) call—all lines in the function are re-evaluated and displayed in whatever requested output units needed. The re-evaluated lines are numbered “Func1”, “Func2”, etc. to distinguish them from the input text. If there is input text after the function call, that is evaluated after the function evaluation.
This syntax has several advantages. The lines of code can include and display all the auxiliary calculations associated with the function. In this respect, this is similar to MathCad's “workbook” concept, in which a series of linked calculations can be updated when an input value is changed and all of the outputs can be displayed.
func( ) is one of four functions that manipulate user defined functions. The table below lists the other functions:
All the arguments for max( ), min( ), and solve( ) must be variable names. They cannot be explicit calculations. In other words, with the simple function above f(x)=x*x, you cannot enter solve(x̂2,x). Also, all function of function arguments must be scalars.
For example, suppose we want to find the minimum of cos(x):
Below, we show a lengthy example in which the static equilibrium solution for a physical system is found by summing the forces and moments and solving to make them all vanish.
Notice that in the solution (lines numbered “Sol1” to “Sol11”, the auxiliary quantities of each force and moment are updated and displayed in the FPS units requested.
We can verify the accuracy of this solution by looking at lines Sol6 and Sol7 in which the sum of the forces and moments are computed. As requested, these are negligible.
Users can debug the function by simply leaving off the last input line (“solve(e1, e2, f10, f20)”) and checking the output for errors. Once the function is correct, simply add the last line and re-submit.
This invention has the help functions:
The syntax rules discussed so far fully determine how this invention interprets dimensional input and performs dimensional calculations. Nevertheless, in many real world situations, things are actually done differently in practice. Or, as in the case of temperature, the one non-affine unit conversion recognized by this invention, they may not be fully defined by the rules of the previous section.
In this section, we review all the special cases and describe how they are handled in this invention. In some cases, these are simply clarifications of the syntax rules of the previous section; in other cases, they require additional rules or exceptions in order to produce the desired, expected results.
This invention assumes that “lb” is “lbf” in any input. This is by far the most common use of “lb”, although occasionally users mean “lbm”, which can be confusing. When lb is used in a dimensionally inconsistent manner, an error message is displayed.
Temperature is always a special case for units conversion for two reasons:
deg C.=(5/9)(deg F.−32)
To change the statement “It is 10 degrees Fahrenheit today” into Celsius, the full formula is needed:
(5/9)(10 deg F.−32)=−12.22 deg C.
However, to change the statement “It is 10 degrees Fahrenheit hotter than yesterday”, only the (5/9) part of the formula is used:
(5/9)(10 deg F.diff)=5.556 deg C.diff
This invention has been designed with a special syntax to distinguish these two cases so that it does the conversion intended by the user while keeping the syntax close to common, real world use.
Specifically, this invention distinguishes the case where temperature is a single temperature base unit in the numerator (in which case it assumes an absolute conversion) from all other cases which are assumed to be relative conversion.
For example, in the example below we change absolute temperature. Because the units are all single temperature base units in the numerator, all of these are converted as absolute temperatures.
If the single temperature base unit is moved to the denominator, the relative temperature conversion is performed:
Whenever temperature units are embedded in other units (such as, for example, “J/deg C.”) it is always interpreted as a relative temperature.
Sometimes, a temperature difference (i.e., relative temperature) is needed as an input quantity, such as in the example “It is 10 degrees Fahrenheit hotter than yesterday”. This is not directly possible with the “degF” base units. Instead, this invention defines four relative temperature based units degCdiff, degKdiff, degFdiff, and degRdiff, as illustrated below.
A real world example using relative temperature is thermal conductivity, where the rate of heat energy conducted through a flat object is proportional to the temperature difference on either side of the object. The example below computes how much thermal energy flows through three inches of insulation.
Of course, one could also obtain relative temperature differences by entering two different absolute temperatures and then subtracting them, but this can be cumbersome. In the example above, we could define T1=25 deg C., T2=4 deg C. and then replace delT in the final formula by (T1−T2).
Occasionally a formula uses combinations of absolute temperature. For example, in radiant heat, the formula involves absolute temperature to the fourth power. Because of the exponentiation, this invention will interpret deg C.̂4 as a relative temperature. This invention does not provide a method for combined, absolute temperature conversion. Instead, the absolute temperature should be input in deg C. as a distinct input, and then the combination (raising to the fourth power in this case) should be done as a separate formula calculation. The example below computes the net heat flow due to radiation from a person standing in room temperature air:
Because this invention was designed to do as much of the unit conversion as possible in dimensional calculations, radians and other angular measurements cannot simply be treated as a dimensionless number.
Formally, a radian is dimensionless, and the simplest and most common method of handling radians, degrees, and revolutions is to treat them as dimensionless values. For example, on many hand calculators, when you enter
sin(45)
the calculator defaults to interpret this as sin(45 radians), unless the user selects an option to have all arguments to trigonometric functions default to degrees. However, practical problems arise with this approach as soon as other units are considered because in the real world angular measurement is often not simply interpreted as a dimensionless number.
First, if radians are truly dimensionless, then it is impossible to distinguish circular frequency (radians per second) from linear frequency (inverse seconds) because these two units are identical. When using circular frequency in calculations, rather than having this invention take care of the units for the user, the user would be responsible for explicitly inserting appropriate values of 2π whenever necessary. This is undesirable.
Second, if one of the default output units is degrees, then, all dimensionless numbers would be converted to degrees, including ones that have no angular interpretation. This would be very confusing. In fact, if this approach were taken, then we would have to create a new base unit for true dimensionless numbers so that users could explicitly override a default such as degrees.
For these reasons, this invention treats angular measurement as a distinct unit even though this is “formally” incorrect. This solves the above two problems.
Of course, this also means that this invention thinks sin(45) and sin(45 rad) have different arguments. However, by default, this invention accepts either a dimensionless number or an angular argument for all trigonometric functions, so both sin(45) and sin(45 rad) give the same answer.
The approach just described works well in practice, but some exceptions arise. Occasionally, formulas are used which explicitly utilize the fact that radians are formally dimensionless numbers. For example, occasionally one runs across formulas such as
x=2 rad
y=x+sin(x)
If this invention followed the formal syntax, then it would not allow the addition of an angular value (x) and a dimensionless number (sin(x)). However, since this is not the expected result for most users, this invention allows this, and returns a value that is dimensionless.
Notice in the example below that y0 and y1 are returned as dimensionless numbers, not numbers with angular units (e.g., rad).
One of the well known and frequently used calculations is to multiply circular frequency by a radius to obtain linear velocity. This is just one of a class of problems in which a dimensional value with units incorporating radians is multiplied by a dimensional value that incorporates length units. In these cases, it is customary to strip the radians from the result (i.e., treat radians as a truly dimensionless unit). Because this operation occurs so frequently, this has been programmed into this invention.
In the example above, the resulting values for “v” and “a” do not include radians.
As discussed previously, this invention explicitly distinguishes circular frequency (radians per second) and linear frequency (inverse seconds). Because of this, there are several base units which also incorporate this distinction.
The two base units for circular frequency (radians per second) are:
The number zero is special: one can argue that the number zero has all dimensions, or no dimensions, or something in between. However, in an application such as this invention, it definitely has a unique set of dimensions associated with it, just like all values.
However, when inputting vectors, all of whose components must have compatible units, it is often convenient to assume that any zeros have whatever the appropriate units are to make the vector correct. This only applies to zero as an argument in a vector.
This invention uses a tolerance value of 10e−5 when comparing exponents on units so that m̂(1/3) is the same as m̂(0.33333) but not m̂(1/3) is not equal to m̂(0.3).
The Number function creates a dimensionless value from a dimensional value. For example, to extract the dimensionless value of a length measurement in cm,
The following is a list of base units recognized by this invention:
It will be recognized that the invention may be suitably applied to other environments consistent with that described in the present disclosure. In particular:
In comparison with the prior art, the present invention enjoys a number of key features and advantages:
While the present invention has been disclosed in the context of various aspects of presently preferred embodiments, it will be recognized that the invention may be suitably applied to other environments consistent with the claims which follow.
The present application claims the benefit of U.S. Provisional Application Ser. No. 61/070,513 filed Mar. 24, 2008 which is incorporated by reference herein in its entirety.
Number | Date | Country | |
---|---|---|---|
61070513 | Mar 2008 | US |