@@ -393,18 +393,34 @@ def test_z_n_d_n_positive(test_n):
393393 assert np .isclose (z_n_d (test_n ), expected )
394394
395395def test_Lambda_k_vectorized_m0_inf (a , precomputed_m_k_arr ):
396- """Test Lambda_k_vectorized returns ones when m0 is infinite ."""
396+ """Test Lambda_k_vectorized for infinite m0 ."""
397397 k_vals = np .array ([0 , 1 ])
398398 r_vals = np .array ([10.0 , 10.0 ])
399399 res = Lambda_k_vectorized (k_vals , r_vals , np .inf , a , precomputed_m_k_arr )
400- assert np .allclose (res , 1.0 )
400+
401+ # k=0 should be 1.0 (dummy value to avoid singularity)
402+ assert np .isclose (res [0 ], 1.0 )
403+
404+ # k=1 should correspond to the Bessel function logic
405+ # Lambda_k = (K0(mk*r)/K0(mk*a)) * exp(...)
406+ # Since r=10, a[2]=15 (outer), mk > 0, result should > 1 or < 1 depending on physics, but definitely NOT 1.0 identically unless r=a
407+ # Here r < a, so K0(r) > K0(a), so ratio > 1.
408+ # The previous faulty implementation returned 1.0 for all k.
409+ assert not np .isclose (res [1 ], 1.0 )
410+ assert np .isfinite (res [1 ])
401411
402412def test_diff_Lambda_k_vectorized_m0_inf (a , precomputed_m_k_arr ):
403- """Test diff_Lambda_k_vectorized returns ones when m0 is infinite ."""
413+ """Test diff_Lambda_k_vectorized for infinite m0 ."""
404414 k_vals = np .array ([0 , 1 ])
405415 r_vals = np .array ([10.0 , 10.0 ])
406416 res = diff_Lambda_k_vectorized (k_vals , r_vals , np .inf , a , precomputed_m_k_arr )
407- assert np .allclose (res , 1.0 )
417+
418+ # k=0 should be 1.0 (dummy value)
419+ assert np .isclose (res [0 ], 1.0 )
420+
421+ # k=1 should NOT be 1.0 (it's a derivative of Bessel functions)
422+ assert not np .isclose (res [1 ], 1.0 )
423+ assert np .isfinite (res [1 ])
408424
409425def test_make_R_Z_sharp (a , h , d ):
410426 """Test make_R_Z with sharp=True to ensure refinement points are added."""
0 commit comments