Exemple #1
0
 def test_negative(self):
     number = [1, 3, [4, 6, 7]]
     expect = [
         [1, 3, [4, 6, 7]],
         [1, [1]],
     ]
     result = rational.TRANS_Z_Q(number)
     self.assertEqual(result, expect)
Exemple #2
0
 def test_zero(self):
     zero = [0, 1, [0]]
     expect = [
         [0, 1, [0]],
         [1, [1]],
     ]
     result = rational.TRANS_Z_Q(zero)
     self.assertEqual(result, expect)
def DER_P_P(coefficient, power):
    # Производная многочлена
    # Аносов Павел
    for i in range(len(power)):
        coefficient[i] = rat.MUL_QQ_Q(coefficient[i], rat.TRANS_Z_Q(
            power[i]))  # Коэффициенты домножаем на степени
        power[i] = nat.SUB_NN_N(power[i], [1])  # Степени уменьшаем на единицу
    return coefficient, power
Exemple #4
0
 def on_btn_q_transzq_released(self):
     try:
         z = self.get_q_z()
         result = rational.TRANS_Z_Q(z)
         self.add_history_record('%d = %s' % (
             common.Z_to_num(z),
             pretty.rational(result),
             ))
     except Exception as e:
         self.on_exception(e)