Questions tagged [jscience]

JScience is a comprehensive Java library for scientific computing.

JScience is a comprehensive Java library for scientific computing. It provides strongly typed mathematical and physical structures, as well as efficient integer, rational, real and complex numbers types.

63 questions
2
votes
1 answer

How do you write your own custom measurement converters

How do you write your own custom converters and specify the conversion factor using javax.measure packages. (e.g. Pint to gallons)
Sam
  • 8,387
  • 19
  • 62
  • 97
2
votes
1 answer

Units in jScience; Whats the unit of an angular velocity?

In an application I'm making, I need some physics calculations (power, forces, torques etc.). I want to use JScience, because it seems really useful when it comes to keeping track of units. For instance, to assign a velocity I would do…
birgersp
  • 3,909
  • 8
  • 39
  • 79
2
votes
1 answer

Printing out all defined units in JScience

We have a system where a user can provide data of any unit. The data is stored and potentially converted into any other unit of the same dimension. The is based on the JScience api. I'd like to produce a list of all supported units, along with all…
Andy
  • 3,228
  • 8
  • 40
  • 65
2
votes
0 answers

JScience Amount with BigDecimal instead of double

So, I'm using JScience to do some calculations with the Amount class. The problem is, I'm handling money, among other things, and as far as I can see, Amount uses double as its internal representation. Obviously, there is a problem with double not…
Nefron
  • 699
  • 6
  • 11
2
votes
1 answer

How to use the sparse vector class in JScience?

I am trying to use the sparse vector class in the JScience package but I am confused as to how. I want to make several sparse vectors of dimension, say, 1000. But, I see that there is no constructor and also suppose that I want to put certain values…
Lucas Alanis
  • 1,208
  • 3
  • 15
  • 30
2
votes
1 answer

JScience Java Units Bar to Psi

Is there any straight forward way to convert bar to psi(Pounds per square inch)?, like converting mm to inch //mm to inches Unit mm = SI.MILLIMETER; Unit in = NonSI.INCH; UnitConverter toInch = mm.getConverterTo(in); …
Vijay Vennapusa
  • 169
  • 3
  • 15
2
votes
2 answers

Matrix Computing is too slow

I am developing the game that named Lights Out. So for solving this, i have to compute the answer of AX = B in modules 2. So, for this reason i choose jscience library. In this game the size of A is 25x25 matrix, X and B are both 25x1 matrix. I…
Hossein Mobasher
  • 4,382
  • 5
  • 46
  • 73
1
vote
1 answer

Is there a way to make JScience output in a more "human friendly" format?

When I use toString() for JScience Amount objects I get results like this: (7.5 ± 4.4E-16) mph This isn't awful, but I'd really like it to output something like: 7.5 miles per hour Is there an easy way to do this? edit: Just to clarify, I'm hoping…
sanity
  • 35,347
  • 40
  • 135
  • 226
1
vote
1 answer

Single Variable Polynomial (from text file)

I want to modify the below code to read the nodes from a text file (vs. hard-coded values) Furthermore, read data from text file in the format: P1 = 3 5 1 -1 0 8 P2 = 5 6 2 -1 1 7 0 -4 etc... Name the values P(x) and input the remaining data. Any…
Kayla0x41
  • 105
  • 2
  • 4
  • 11
1
vote
1 answer

Class conflict on different dependencies

I have the same class on 2 dependencies on my project. The libraries unit-api-1.0 (which is a dependency of org.geotools) and jscience-4.3.1 both have the class javax.measure.quantity.Length. [INFO] +- org.geotools:gt-shapefile:jar:22.3:compile …
Alexander Rumanovsk
  • 2,043
  • 4
  • 21
  • 33
1
vote
2 answers

Java Unit conversion

I have a database table which stores the units name in full like liters, kilograms, milliliters, milligrams etc.. I need a library to recogonize these units and convert it to the unit I wish to. How do i do this ? Code Logic: I will read the unit…
Deepak
  • 6,684
  • 18
  • 69
  • 121
1
vote
1 answer

JScience unit of measurement library incompatible with android

I have a use-case in my android application where I need to save a quantity, perform calculations on it, and display it in a unit of the user's choice (from a predefined list). JScience fit this need perfectly, but I cannot compile the application…
hxtk
  • 325
  • 1
  • 9
1
vote
1 answer

Converting different unit types in JScience library

I'm looking for a way in the JScience library to convert from one unit type to another. Given a factor between the base units of each types I should be able to convert. But it seems that JScience isn't being very nice about the conversion, and only…
chaser
  • 3,107
  • 4
  • 29
  • 34
1
vote
1 answer

How to fetch the conversion factor for any unit conversion

When you convert between 2 entities, you usually do it via the UnitConverter. How should I find out what the conversion factor is? For example: public static final Unit KILOMETRE = METER.times(1000); public static final Unit
Sam
  • 8,387
  • 19
  • 62
  • 97
1
vote
1 answer

Is JScience money unit conversion inverted?

I just came across this odd behaviour of JScience (4.3.1) when converting EUR to USD with the fictive conversion rate 1.05 (meaning I get 1.05 USD if I pay 1 EUR): Currency unitMoney1 = Currency.EUR; Currency unitMoney2 =…
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177