Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Login with GitLab

Physical Calculus

Calculate with physical units.
(1892 downloads for this version - 1892 downloads for all versions)
Details
Version
1.0
Author
D. MARION
Maintainer
Denis MARION
Category
License
Supported Scilab Version
5.3
Creation Date
February 4, 2010
Description
            Any scientist has already experienced errors in their results or their
predictions of physical parameters. These errors are very often due to a
missing
conversion between two initial data or formulas expressed in different systems
of units.
Yet the PhysCalc package does not ensure that your calculations will be
correct, it still can be of great help when dealing with values and constants
gathered from different bibliographical sources, hence possibly expressed in
varied systems of units.
 
PhysCalc facilitates the declaration and the correct use of physical quantities
in Scilab. Once all your constants and parameters are declared (with a very
light syntax), any operation and Scilab function can be used to work on them.
While you are concentrated on your work and the physical meaning of your
results, PhysCalc:
- checks for you that your operations have a sense (e.g. that you are not
adding or concatenating speeds and energies...)
- makes implicitly the appropriate conversions when adding two quantities of
identical physical meaning (e.g., a speed in International Units and a speed in
CGS units).
- calculates the unit of the result of every operation (addition, division,
multiplication, exponentiation,...) based on physical operands.
- lets you add, multiply, exponentiate, extract, insert and concatenate all
your physical vectors (provided that the operation is correct!) and use every
other Scilab function on them.
- displays your results with their unit in a nice, human-readable format in
the Scilab prompt.

A number of practical units and physics constants are already included in the
package.

As this is my first attempt to submit a Scilab package, there may be bugs in the
present work (however, this is pretty simple). So, please feel free to write a
comment and/or let me know by email if you encounter something wrong.            
Files (1)
[110.52 kB]
Source code archive

News (0)
Comments (4)     Leave a comment 
Comment from Samuel Gougeon -- February 23, 2011, 02:41:10 PM    
Hello,
This is likely a bug: When a variable is complex, its imaginary part is not displayed:

-->a=1-%i & 1/_m
 a  =
		 -1  
         1	m      (#SI)
 
Best regards
Comment from Samuel Gougeon -- July 22, 2011, 07:09:01 PM    
The issue comes from printf(), that is unable to print correctly complex values.
Here are some lines replacing the last corresponding ones in %UNIT_p() and fixing the
issue.
----
if (length(a.values) == 1)
    // if 'a' is a scalar, print the value and the dimension on the same line in the
console.
    disp(strcat(printedExps)+" "+string(a.values)+" 
"+strcat(printedUnits)+"   
"+a.unitSystem);
    return;
else
...
----
Regards
Samuel
Comment from Samuel Gougeon -- October 25, 2013, 09:18:15 AM    
Hello,

with Scilab 5.4.1, PhysCalc.sci yields the following error:

-->ascii(code2str(283))
Attention : La fonction code2str est obsol?te.
Attention : Veuillez utiliser ascii ? la place.
Attention : Cette fonction sera d?finitivement supprim?e dans Scilab 6.0.0

It occurs in function %UNIT_p(a)
Just replace the line
separatorChar= code2str(283);   // the character "?" will separate the units.
with
separatorChar= ascii(183);   // the character "?" will separate the units.

Indeed, ascii(code2str(283)) => 183

Regards
Samuel
Comment from pavan klayan -- July 21, 2020, 06:36:00 AM    
Hello,

with Scilab 5.4.1, PhysCalc.sci yields the following error:

-->ascii(code2str(283))
Attention : La fonction code2str est obsol�te.
Attention : Veuillez utiliser ascii � la place.
Attention : Cette fonction sera d�finitivement supprim�e dans Scilab 6.0.0

It occurs in function %UNIT_p(a)
Just replace the line
separatorChar= code2str(283);   // the character "�" will separate the units.
with
separatorChar= ascii(183);   // the character "�" will separate the units.

Indeed, ascii(code2str(283)) => 183

Regards
Samuel 
<a href="https://www.w3schools.com/">Visit
W3Schools.com!</a>
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.