5
$\begingroup$

As I know, the "Megabytes" and "Gigabits" both are "InformationUnit":

UnitDimensions["Megabytes"]
UnitDimensions["Gigabits"]

{{"InformationUnit", 1}}

{{"InformationUnit", 1}}

Is there any method to find all unit in "InformationUnit" by code method?

$\endgroup$
5
  • $\begingroup$ At a minimum, in addition to "bit" and "byte" there is "trit". Look at UnitDimensions /@ {"bit", "byte", "trit"} and Outer[UnitConvert, {"bit", "byte", "trit"}, {"SIBase", "SI", "Imperial", "Conventional", "Metric"}] $\endgroup$
    – Bob Hanlon
    Commented Oct 12, 2023 at 7:30
  • $\begingroup$ You could try WolframAlpha["Bytes", "PodCells"] and WolframAlpha["Bytes", "PodCells"][[{4, 5}]] $\endgroup$
    – eldo
    Commented Oct 12, 2023 at 7:40
  • $\begingroup$ @eldo Does this method apply to AmountUnit and "LengthUnit"? $\endgroup$
    – yode
    Commented Oct 12, 2023 at 9:07
  • $\begingroup$ @eldo Done..... $\endgroup$
    – yode
    Commented Oct 12, 2023 at 10:21
  • $\begingroup$ +1 - Very nice and difficult to find $\endgroup$
    – eldo
    Commented Oct 12, 2023 at 13:50

3 Answers 3

8
$\begingroup$
Select[QuantityUnits`$UnitList, 
 MemberQ[First /@ UnitDimensions[#], "InformationUnit"] &]

{ADSLDownstreamSpeed,ADSLUpstreamSpeed,AdvancedFormatHardDiskSectorSizes,AIT1NativeCapacity170Meter,AIT1NativeCapacity230Meter,AIT1TurboNativeCapacity,AIT2NativeCapacity170Meter,AIT2NativeCapacity230Meter,AIT2TurboNativeCapacity,AIT3ExNativeCapacity,AIT3NativeCapacity,AIT4NativeCapacity,AIT5NativeCapacity,AIT6NativeCapacity,AITENativeCapacity,ARCnetSpeed,ATMSpeed,Bans,Bits,Bluetooth2Speed,BluetoothSpeed,Bytes,CellularDigitalPacketDataSpeed,CompactDiscs,Crumbs,Decibans,Deckels,DigitalSignal0Speed,DualLayerBluRays,DualLayerDVDs,DVDMinusR,DVDMPlusR,DVDSpeed,E1Speed,E2Speed,E3Speed,E4Speed,E5Speed,EDGESpeed,Ethernet1000BaseTSpeed,Ethernet100BaseTXSpeed,Ethernet10BaseTSpeed,Exabits,Exabytes,Exbibits,Exbibytes,FastTokenRingSpeed,FaxSpeed,FDDICDDISpeed,Filesystem16MBlockSizes,Filesystem1MBlockSizes,Filesystem2MBlockSizes,Filesystem4MBlockSizes,Filesystem512KBlockSizes,Filesystem8MBlockSizes,FireWire100Speed,FireWire1600Speed,FireWire200Speed,FireWire3200Speed,FireWire400Speed,FireWire800Speed,FiveGSpeed,FloppyDisks35InchMacDS,FloppyDisks35InchMacHD,FloppyDisks35InchMacSS,FloppyDisks35InchPC,FloppyDisks525Apple,FloppyDisks525PC360,FloppyDisks525PC800,FourGSpeed,Gibibits,Gibibytes,Gibioctets,Gigabits,Gigabytes,GigaDialEquipmentMinutes,Gigaoctets,GPRSSpeed,HDTVSpeed,Hebdobits,Hebdobytes,Hellabits,Hellabytes,Hexits,HighSpeedTokenRingSpeed,HolographicVersatileDisc,HSCSDSpeed,HundredVGAnylanSpeed,InformationPages,ISDNBRISpeed,ISDNNSpeed,ISDNPRISpeed,ITUV32Speed,ITUV34Speed,ITUV90Speed,J3CSpeed,J3Speed,J4Speed,Kibibits,Kibibytes,Kibioctets,Kilobits,Kilobytes,Kilokibibytes,Kilooctets,Lactabits,Lactabytes,LandlineSpeed,LTEPeakDownlinkSpeed,LTEPeakUplinkSpeed,Macrobits,MagneticDiskBlockSizes,MaxWiFiSpeed80211a,MaxWiFiSpeed80211b,MaxWiFiSpeed80211g,MaxWiFiSpeed80211n,Mebibits,Mebibytes,Mebioctets,Megabits,Megabytes,Megaoctets,Metcalfes,Millibits,MiniCompactDiscs,Myriabits,Myriabytes,Nats,Nibbles,Nickels,OC12Speed,OC1536Speed,OC18Speed,OC192Speed,OC1Speed,OC24Speed,OC256Speed,OC3072Speed,OC36Speed,OC384Speed,OC3Speed,OC48Speed,OC768Speed,OC96Speed,OC9Speed,Octets,OpticalDiskBlockSizes,Pebibits,Pebibytes,Pebioctets,Petabits,Petabytes,Petaoctets,Quadbits,Quettabits,Quettabytes,Ronnabits,Ronnabytes,RS232Speed,SATA10Speed,SATA20Speed,SATA30Speed,SDSLSpeed,SingleLayerBluRays,SingleLayerDVDs,StarLANSpeed,T1CSpeed,T1FractionalSpeed,T1Speed,T2Speed,T3CSpeed,T3Speed,T4Speed,T5Speed,Tebibits,Tebibytes,Tebioctets,TenGigabitEthernetLANSpeed,TenGigabitEthernetWANSpeed,Terabits,Terabytes,Teraoctets,ThreeGSpeed,TokenRingSpeed,TraditionalCDROMSectorSizes,TraditionalDVDSectorSizes,TraditionalHardDiskSectorSizes,Trits,Trytes,TS3DSpeed,UMTSSpeed,USB10Speed,USB1lSpeed,USB20Speed,USB30Speed,USB31Speed,Vendekabits,Vendekabytes,WCDMAWTDMASpeed,WeizsaeckerUralternatives,Wekabits,Wekabytes,Wydes,Xennabits,Xennabytes,Yobibits,Yobibytes,Yottabits,Yottabytes,Zebibits,Zebibytes,Zettabits,Zettabytes}


Relatec this post

$\endgroup$
3
$\begingroup$

Short and idiomatic:

Use Select to find all the elements of QuantityUnits`$UnitList that has UnitDimensions SameQ (===) to the UnitDimensions of "Bytes" (UnitDimensions["Bytes"])

Select[
    QuantityUnits`$UnitList
    ,(UnitDimensions[#]===UnitDimensions["Bytes"])&
 ]
$\endgroup$
1
$\begingroup$
k = QuantityUnits`$UnitList;
v = UnitDimensions@QuantityUnits`$UnitList;
assoc = Association[Table[k[[i]] -> v[[i]], {i, 1, Length@k, 1}]];
Select[assoc, 
  MemberQ[#[[1]], "InformationUnit"] || 
    MemberQ[#[[2]], "InformationUnit"] || 
    MemberQ[#[[3]], "InformationUnit"] &] // Quiet
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.