# Written by `viv check --phrases`: each phrase of the program held to the # closed form lib/cas finds for it (lang/viv/src/cas_check.rs). from cas.phrases import cas_check_deriv, cas_check_holds, cas_check_summary MPI = 138.039 Q_REF = [1.0, 50.0, 100.0, 200.0, 300.0, 500.0, 700.0, 1000.0] L_REF = [1.0000043733362086695, 1.0107925820719110433, 1.0415967652983725786, 1.1464228856495893426, 1.2792753525586836379, 1.5487579788258103122, 1.7848080102098173246, 2.0735239825621998704] Q_D = [50.0, 200.0, 500.0] DL_REF = [0.00042617365415873921187, 0.0012407510640255769467, 0.0012762845936279545397] cas_got_0 = differentiate sqrt(4*MPI^2 + x^2)/x * log((sqrt(4*MPI^2 + x^2) + x)/(2*MPI)) at 200 cas_check_deriv(0, 63, "differentiate sqrt(4*MPI^2 + x^2)/x * log((sqrt(4*MPI^2 + x^2) + x)/(2*MPI)) at 200", "((sqrt(((4 * ((138.039))^(2)) + (x)^(2))) / x) * log(((sqrt(((4 * ((138.039))^(2)) + (x)^(2))) + x) / (2 * (138.039)))))", "x", "200", cas_got_0, "deriv") cas_got_1 = differentiate sqrt(4*MPI^2 + x^2)/x * log((sqrt(4*MPI^2 + x^2) + x)/(2*MPI)) at 200 using the symbolic derivative cas_check_deriv(1, 64, "differentiate sqrt(4*MPI^2 + x^2)/x * log((sqrt(4*MPI^2 + x^2) + x)/(2*MPI)) at 200 using the symbolic derivative", "((sqrt(((4 * ((138.039))^(2)) + (x)^(2))) / x) * log(((sqrt(((4 * ((138.039))^(2)) + (x)^(2))) + x) / (2 * (138.039)))))", "x", "200", cas_got_1, "cas_deriv_at") cas_check_summary() test "line 63: differentiate sqrt(4*MPI^2 + x^2)/x * log((sqrt(4*MPI^2 + x^2) + x)/(2*MPI)) at 200 agrees with the CAS, or the CAS has no closed form" { assert_true(cas_check_holds(0)) } test "line 64: differentiate sqrt(4*MPI^2 + x^2)/x * log((sqrt(4*MPI^2 + x^2) + x)/(2*MPI)) at 200 using the symbolic derivative agrees with the CAS, or the CAS has no closed form" { assert_true(cas_check_holds(1)) }