Exemplo n.º 1
0
 /**
  * @param Time                  $time
  * @param Acceleration          $acceleration
  * @param UnitComposition|null  $unitComposition
  *
  * @return Length
  */
 public static function distanceFromConstantAccel(Time $time, Acceleration $acceleration, UnitComposition $unitComposition = null)
 {
     if (is_null($unitComposition)) {
         $unitComposition = new UnitComposition();
     }
     /** @var Length $distance */
     $distance = $unitComposition->naiveMultiOpt([$time, $time, $acceleration], []);
     return $distance->preConvertedSubtract(MathProvider::divide($distance->getValue(), 2));
 }
Exemplo n.º 2
0
 public function testNaiveMultiOpt()
 {
     $unit = new UnitComposition();
     $cycles = $unit->getUnitClass('Cycles', 10);
     $time = $unit->getUnitClass('Time', 1);
     /** @var Frequency $frequency */
     $frequency = $unit->naiveMultiOpt([$cycles], [$time]);
     $this->assertInstanceOf('Samsara\\PHPhysics\\Units\\Frequency', $frequency);
     $this->assertEquals('10', $frequency->getValue());
 }
Exemplo n.º 3
0
 public function divideBySquared(Quantity $quantity, $precision = 2)
 {
     return $this->unitCompClass->naiveMultiOpt([$this], [$quantity, $quantity], $precision);
 }