Showing posts with label Objective-C. Show all posts
Showing posts with label Objective-C. Show all posts

Tuesday, September 27, 2016

Objective-C: Physical Constant

Command:

$ cat PhysicalConstant.h


Result:

//
//  PhysicalConstant.h
//  Science
//
//  Created on 8/30/14.
//

#import <Foundation/Foundation.h>

@interface PhysicalConstant : NSObject

//Table of universal constants
+(double)speedOfLight;
+(double)newtonianConstantOfGravitation;
+(double)planckConstant;
+(double)reducedPlanckConstant;

//Table of electromagnetic constants
+(double)magneticConstant;
+(double)electricConstant;
+(double)characteristicImpedanceOfVacuum;
+(double)coulombsConstant;
+(double)elementaryCharge;
+(double)bohrMagneton;
+(double)conductanceQuantum;
+(double)inverseConductanceQuantum;
+(double)josephsonConstant;
+(double)magneticFluxQuantum;
+(double)nuclearMagneton;
+(double)vonKlitzingConstant;

//Table of atomic and nuclear constants
+(double)bohrRadius;
+(double)classicalElectronRadius;
+(double)electronMass;
+(double)fermiCouplingConstant;
+(double)fineStructureConstant;
+(double)hartreeEnergy;
+(double)protonMass;
+(double)quantumOfCirculation;
+(double)rydbergConstant;
+(double)thomsonCrossSection;
+(double)weakMixingAngle;
+(double)efimovFactor;

//Table of physico-chemical constants
+(double)atomicMassConstant;
+(double)avogadrosNumber;
+(double)boltzmannConstant;
+(double)faradayConstant;
+(double)firstRadiationConstant;
+(double)firstRadiationConstantForSpectralRadiance;
+(double)loschmidtConstant;
+(double)gasConstant;
+(double)molarPlanckConstant;
+(double)molarVolumeOfAnIdealGasAtTemperature:(double)temperature andPressure:(double)pressure;
+(double)sackurTetrodeConstantAtTemperature:(double)temperature andPressure:(double)pressure;
+(double)secondRadiationConstant;
+(double)stefanBoltzmannConstant;
+(double)wienDisplacementLawConstant;

//Table of adopted values
+(double)molarMassConstant;
+(double)molarMassOfCarbon12;
+(double)standardAccelerationOfGravity;
+(double)standardAtmosphere;

//Natural units
+(double)planckLength;
+(double)planckMass;
+(double)planckTime;
+(double)planckCharge;
+(double)planckTemperature;

//TEST
+(void)debug;

@end


Command:

$ cat PhysicalConstant.m


Result:

//
//  PhysicalConstant.m
//  Science
//
//  Created on 8/30/14.
//

#import "PhysicalConstant.h"

@implementation PhysicalConstant

static const double SPEED_OF_LIGHT = 299792458;
static const double NEWTONIAN_CONSTANT_OF_GRAVITATION = 6.67384E-11;
static const double PLANCK_CONSTANT = 6.62606957E-34;
static const double ELEMENTARY_CHARGE = 1.602176565E-19;
static const double ELECTRON_MASS = 9.10938291E-31;
static const double PROTON_MASS = 1.672621777E-27;
static const double EFIMOV_FACTOR = 22.7;
static const double AVOGADROS_NUMBER = 6.02214129E23;
static const double ATOMIC_MASS_CONSTANT = 1.660538921E-27;
static const double GAS_CONSTANT = 8.3144621;
static const double STANDARD_ATMOSPHERE = 101325;
static const double FERMI_COUPLING_CONSTANT = 1.166364E-5;
static const double WEAK_MIXING_ANGLE = 0.2223;
static const double FIRST_RADIATION_CONSTANT_FOR_SPECTRAL_RADIANCE = 1.191042869E-16;
static const double WIEN_DISPLACEMENT_LAW_CONSTANT = 2.8977721E-3;
static const double MOLAR_MASS_CONSTANT =1E-3;
static const double MOLAR_MASS_OF_CARBON_12 = 1.2E-2;
static const double STANDARD_ACCELERATION_OF_GRAVITY = 9.80665;

//Table of universal constants

+(double)speedOfLight{
    return SPEED_OF_LIGHT;
}

+(double)newtonianConstantOfGravitation{
    return NEWTONIAN_CONSTANT_OF_GRAVITATION;
}

+(double)planckConstant{
    return PLANCK_CONSTANT;
}

+(double)reducedPlanckConstant{
    return self.planckConstant / (2 * M_PI);
}

//Table of electromagnetic constants

+(double)magneticConstant{
    return 4 * M_PI * 1E-7;
}

+(double)electricConstant{
    return 1.0f / (self.magneticConstant * self.speedOfLight * self.speedOfLight);
}

+(double)characteristicImpedanceOfVacuum{
    return self.magneticConstant * self.speedOfLight;
}

+(double)coulombsConstant{
    return 1.0f / (4 * M_PI * self.electricConstant);
}

+(double)elementaryCharge{
    return ELEMENTARY_CHARGE;
}

+(double)bohrMagneton{
    return (self.elementaryCharge * self.reducedPlanckConstant) / (2 * self.electronMass);
}

+(double)conductanceQuantum{
    return (2 * self.elementaryCharge * self.elementaryCharge) / self.planckConstant;
}

+(double)inverseConductanceQuantum{
    return self.planckConstant / (2 * self.elementaryCharge * self.elementaryCharge);
}

+(double)josephsonConstant{
    return (2 * self.elementaryCharge) / self.planckConstant;
}

+(double)magneticFluxQuantum{
    return self.planckConstant / (2 * self.elementaryCharge);
}

+(double)nuclearMagneton{
    return (self.elementaryCharge * self.reducedPlanckConstant) / (2 * self.protonMass);
}

+(double)vonKlitzingConstant{
    return self.planckConstant / (self.elementaryCharge * self.elementaryCharge);
}

//Table of atomic and nuclear constants

+(double)bohrRadius{
    return self.fineStructureConstant / (4 * M_PI * self.rydbergConstant);
}

+(double)classicalElectronRadius{
    return (self.elementaryCharge * self.elementaryCharge) / (4 * M_PI * self.electricConstant * self.electronMass * self.speedOfLight * self.speedOfLight);
}

+(double)electronMass{
    return ELECTRON_MASS;
}

+(double)fermiCouplingConstant{
    return FERMI_COUPLING_CONSTANT;
}

+(double)fineStructureConstant{
    return (self.elementaryCharge * self.elementaryCharge) / (self.reducedPlanckConstant * self.speedOfLight * 4 * M_PI * self.electricConstant);
}

+(double)hartreeEnergy{
    return 2 * self.rydbergConstant * self.planckConstant * self.speedOfLight;
}

+(double)protonMass{
    return PROTON_MASS;
}

+(double)quantumOfCirculation{
    return self.planckConstant / (2 * self.electronMass);
}

+(double)rydbergConstant{
    return (self.fineStructureConstant * self.fineStructureConstant * self.electronMass * self.speedOfLight) / (2 * self.planckConstant);
}

+(double)thomsonCrossSection{
    return (8 * M_PI / 3) * self.classicalElectronRadius * self.classicalElectronRadius;
}

+(double)weakMixingAngle{
    return WEAK_MIXING_ANGLE;
}

+(double)efimovFactor{
    return EFIMOV_FACTOR;
}

//Table of physico-chemical constants

+(double)atomicMassConstant{
    return ATOMIC_MASS_CONSTANT;
}

+(double)avogadrosNumber{
    return AVOGADROS_NUMBER;
}

+(double)boltzmannConstant{
    return self.gasConstant / self.avogadrosNumber;
}

+(double)faradayConstant{
    return self.avogadrosNumber * self.elementaryCharge;
}

+(double)firstRadiationConstant{
    return 2 * M_PI * self.planckConstant * self.speedOfLight * self.speedOfLight;
}

+(double)firstRadiationConstantForSpectralRadiance{
    return FIRST_RADIATION_CONSTANT_FOR_SPECTRAL_RADIANCE;
}

+(double)loschmidtConstant{
    return self.avogadrosNumber / [self molarVolumeOfAnIdealGasAtTemperature:273.15f andPressure:101325.0f];
}

+(double)gasConstant{
    return GAS_CONSTANT;
}

+(double)molarPlanckConstant{
    return self.avogadrosNumber * self.planckConstant;
}

+(double)molarVolumeOfAnIdealGasAtTemperature:(double)temperature andPressure:(double)pressure{
    return (self.gasConstant * temperature) / pressure;
}

+(double)sackurTetrodeConstantAtTemperature:(double)temperature andPressure:(double)pressure{
    return (5.0f / 2) + log(pow((2 * M_PI * self.atomicMassConstant * self.boltzmannConstant * temperature) / (self.planckConstant * self.planckConstant),
                          1.5) * self.boltzmannConstant * temperature / pressure);
}

+(double)secondRadiationConstant{
    return self.planckConstant * self.speedOfLight / self.boltzmannConstant;
}

+(double)stefanBoltzmannConstant{
    return (M_PI * M_PI * pow(self.boltzmannConstant, 4)) / (60 * pow(self.reducedPlanckConstant, 3) * pow(self.speedOfLight, 2));
}

+(double)wienDisplacementLawConstant{
    return WIEN_DISPLACEMENT_LAW_CONSTANT;
}

//Table of adopted values

+(double)molarMassConstant{
    return MOLAR_MASS_CONSTANT;
}

+(double)molarMassOfCarbon12{
    return MOLAR_MASS_OF_CARBON_12;
}

+(double)standardAccelerationOfGravity{
    return STANDARD_ACCELERATION_OF_GRAVITY;
}

+(double)standardAtmosphere{
    return STANDARD_ATMOSPHERE;
}

//Natural units

+(double)planckLength{
    return sqrt((self.reducedPlanckConstant * self.newtonianConstantOfGravitation) / pow(self.speedOfLight, 3));
}

+(double)planckMass{
    return sqrt((self.reducedPlanckConstant * self.speedOfLight) / self.newtonianConstantOfGravitation);
}

+(double)planckTime{
    return self.planckLength / self.speedOfLight;
}

+(double)planckCharge{
    return sqrt(4 * M_PI * self.electricConstant * self.reducedPlanckConstant * self.speedOfLight);
}

+(double)planckTemperature{
    return (self.planckMass * self.speedOfLight * self.speedOfLight) / self.boltzmannConstant;
}

//TEST

+(void)debug{
   
    //Table of universal constants
    NSLog(@"***Table of universal constants***\n\n");
    NSLog(@"Speed of light: %.0f", self.speedOfLight);
    NSLog(@"Newtonian constant of gravitation: %.5e", self.newtonianConstantOfGravitation);
    NSLog(@"Planck constant: %.8e", self.planckConstant);
    NSLog(@"Reduced planck constant: %.9e\n\n", self.reducedPlanckConstant);
   
    //Table of electromagnetic constants
    NSLog(@"***Table of electromagnetic constants***\n\n");
    NSLog(@"Magnetic constant: %.9e", self.magneticConstant);
    NSLog(@"Electric constant: %.9e", self.electricConstant);
    NSLog(@"Characteristic impedance of vacuum: %3.9f", self.characteristicImpedanceOfVacuum);
    NSLog(@"Coulomb's constant: %.9e", self.coulombsConstant);
    NSLog(@"Elementary charge: %.9e", self.elementaryCharge);
    NSLog(@"Bohr magneton: %.8e", self.bohrMagneton);
    NSLog(@"Conductance quantum: %.10e", self.conductanceQuantum);
    NSLog(@"Inverse conductance quantum: %5.7f", self.inverseConductanceQuantum);
    NSLog(@"Josephson constant: %.8e", self.josephsonConstant);
    NSLog(@"Magnetic flux quantum: %.9e", self.magneticFluxQuantum);
    NSLog(@"Nuclear magneton: %.8e", self.nuclearMagneton);
    NSLog(@"von Klitzing constant: %5.7f\n\n", self.vonKlitzingConstant);
   
    //Table of atomic and nuclear constants
    NSLog(@"***Table of atomic and nuclear constants***\n\n");
    NSLog(@"Bohr radius: %.10e", self.bohrRadius);
    NSLog(@"Classical electron radius: %.10e", self.classicalElectronRadius);
    NSLog(@"Electron mass: %.8e", self.electronMass);
    NSLog(@"Fermi coupling constant: %.6e", self.fermiCouplingConstant);
    NSLog(@"Fine-structure constant: %.10e", self.fineStructureConstant);
    NSLog(@"Hartree energy: %.8e", self.hartreeEnergy);
    NSLog(@"Proton mass: %.9e", self.protonMass);
    NSLog(@"Quantum of circulation: %.10e", self.quantumOfCirculation);
    NSLog(@"Rydberg constant: %8.6f", self.rydbergConstant);
    NSLog(@"Thomson cross section: %.9e", self.thomsonCrossSection);
    NSLog(@"Weak mixing angle: %.4f", self.weakMixingAngle);
    NSLog(@"Efimov factor: %.1f\n\n", self.efimovFactor);
   
    //Table of physico-chemical constants
    NSLog(@"***Table of physico-chemical constants***\n\n");
    NSLog(@"Atomic mass constant: %.9e", self.atomicMassConstant);
    NSLog(@"Avogadro's number: %.8e", self.avogadrosNumber);
    NSLog(@"Boltzmann constant: %.7e", self.boltzmannConstant);
    NSLog(@"Faraday constant: %5.4f", self.faradayConstant);
    NSLog(@"First radiation constant: %.8e", self.firstRadiationConstant);
    NSLog(@"First radiation constant for spectral radiance: %.9e", self.firstRadiationConstantForSpectralRadiance);
    NSLog(@"Loschmidt constant: %.7e", self.loschmidtConstant);
    NSLog(@"Gas constant: %.7f", self.gasConstant);
    NSLog(@"Molar planck constant: %.10e", self.molarPlanckConstant);
    NSLog(@"Molar volume of an ideal gas at temperature at 273.15 K and pressure 100 kPa: %.7e", [self molarVolumeOfAnIdealGasAtTemperature:273.15f andPressure:100000.0f]);
    NSLog(@"Molar volume of an ideal gas at temperature at 273.15 K and pressure 101.325kPa: %.7e", [self molarVolumeOfAnIdealGasAtTemperature:273.15f andPressure:101325.0f]);
   
    NSLog(@"Sackur tetrode constant at temperature 1 K and pressure 100 KPa: %1.7f", [self sackurTetrodeConstantAtTemperature:1.0f andPressure:100000.0f]);
    NSLog(@"Sackur tetrode constant at temperature 1 K and pressure 101.325 KPa: %1.7f", [self sackurTetrodeConstantAtTemperature:1.0f andPressure:101325.0f]);
   
    NSLog(@"Second radiation constant: %.7e", self.secondRadiationConstant);
    NSLog(@"Stefan boltzmann constant: %.6e", self.stefanBoltzmannConstant);
    NSLog(@"Wien displacement law constant: %.7e\n\n", self.wienDisplacementLawConstant);
   
    //Table of adopted values
    NSLog(@"***Table of adopted values***\n\n");
    NSLog(@"Molar mass constant: %.0e", self.molarMassConstant);
    NSLog(@"Molar mass of carbon 12: %.1e", self.molarMassOfCarbon12);
    NSLog(@"Standard acceleration of gravity: %.5f", self.standardAccelerationOfGravity);
    NSLog(@"Standard atmosphere: %.0f\n\n", self.standardAtmosphere);
   
    //Natural units
    NSLog(@"***Natural units***\n\n");
    NSLog(@"Planck length: %.6e", self.planckLength);
    NSLog(@"Planck mass: %.5e", self.planckMass);
    NSLog(@"Planck time: %.5e", self.planckTime);
    NSLog(@"Planck charge: %.9e", self.planckCharge);
    NSLog(@"Planck temperature: %.6e", self.planckTemperature);
}

@end


Command:

$ cat AppDelegate.h


Result:

//
//  AppDelegate.h
//  Science
//
//  Created on 8/30/14.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end


Command:

$ cat AppDelegate.m


Result:

//
//  AppDelegate.m
//  Science
//
//  Created on 8/30/14.
//

#import "AppDelegate.h"
#import "PhysicalConstant.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   
    [PhysicalConstant debug];
   
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end


Command:

$ cat main.m


Result:

//
//  main.m
//  Science
//
//  Created on 8/30/14.
//

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}


Output (Debug area):

2016-09-27 00:51:30.264101 Science[60292:40774731] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-27 00:51:30.271240 Science[60292:40774731] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-27 00:51:30.304548 Science[60292:40774728] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-09-27 00:51:30.322003 Science[60292:40773198] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-27 00:51:30.568 Science[60292:40773198] ***Table of universal constants***

2016-09-27 00:51:30.568 Science[60292:40773198] Speed of light: 299792458
2016-09-27 00:51:30.569 Science[60292:40773198] Newtonian constant of gravitation: 6.67384e-11
2016-09-27 00:51:30.569 Science[60292:40773198] Planck constant: 6.62606957e-34
2016-09-27 00:51:30.569 Science[60292:40773198] Reduced planck constant: 1.054571725e-34

2016-09-27 00:51:30.569 Science[60292:40773198] ***Table of electromagnetic constants***

2016-09-27 00:51:30.570 Science[60292:40773198] Magnetic constant: 1.256637061e-06
2016-09-27 00:51:30.570 Science[60292:40773198] Electric constant: 8.854187818e-12
2016-09-27 00:51:30.570 Science[60292:40773198] Characteristic impedance of vacuum: 376.730313462
2016-09-27 00:51:30.570 Science[60292:40773198] Coulomb's constant: 8.987551787e+09
2016-09-27 00:51:30.570 Science[60292:40773198] Elementary charge: 1.602176565e-19
2016-09-27 00:51:30.571 Science[60292:40773198] Bohr magneton: 9.27400967e-24
2016-09-27 00:51:30.571 Science[60292:40773198] Conductance quantum: 7.7480917407e-05
2016-09-27 00:51:30.571 Science[60292:40773198] Inverse conductance quantum: 12906.4037116
2016-09-27 00:51:30.571 Science[60292:40773198] Josephson constant: 4.83597870e+14
2016-09-27 00:51:30.572 Science[60292:40773198] Magnetic flux quantum: 2.067833757e-15
2016-09-27 00:51:30.572 Science[60292:40773198] Nuclear magneton: 5.05078353e-27
2016-09-27 00:51:30.572 Science[60292:40773198] von Klitzing constant: 25812.8074232

2016-09-27 00:51:30.572 Science[60292:40773198] ***Table of atomic and nuclear constants***

2016-09-27 00:51:30.573 Science[60292:40773198] Bohr radius: 5.2917721011e-11
2016-09-27 00:51:30.573 Science[60292:40773198] Classical electron radius: 2.8179403268e-15
2016-09-27 00:51:30.573 Science[60292:40773198] Electron mass: 9.10938291e-31
2016-09-27 00:51:30.573 Science[60292:40773198] Fermi coupling constant: 1.166364e-05
2016-09-27 00:51:30.574 Science[60292:40773198] Fine-structure constant: 7.2973525755e-03
2016-09-27 00:51:30.574 Science[60292:40773198] Hartree energy: 4.35974435e-18
2016-09-27 00:51:30.574 Science[60292:40773198] Proton mass: 1.672621777e-27
2016-09-27 00:51:30.575 Science[60292:40773198] Quantum of circulation: 3.6369475493e-04
2016-09-27 00:51:30.575 Science[60292:40773198] Rydberg constant: 10973731.593929
2016-09-27 00:51:30.575 Science[60292:40773198] Thomson cross section: 6.652458735e-29
2016-09-27 00:51:30.575 Science[60292:40773198] Weak mixing angle: 0.2223
2016-09-27 00:51:30.576 Science[60292:40773198] Efimov factor: 22.7

2016-09-27 00:51:30.576 Science[60292:40773198] ***Table of physico-chemical constants***

2016-09-27 00:51:30.576 Science[60292:40773198] Atomic mass constant: 1.660538921e-27
2016-09-27 00:51:30.577 Science[60292:40773198] Avogadro's number: 6.02214129e+23
2016-09-27 00:51:30.577 Science[60292:40773198] Boltzmann constant: 1.3806488e-23
2016-09-27 00:51:30.577 Science[60292:40773198] Faraday constant: 96485.3365
2016-09-27 00:51:30.577 Science[60292:40773198] First radiation constant: 3.74177152e-16
2016-09-27 00:51:30.578 Science[60292:40773198] First radiation constant for spectral radiance: 1.191042869e-16
2016-09-27 00:51:30.578 Science[60292:40773198] Loschmidt constant: 2.6867806e+25
2016-09-27 00:51:30.578 Science[60292:40773198] Gas constant: 8.3144621
2016-09-27 00:51:30.579 Science[60292:40773198] Molar planck constant: 3.9903127148e-10
2016-09-27 00:51:30.579 Science[60292:40773198] Molar volume of an ideal gas at temperature at 273.15 K and pressure 100 kPa: 2.2710953e-02
2016-09-27 00:51:30.579 Science[60292:40773198] Molar volume of an ideal gas at temperature at 273.15 K and pressure 101.325kPa: 2.2413968e-02
2016-09-27 00:51:30.579 Science[60292:40773198] Sackur tetrode constant at temperature 1 K and pressure 100 KPa: -1.1517078
2016-09-27 00:51:30.580 Science[60292:40773198] Sackur tetrode constant at temperature 1 K and pressure 101.325 KPa: -1.1648708
2016-09-27 00:51:30.580 Science[60292:40773198] Second radiation constant: 1.4387770e-02
2016-09-27 00:51:30.580 Science[60292:40773198] Stefan boltzmann constant: 5.670372e-08
2016-09-27 00:51:30.580 Science[60292:40773198] Wien displacement law constant: 2.8977721e-03

2016-09-27 00:51:30.581 Science[60292:40773198] ***Table of adopted values***

2016-09-27 00:51:30.581 Science[60292:40773198] Molar mass constant: 1e-03
2016-09-27 00:51:30.581 Science[60292:40773198] Molar mass of carbon 12: 1.2e-02
2016-09-27 00:51:30.581 Science[60292:40773198] Standard acceleration of gravity: 9.80665
2016-09-27 00:51:30.582 Science[60292:40773198] Standard atmosphere: 101325

2016-09-27 00:51:30.582 Science[60292:40773198] ***Natural units***

2016-09-27 00:51:30.582 Science[60292:40773198] Planck length: 1.616199e-35
2016-09-27 00:51:30.583 Science[60292:40773198] Planck mass: 2.17651e-08
2016-09-27 00:51:30.583 Science[60292:40773198] Planck time: 5.39106e-44
2016-09-27 00:51:30.583 Science[60292:40773198] Planck charge: 1.875545956e-18
2016-09-27 00:51:30.583 Science[60292:40773198] Planck temperature: 1.416833e+32
2016-09-27 00:51:30.586 Science[60292:40773198] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UIApplication.m:3679
2016-09-27 00:51:30.591 Science[60292:40773198] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010dffd34b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x000000010da5e21e objc_exception_throw + 48
2   CoreFoundation                      0x000000010e001442 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x000000010d5f4edd -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4   UIKit                               0x000000010bcd6be9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3827
5   UIKit                               0x000000010bcd3539 -[UIApplication workspaceDidEndTransaction:] + 188
6   FrontBoardServices                  0x0000000110c2c76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
7   FrontBoardServices                  0x0000000110c2c5e4 -[FBSSerialQueue _performNext] + 189
8   FrontBoardServices                  0x0000000110c2c96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
9   CoreFoundation                      0x000000010dfa2311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
10  CoreFoundation                      0x000000010df8759c __CFRunLoopDoSources0 + 556
11  CoreFoundation                      0x000000010df86a86 __CFRunLoopRun + 918
12  CoreFoundation                      0x000000010df86494 CFRunLoopRunSpecific + 420
13  UIKit                               0x000000010bcd1db6 -[UIApplication _run] + 434
14  UIKit                               0x000000010bcd7f34 UIApplicationMain + 159
15  Science                             0x000000010b5011cf main + 111
16  libdyld.dylib                       0x000000010f00a68d start + 1
17  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)




Friday, September 5, 2014

Objective-C:Constants


  • YES
  • NO
  • nil
  • Nil
  • OBJC_OLD_DISPATCH_PROTOTYPES
  • OBJC_ROOT_CLASS
  • NS_VALID_UNTIL_END_OF_SCOPE
  • OBJC_ASSOCIATION_ASSIGN
  • OBJC_ASSOCIATION_RETAIN_NONATOMIC
  • OBJC_ASSOCIATION_COPY_NONATOMIC
  • OBJC_ASSOCIATION_RETAIN
  • OBJC_ASSOCIATION_COPY
/* YES */
#define YES (BOOL)1

/* NO */
#define NO (BOOL)0

/* nil */
#define nil __DARWIN_NULL

/* Nil */
#define Nil __DARWIN_NULL

/* OBJC_OLD_DISPATCH_PROTOTYPES */
#define OBJC_OLD_DISPATCH_PROTOTYPES 1

/* OBJC_ROOT_CLASS */
#define OBJC_ROOT_CLASS

/* NS_VALID_UNTIL_END_OF_SCOPE */
#define NS_VALID_UNTIL_END_OF_SCOPE

/* OBJC_ASSOCIATION_ASSIGN */
/* OBJC_ASSOCIATION_RETAIN_NONATOMIC */
/* OBJC_ASSOCIATION_COPY_NONATOMIC */
/* OBJC_ASSOCIATION_RETAIN */
/* OBJC_ASSOCIATION_COPY */
enum {
    OBJC_ASSOCIATION_ASSIGN = 0,
    OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1,
    OBJC_ASSOCIATION_COPY_NONATOMIC = 3,
    OBJC_ASSOCIATION_RETAIN = 01401,
    OBJC_ASSOCIATION_COPY = 01403
};

Objective-C:Data types


  • Class
  • Method
  • Ivar
  • Category
  • objc_property_t
  • IMP
  • SEL
  • objc_method_description
  • objc_cache
  • objc_property_attribute_t
  • id
  • objc_object
  • objc_super
  • BOOL
  • objc_AssociationPolicy


/* Class */
typedef struct objc_class *Class;

/* Method */
typedef struct objc_method *Method;

/* Ivar */
typedef struct objc_ivar *Ivar;

/* Category */
typedef struct objc_category *Category;

/* objc_property_t */
typedef struct objc_property *objc_property_t;

/* IMP */
id (*IMP)(id, SEL, ...)

/* SEL */
typedef struct objc_selector *SEL;

/* objc_method_description */
struct objc_method_description {
    SEL name;
    char *types;
};

/* objc_cache */
struct objc_cache {
    unsigned int mask;
    unsigned int occupied;
    Method buckets[1];
};

/* objc_property_attribute_t */
typedef struct {
    const char *name;
    const char *value;
} objc_property_attribute_t;

/* id */
typedef struct objc_object *id;

/* objc_object */
struct objc_object {
    Class isa;
};

/* objc_super */
struct objc_super {
    id receiver;
    Class class
};

/* BOOL */
typedef signed char BOOL;

/* objc_AssociationPolicy */
typedef uintptr_t objc_AssociationPolicy;