sympy units conversion - units-of-measurement

I have a little problem with units in sympy.
If i do following expression:
import sympy.physics.units as u
print u.kg + u.kg
I get as result:
2*kg
which is not what I want, I would like to have only kg. Whats the problem?
//edit
I saw that there are people working on this problem in https://github.com/sympy/sympy/pull/1389 does anyone know more about this?

A kilogram plus a kilogram is two kilograms. I don't understand why you want just kg again.

Related

Octave-online.net vpa((pi-1),100) strange result?

in octave-online.net the vpa() function returns me the non precise result. If i try some computation with a lot digits behind decimal after 49's digit is the result zero. Is there some trick how to compute with a lot digits behind decimal?
vpa((pi-1),100)
returns:
2.141592653589793115997963468544185161590576171875000000000000000000000000000000000000000000000000000
I have similar problem for similar inputs with different length(e.g. vpa((113/111),100))
Thank You.
trying:
vpa((pi-1),100)
expecting:
2.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
With vpa((p-1),100) the calculation of pi-1 is done using limited precision and the (imprecise) result is then applied to the vpa function.
Instead, the vpa function needs to make the calculation:
vpa('pi-1',100)
giving the expected result:
2.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
See more details on the vpa reference page.

IRAF imalign will not shift images, incorrectly reports unequal number of input and output images, why?

I recently started working in IRAF as I have the need for image data reduction.
I tried to stack .fit images using imalign function, but I get this error message:
This was a test, so I have only 4 images in input and output lists, and I have 4 shifts in shiftlist.txt. These are my files - input list:
NGC7286-0001_B.fit
NGC7286-0003_B.fit
NGC7286-0004_B.fit
NGC7286-0005_B.fit
Output list:
sh-NGC7286-0001_B.fit
sh-NGC7286-0003_B.fit
sh-NGC7286-0004_B.fit
sh-NGC7286-0005_B.fit
Shiftlist:
0.0 0.0
3.751 4.55
3.997 9.273
3.107 15.243
List of coordinates of referent stars:
618.58 666.96
1136.19 711.39
1288.88 942.79
1417.72 927.84
1004.71 1517.73
1053.39 1756.91
532.16 1794.60
Why do I get this error message? Do you see anything wrong with my files?
If I use shiftlist I calculated, do I need to change bigbox (20) and/or boxsize (7)? Thank you in advance.
Found the solution, though I don't know why my IRAF have that problem.
I can't have "_" character in the names of my images.
Strange, but now aligning works I guess.

Split number into expression

I have this expression:
=IIF(ISNOTHING(code.dividir((Sum(Fields!PPMS_PPM.Value,"DS_DataPPMsDosAniosAnterior")
* 1000000),Sum(Fields!PPMBSC_VentasPPM.Value,"DS_DataPPMsDosAniosAnterior"))),0,
code.dividir((Sum(Fields!PPMS_PPM.Value,"DS_DataPPMsDosAniosAnterior") * 1000000),
Sum(Fields!PPMBSC_VentasPPM.Value,"DS_DataPPMsDosAniosAnterior")))
Result of that is a number like: 32.3637282716252, how can I do to get only 32 plus 2 decimal numbers like 32.36 Regards
Pepe.. I feel these questions are pretty simple to solve if you just google it.. instead of asking such questions here..
but here is how it can be done anyway..
Right click on the text box that has this expression, properties -> formatting -> Number and then choose 2 decimal places. Done.

Razor: Display procentage

I thought there would be an easy solution but I didnt succeed in finding anything that worked!
var squatPro = sumTotalSquatWeight/sumTotalVolume;
It's basically just this line, I don't know how to make it to decimal, since the result now is just 0 when the numbers are 9120/14895 = 0,61.
Adding * 100 at the end of the code gave 0 as well so that wasn't a solution!
(I'm not using MVC)
You may need to cast the numerator to a decimal:
var squatPro = (decimal)sumTotalSquatWeight / sumTotalVolume;
And if you want to round to 2 decimal places you can use something like this:
#squatPro.ToString("0.##")
Or if you need it as a percentage you can use this:
#(string.Format("{0:P}", squatPro))

Drawing a bar chart, but with some restriction

I want to draw a chart in linux like this:
1################# 64.85
2################### 72.84
3####################### 91.19
4####################### 91.61
5########################### 108.66
6############################ 110.69
7###################################### 149.85
8####################################### 156.60
9########################################### 169.81
I want to do that in python, of course you noticed that I don't want code like:
for i in data:
print "#"*i
because data may contain big numbers, so it is not nice to print "#" milion times.
So what is the mathematical equation that I must use to do this, I think this is a kind of mathematical problem
Thanks a lot
You have to work with percentages I think sum up all you values and then you do bar value / total of bar values
So if I have the following values 1 2 3 6 the total will be 12 so then
i will do 1 / 12 the percentage will be 8 so you print '#' 8 times and so on.
then the max # you can print is hundred.
I don't know if this is what you want, but hope this will help.