o
    g/                    @   s  d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	m
Z
mZ ddlmZ ddlmZmZ dd	lmZmZ dd
lmZ ddlmZmZmZmZmZmZmZmZmZ ddl m!Z!m"Z"m#Z# ddl$m%Z%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6m7Z7 ddl8m9Z9 edZ:edZ;e:re:j<=dd G dd dZ>G dd dZ?G dd dZ@G dd  d ZAG d!d" d"ZBG d#d$ d$ZCG d%d& d&ZDG d'd( d(ZEG d)d* d*ZFdS )+zFTests for the ``sympy.physics.biomechanics.characteristic.py`` module.    N)UnevaluatedExpr)Function)FloatInteger)Symbolsymbols)import_module)explog)coshsinh)sqrt)	CharacteristicCurveCollectionCharacteristicCurveFunction"FiberForceLengthActiveDeGroote2016#FiberForceLengthPassiveDeGroote2016*FiberForceLengthPassiveInverseDeGroote2016FiberForceVelocityDeGroote2016%FiberForceVelocityInverseDeGroote2016TendonForceLengthDeGroote2016$TendonForceLengthInverseDeGroote2016)C89CodePrinterC99CodePrinterC11CodePrinter)CXX98CodePrinterCXX11CodePrinterCXX17CodePrinter)FCodePrinter)LambdaPrinter)LatexPrinter)OctaveCodePrinter)CuPyPrinter
JaxPrinterNumPyPrinterSciPyPrinter)MpmathPrinterPythonCodePrinter)lambdifyjaxnumpyjax_enable_x64Tc                   @   s   e Zd Zeejdedfedfe	dfe
dfedfedfedfedfedfedfedfedfedfedfedfgdd ZdS )TestCharacteristicCurveFunctioncode_printer, expectedz(a + b)*(c + d)*(e + f)z      (a + b)*(c + d)*(e + f)z(a + b).*(c + d).*(e + f)c                 C   sb   G dd dt }td\}}}}}}|||}	|||}
|||}|  |	|
 | |ks/J d S )Nc                   @   s    e Zd Zedd Zdd ZdS )zUTestCharacteristicCurveFunction.test_print_code_parenthesize.<locals>.ExampleFunctionc                 S   s   d S N )clsabr.   r.   b/var/www/visachat/venv/lib/python3.10/site-packages/sympy/physics/biomechanics/tests/test_curve.pyevalM   s   zZTestCharacteristicCurveFunction.test_print_code_parenthesize.<locals>.ExampleFunction.evalc                 [   s   | j \}}|| S r-   )args)selfkwargsr0   r1   r.   r.   r2   doitQ   s   
zZTestCharacteristicCurveFunction.test_print_code_parenthesize.<locals>.ExampleFunction.doitN)__name__
__module____qualname__classmethodr3   r7   r.   r.   r.   r2   ExampleFunctionK   s    
r<   za, b, c, d, e, f)r   r   doprint)code_printerexpectedr<   r0   r1   cdeff1f2f3r.   r.   r2   test_print_code_parenthesize4   s   



 z<TestCharacteristicCurveFunction.test_print_code_parenthesizeN)r8   r9   r:   staticmethodpytestmarkparametrizer   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   rG   r.   r.   r.   r2   r+   2   s,    r+   c                   @   D  e Zd Zejdddd Zedd Zdd Zd	d
 Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zejded fed fed fed fed!fed!fed"fed#fed$fed%fe d%fe!d&fe"d'fe#d(fe$d$fgd)d* Z%d+d, Z&d-d. Z'ejj(e)d/u d0d1d2d3 Z*ejj(e+d/u d4d1d5d6 Z,d/S )7!TestTendonForceLengthDeGroote2016Tautousec                 C   L   t d| _t d| _t d| _t d| _t d| _| j| j| j| jf| _d S )N	l_T_tildec_0c_1c_2c_3)r   rQ   c0c1c2c3	constantsr5   r.   r.   r2   &_tendon_force_length_arguments_fixture^      




zHTestTendonForceLengthDeGroote2016._tendon_force_length_arguments_fixturec                   C   .   t ttsJ t ttsJ tjdksJ d S )Nr   )
issubclassr   r   r   r8   r.   r.   r.   r2   
test_classg      z,TestTendonForceLengthDeGroote2016.test_classc                 C   6   t | jg| jR  }t|t sJ t|dksJ d S )Nz<TendonForceLengthDeGroote2016(l_T_tilde, c_0, c_1, c_2, c_3))r   rQ   rZ   
isinstancestrr5   fl_Tr.   r.   r2   test_instancem      z/TestTendonForceLengthDeGroote2016.test_instancec                 C   sF   t | jg| jR   }|| jt| j| j| j   | j ks!J d S r-   )	r   rQ   rZ   r7   rV   r	   rY   rW   rX   re   r.   r.   r2   	test_doitr      .z+TestTendonForceLengthDeGroote2016.test_doitc                 C   sN   t | jg| jR  jdd}|| jt| jt| j| j   | j	 ks%J d S NFevaluate)
r   rQ   rZ   r7   rV   r	   rY   r   rW   rX   re   r.   r.   r2   test_doit_evaluate_falsev      2z:TestTendonForceLengthDeGroote2016.test_doit_evaluate_falsec                 C   J   t dt dt dt df}t| jg|R  }t| j}||ks#J d S N0.2z0.995z0.25z33.93669377311689)r   r   rQ   with_defaults)r5   rZ   fl_T_manualfl_T_constantsr.   r.   r2   test_with_defaultsz      z4TestTendonForceLengthDeGroote2016.test_with_defaultsc                 C   sT   t | jg| jR  }| j| j t| jt| j | j   }|| j|ks(J d S r-   	r   rQ   rZ   rV   rY   r	   r   rW   diffr5   rf   r?   r.   r.   r2    test_differentiate_wrt_l_T_tilde      (zBTestTendonForceLengthDeGroote2016.test_differentiate_wrt_l_T_tildec                 C   sH   t | jg| jR  }t| jt| j | j  }|| j|ks"J d S r-   )	r   rQ   rZ   r	   rY   r   rW   ry   rV   rz   r.   r.   r2   test_differentiate_wrt_c0   s   z;TestTendonForceLengthDeGroote2016.test_differentiate_wrt_c0c                 C   sT   t | jg| jR  }| j | j t| jt| j| j   }|| j|ks(J d S r-   rx   rz   r.   r.   r2   test_differentiate_wrt_c1   r|   z;TestTendonForceLengthDeGroote2016.test_differentiate_wrt_c1c                 C   4   t | jg| jR  }td}|| j|ksJ d S N)r   rQ   rZ   r   ry   rX   rz   r.   r.   r2   test_differentiate_wrt_c2      z;TestTendonForceLengthDeGroote2016.test_differentiate_wrt_c2c                 C   sX   t | jg| jR  }| j| j| j  t| jt| j| j   }|| j|ks*J d S r-   )	r   rQ   rZ   rV   rW   r	   rY   r   ry   rz   r.   r.   r2   test_differentiate_wrt_c3   s   ,z;TestTendonForceLengthDeGroote2016.test_differentiate_wrt_c3c                 C   (   t | jg| jR  }| tu sJ d S r-   )r   rQ   rZ   inverser   re   r.   r.   r2   test_inverse      z.TestTendonForceLengthDeGroote2016.test_inversec                 C   0   t | jg| jR  }d}t ||ksJ d S )Nz.\operatorname{fl}^T \left( l_{T tilde} \right))r   rQ   rZ   r   r=   rz   r.   r.   r2   test_function_print_latex      z;TestTendonForceLengthDeGroote2016.test_function_print_latexc                 C   4   t | jg| jR  }d}t | |ksJ d S )Nz:c_{0} e^{c_{3} \left(- c_{1} + l_{T tilde}\right)} - c_{2})r   rQ   rZ   r   r=   r7   rz   r.   r.   r2   test_expression_print_latex      z=TestTendonForceLengthDeGroote2016.test_expression_print_latexr,   zH(-0.25 + 0.20000000000000001*exp(33.93669377311689*(l_T_tilde - 0.995)))zM(-0.25 + 0.20000000000000001*std::exp(33.93669377311689*(l_T_tilde - 0.995)))zF      (-0.25d0 + 0.2d0*exp(33.93669377311689d0*(l_T_tilde - 0.995d0)))z8(-0.25 + 0.2*exp(33.93669377311689*(l_T_tilde - 0.995)))z=(-0.25 + 0.2*math.exp(33.93669377311689*(l_T_tilde - 0.995)))z>(-0.25 + 0.2*numpy.exp(33.93669377311689*(l_T_tilde - 0.995)))z=(-0.25 + 0.2*cupy.exp(33.93669377311689*(l_T_tilde - 0.995)))zB(-0.25 + 0.2*jax.numpy.exp(33.93669377311689*(l_T_tilde - 0.995)))z(mpmath.mpf((1, 1, -2, 1)) + mpmath.mpf((0, 3602879701896397, -54, 52))*mpmath.exp(mpmath.mpf((0, 9552330089424741, -48, 54))*(l_T_tilde + mpmath.mpf((1, 8962163258467287, -53, 53)))))c                 C   $   t | j}| ||ksJ d S r-   )r   rs   rQ   r=   )r5   r>   r?   rf   r.   r.   r2   test_print_code      Dz1TestTendonForceLengthDeGroote2016.test_print_codec                 C   4   t | j}|| j}d}t ||ksJ d S )NzA6.787338754623378*math.exp(33.93669377311689*(l_T_tilde - 0.995)))r   rs   rQ   ry   r&   r=   )r5   rf   dfl_T_dl_T_tilder?   r.   r.   r2   test_derivative_print_code      z<TestTendonForceLengthDeGroote2016.test_derivative_print_codec                 C   2   t | j}t| j|}|dtdksJ d S )N      ?g A)r   rs   rQ   r'   rI   approx)r5   rf   fl_T_callabler.   r.   r2   test_lambdify      z/TestTendonForceLengthDeGroote2016.test_lambdifyNNumPy not installedreasonc                 C   L   t | j}t| j|d}tg d}tg d}tj||| d S )Nr)   gffffff?r   )\(??gOpʿg Agg.?gY估?)r   rs   rQ   r'   r)   arraytestingassert_allcloser5   rf   r   rQ   r?   r.   r.   r2   test_lambdify_numpy   
   z5TestTendonForceLengthDeGroote2016.test_lambdify_numpyJAX not installedc                 C   V   t | j}tt| j|d}tjg d}tjg d}tj	||| d S )Nr(   r   r   )
r   rs   rQ   r(   jitr'   r)   r   r   r   r   r.   r.   r2   test_lambdify_jax  
   z3TestTendonForceLengthDeGroote2016.test_lambdify_jax)-r8   r9   r:   rI   fixturer\   rH   r`   rg   ri   rn   rv   r{   r}   r~   r   r   r   r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   skipifr)   r   r(   r   r.   r.   r.   r2   rM   \   s    



C
rM   c                   @   rL   )7(TestTendonForceLengthInverseDeGroote2016TrN   c                 C   rP   )Nrf   rR   rS   rT   rU   )r   rf   rV   rW   rX   rY   rZ   r[   r.   r.   r2   ._tendon_force_length_inverse_arguments_fixture  r]   zWTestTendonForceLengthInverseDeGroote2016._tendon_force_length_inverse_arguments_fixturec                   C   r^   )Nr   )r_   r   r   r   r8   r.   r.   r.   r2   r`   $  ra   z3TestTendonForceLengthInverseDeGroote2016.test_classc                 C   rb   )Nz>TendonForceLengthInverseDeGroote2016(fl_T, c_0, c_1, c_2, c_3))r   rf   rZ   rc   rd   r5   fl_T_invr.   r.   r2   rg   *  rh   z6TestTendonForceLengthInverseDeGroote2016.test_instancec                 C   sF   t | jg| jR   }|t| j| j | j | j | j ks!J d S r-   )	r   rf   rZ   r7   r
   rX   rV   rY   rW   r   r.   r.   r2   ri   /  rj   z2TestTendonForceLengthInverseDeGroote2016.test_doitc                 C   sN   t | jg| jR  jdd}|tt| j| j | j | j | j	 ks%J d S rk   )
r   rf   rZ   r7   r
   r   rX   rV   rY   rW   r   r.   r.   r2   rn   3  ro   zATestTendonForceLengthInverseDeGroote2016.test_doit_evaluate_falsec                 C   rp   rq   )r   r   rf   rs   )r5   rZ   fl_T_inv_manualfl_T_inv_constantsr.   r.   r2   rv   7  rw   z;TestTendonForceLengthInverseDeGroote2016.test_with_defaultsc                 C   sB   t | jg| jR  }d| j| j| j   }|| j|ksJ d S N   r   rf   rZ   rY   rX   ry   r5   r   r?   r.   r.   r2   test_differentiate_wrt_fl_TB     zDTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_fl_Tc                 C   s<   t | jg| jR  }d| j| j  }|| j|ksJ d S r   )r   rf   rZ   rV   rY   ry   r   r.   r.   r2   r}   G  s   zBTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_c0c                 C   r   r   )r   rf   rZ   r   ry   rW   r   r.   r.   r2   r~   L  r   zBTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_c1c                 C   sB   t | jg| jR  }d| j| j| j   }|| j|ksJ d S r   r   r   r.   r.   r2   r   Q  r   zBTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_c2c                 C   sR   t | jg| jR  }tt| j| j | j  | jd  }|| j|ks'J d S N   )	r   rf   rZ   r
   r   rX   rV   rY   ry   r   r.   r.   r2   r   V     &zBTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_c3c                 C   r   r-   )r   rf   rZ   r   r   r   r.   r.   r2   r   [  r   z5TestTendonForceLengthInverseDeGroote2016.test_inversec                 C   r   )Nz=\left( \operatorname{fl}^T \right)^{-1} \left( fl_{T} \right))r   rf   rZ   r   r=   r   r.   r.   r2   r   _  r   zBTestTendonForceLengthInverseDeGroote2016.test_function_print_latexc                 C   r   )NzFc_{1} + \frac{\log{\left(\frac{c_{2} + fl_{T}}{c_{0}} \right)}}{c_{3}})r   rf   rZ   r   r=   r7   rz   r.   r.   r2   r   d  r   zDTestTendonForceLengthInverseDeGroote2016.test_expression_print_latexr,   z3(0.995 + 0.029466630034306838*log(5.0*fl_T + 1.25))z8(0.995 + 0.029466630034306838*std::log(5.0*fl_T + 1.25))z@      (0.995d0 + 0.02946663003430684d0*log(5.0d0*fl_T + 1.25d0))z2(0.995 + 0.02946663003430684*log(5.0*fl_T + 1.25))z7(0.995 + 0.02946663003430684*math.log(5.0*fl_T + 1.25))z8(0.995 + 0.02946663003430684*numpy.log(5.0*fl_T + 1.25))z7(0.995 + 0.02946663003430684*cupy.log(5.0*fl_T + 1.25))z<(0.995 + 0.02946663003430684*jax.numpy.log(5.0*fl_T + 1.25))z(mpmath.mpf((0, 8962163258467287, -53, 53)) + mpmath.mpf((0, 33972711434846347, -60, 55))*mpmath.log(mpmath.mpf((0, 5, 0, 3))*fl_T + mpmath.mpf((0, 5, -2, 3))))c                 C   r   r-   )r   rs   rf   r=   )r5   r>   r?   r   r.   r.   r2   r   i  r   z8TestTendonForceLengthInverseDeGroote2016.test_print_codec                 C   r   )Nz.1/(33.93669377311689*fl_T + 8.484173443279222))r   rs   rf   ry   r&   r=   )r5   r   dfl_T_inv_dfl_Tr?   r.   r.   r2   r     r   zCTestTendonForceLengthInverseDeGroote2016.test_derivative_print_codec                 C   r   )N        mIs?)r   rs   rf   r'   rI   r   )r5   r   fl_T_inv_callabler.   r.   r2   r     r   z6TestTendonForceLengthInverseDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   gɿ{Gzr   r   gRQ?r   gPgf?g}?r   gyl?g­?gp?)r   rs   rf   r'   r)   r   r   r   r5   r   r   rf   r?   r.   r.   r2   r     
   z<TestTendonForceLengthInverseDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r   r   )
r   rs   rf   r(   r   r'   r)   r   r   r   r   r.   r.   r2   r     
   z:TestTendonForceLengthInverseDeGroote2016.test_lambdify_jax)-r8   r9   r:   rI   r   r   rH   r`   rg   ri   rn   rv   r   r}   r~   r   r   r   r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   r   r)   r   r(   r   r.   r.   r.   r2   r     s    



C
r   c                   @   4  e Zd Zejdddd Zedd Zdd Zd	d
 Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zejdedfedfedfedfedfedfedfedfed fed!fed!fed"fe d#fe!d$fe"d fgd%d& Z#d'd( Z$d)d* Z%ejj&e'd+u d,d-d.d/ Z(ejj&e)d+u d0d-d1d2 Z*d+S )3'TestFiberForceLengthPassiveDeGroote2016TrN   c                 C   0   t d| _t d| _t d| _| j| jf| _d S )N	l_M_tilderR   rS   )r   r   rV   rW   rZ   r[   r.   r.   r2   -_fiber_force_length_passive_arguments_fixture     


zUTestFiberForceLengthPassiveDeGroote2016._fiber_force_length_passive_arguments_fixturec                   C   r^   )Nr   )r_   r   r   r   r8   r.   r.   r.   r2   r`     ra   z2TestFiberForceLengthPassiveDeGroote2016.test_classc                 C   rb   )Nz8FiberForceLengthPassiveDeGroote2016(l_M_tilde, c_0, c_1))r   r   rZ   rc   rd   r5   fl_M_pasr.   r.   r2   rg     rh   z5TestFiberForceLengthPassiveDeGroote2016.test_instancec                 C   sP   t | jg| jR   }|t| j| jd  | j d t| jd  ks&J d S r   )r   r   rZ   r7   r	   rW   rV   r   r.   r.   r2   ri        8z1TestFiberForceLengthPassiveDeGroote2016.test_doitc                 C   sX   t | jg| jR  jdd}|t| jt| jd  | j d t| jd  ks*J d S NFrl   r   )r   r   rZ   r7   r	   rW   r   rV   r   r.   r.   r2   rn        <z@TestFiberForceLengthPassiveDeGroote2016.test_doit_evaluate_falsec                 C   >   t dt df}t| jg|R  }t| j}||ksJ d S Nz0.6z4.0)r   r   r   rs   )r5   rZ   fl_M_pas_manualfl_M_pas_constantsr.   r.   r2   rv        z:TestFiberForceLengthPassiveDeGroote2016.test_with_defaultsc                 C   sd   t | jg| jR  }| jt| jt| jd  | j  | jt| jd   }|| j|ks0J d S r   r   r   rZ   rW   r	   r   rV   ry   r5   r   r?   r.   r.   r2    test_differentiate_wrt_l_M_tilde  s   8zHTestFiberForceLengthPassiveDeGroote2016.test_differentiate_wrt_l_M_tildec                 C   sx   t | jg| jR  }| j t| jt| jd  | j  t| jd  | jd t| jd   }|| j|ks:J d S Nr   r   r   r   r.   r.   r2   r}     s   $zATestFiberForceLengthPassiveDeGroote2016.test_differentiate_wrt_c0c                 C   s   t | jg| jR  }t| j dt| jt| jd  | j   t| jd d  t| jt| jd  | j | jd  | jt| jd    }|| j|ksRJ d S )Nr   r   r   )r   r   rZ   r	   rW   r   rV   ry   r   r.   r.   r2   r~     s   >:zATestFiberForceLengthPassiveDeGroote2016.test_differentiate_wrt_c1c                 C   r   r-   )r   r   rZ   r   r   r   r.   r.   r2   r     r   z4TestFiberForceLengthPassiveDeGroote2016.test_inversec                 C   r   )Nz4\operatorname{fl}^M_{pas} \left( l_{M tilde} \right))r   r   rZ   r   r=   r   r.   r.   r2   r     r   zATestFiberForceLengthPassiveDeGroote2016.test_function_print_latexc                 C   r   )NzN\frac{e^{\frac{c_{1} \left(l_{M tilde} - 1\right)}{c_{0}}} - 1}{e^{c_{1}} - 1})r   r   rZ   r   r=   r7   r   r.   r.   r2   r     r   zCTestFiberForceLengthPassiveDeGroote2016.test_expression_print_latexr,   zC(0.01865736036377405*(-1 + exp(6.666666666666667*(l_M_tilde - 1))))zH(0.01865736036377405*(-1 + std::exp(6.666666666666667*(l_M_tilde - 1))))zT      (0.0186573603637741d0*(-1 + exp(6.666666666666667d0*(l_M_tilde - 1
     @ ))))zA(0.0186573603637741*(-1 + exp(6.66666666666667*(l_M_tilde - 1))))zF(0.0186573603637741*(-1 + math.exp(6.66666666666667*(l_M_tilde - 1))))zG(0.0186573603637741*(-1 + numpy.exp(6.66666666666667*(l_M_tilde - 1))))zF(0.0186573603637741*(-1 + cupy.exp(6.66666666666667*(l_M_tilde - 1))))zK(0.0186573603637741*(-1 + jax.numpy.exp(6.66666666666667*(l_M_tilde - 1))))zy(mpmath.mpf((0, 672202249456079, -55, 50))*(-1 + mpmath.exp(mpmath.mpf((0, 7505999378950827, -50, 53))*(l_M_tilde - 1))))c                 C   r   r-   )r   rs   r   r=   )r5   r>   r?   r   r.   r.   r2   r   "  r   z7TestFiberForceLengthPassiveDeGroote2016.test_print_codec                 C   r   )Nz;0.12438240242516*math.exp(6.66666666666667*(l_M_tilde - 1)))r   rs   r   ry   r&   r=   )r5   r   fl_M_pas_dl_M_tilder?   r.   r.   r2   r   i  r   zBTestFiberForceLengthPassiveDeGroote2016.test_derivative_print_codec                 C   r   )Nr   r   )r   rs   r   r'   rI   r   )r5   r   fl_M_pas_callabler.   r.   r2   r   o  r   z5TestFiberForceLengthPassiveDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)         ?皙??r   皙?333333?      ?g1olgx#^#ggΫr   g4],eI?g-˯?gO#?)r   rs   r   r'   r)   r   r   r   r5   r   r   r   r?   r.   r.   r2   r   t  s
   	z;TestFiberForceLengthPassiveDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r   r   )
r   rs   r   r(   r   r'   r)   r   r   r   r   r.   r.   r2   r     s
   	z9TestFiberForceLengthPassiveDeGroote2016.test_lambdify_jax)+r8   r9   r:   rI   r   r   rH   r`   rg   ri   rn   rv   r   r}   r~   r   r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   r   r)   r   r(   r   r.   r.   r.   r2   r     s    


	
C
r   c                   @   r   )3.TestFiberForceLengthPassiveInverseDeGroote2016TrN   c                 C   r   )Nr   rR   rS   )r   r   rV   rW   rZ   r[   r.   r.   r2   r     r   z\TestFiberForceLengthPassiveInverseDeGroote2016._fiber_force_length_passive_arguments_fixturec                   C   r^   )Nr   )r_   r   r   r   r8   r.   r.   r.   r2   r`     ra   z9TestFiberForceLengthPassiveInverseDeGroote2016.test_classc                 C   rb   )Nz>FiberForceLengthPassiveInverseDeGroote2016(fl_M_pas, c_0, c_1))r   r   rZ   rc   rd   r5   fl_M_pas_invr.   r.   r2   rg     rh   z<TestFiberForceLengthPassiveInverseDeGroote2016.test_instancec                 C   sP   t | jg| jR   }|| jt| jt| jd  d  | j d ks&J d S r   )r   r   rZ   r7   rV   r
   r	   rW   r   r.   r.   r2   ri     r   z8TestFiberForceLengthPassiveInverseDeGroote2016.test_doitc                 C   sX   t | jg| jR  jdd}|| jtt| jt| jd  d  | j d ks*J d S r   )	r   r   rZ   r7   rV   r
   r   r	   rW   r   r.   r.   r2   rn     r   zGTestFiberForceLengthPassiveInverseDeGroote2016.test_doit_evaluate_falsec                 C   r   r   )r   r   r   rs   )r5   rZ   fl_M_pas_inv_manualfl_M_pas_inv_constantsr.   r.   r2   rv     r   zATestFiberForceLengthPassiveInverseDeGroote2016.test_with_defaultsc                 C   s^   t | jg| jR  }| jt| jd  | j| jt| jd  d   }|| j|ks-J d S r   )r   r   rZ   rV   r	   rW   ry   r5   r   r?   r.   r.   r2   r        2zJTestFiberForceLengthPassiveInverseDeGroote2016.test_differentiate_wrt_fl_Tc                 C   sN   t | jg| jR  }t| jt| jd  d | j }|| j|ks%J d S r   )r   r   rZ   r
   r	   rW   ry   rV   r   r.   r.   r2   r}        "zHTestFiberForceLengthPassiveInverseDeGroote2016.test_differentiate_wrt_c0c                 C   s   t | jg| jR  }| j| j t| j | j| jt| jd  d   | jt| jt| jd  d  | jd   }|| j|ksDJ d S r   )r   r   rZ   rV   r	   rW   r
   ry   r   r.   r.   r2   r~     s   2*zHTestFiberForceLengthPassiveInverseDeGroote2016.test_differentiate_wrt_c1c                 C   r   r-   )r   r   rZ   r   r   r   r.   r.   r2   r     r   z;TestFiberForceLengthPassiveInverseDeGroote2016.test_inversec                 C   r   )NzG\left( \operatorname{fl}^M_{pas} \right)^{-1} \left( fl_{M pas} \right))r   r   rZ   r   r=   r   r.   r.   r2   r     r   zHTestFiberForceLengthPassiveInverseDeGroote2016.test_function_print_latexc                 C   r   )NzU\frac{c_{0} \log{\left(fl_{M pas} \left(e^{c_{1}} - 1\right) + 1 \right)}}{c_{1}} + 1)r   r   rZ   r   r=   r7   rz   r.   r.   r2   r     r   zJTestFiberForceLengthPassiveInverseDeGroote2016.test_expression_print_latexr,   z>(1 + 0.14999999999999999*log(1 + 53.598150033144236*fl_M_pas))zC(1 + 0.14999999999999999*std::log(1 + 53.598150033144236*fl_M_pas))z;      (1 + 0.15d0*log(1.0d0 + 53.5981500331442d0*fl_M_pas))z-(1 + 0.15*log(1 + 53.5981500331442*fl_M_pas))z2(1 + 0.15*math.log(1 + 53.5981500331442*fl_M_pas))z3(1 + 0.15*numpy.log(1 + 53.5981500331442*fl_M_pas))z2(1 + 0.15*cupy.log(1 + 53.5981500331442*fl_M_pas))z7(1 + 0.15*jax.numpy.log(1 + 53.5981500331442*fl_M_pas))zs(1 + mpmath.mpf((0, 5404319552844595, -55, 53))*mpmath.log(1 + mpmath.mpf((0, 942908627019595, -44, 50))*fl_M_pas))c                 C   r   r-   )r   rs   r   r=   )r5   r>   r?   r   r.   r.   r2   r     s   Cz>TestFiberForceLengthPassiveInverseDeGroote2016.test_print_codec                 C   r   )Nz232.1588900198865/(214.392600132577*fl_M_pas + 4.0))r   rs   r   ry   r&   r=   )r5   r   dfl_M_pas_inv_dfl_Tr?   r.   r.   r2   r      r   zITestFiberForceLengthPassiveInverseDeGroote2016.test_derivative_print_codec                 C   r   )Nr   r   )r   rs   r   r'   rI   r   )r5   r   fl_M_pas_inv_callabler.   r.   r2   r   &  r   z<TestFiberForceLengthPassiveInverseDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   r   r   g{Gz?g{Gz?g?g?gL}P?r   g>7?g,5?gx~ ?ghlp?)r   rs   r   r'   r)   r   r   r   r5   r   r   r   r?   r.   r.   r2   r   +  r   zBTestFiberForceLengthPassiveInverseDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r   r   )
r   rs   r   r(   r   r'   r)   r   r   r   r   r.   r.   r2   r   :  r   z@TestFiberForceLengthPassiveInverseDeGroote2016.test_lambdify_jax)+r8   r9   r:   rI   r   r   rH   r`   rg   ri   rn   rv   r   r}   r~   r   r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   r   r)   r   r(   r   r.   r.   r.   r2   r     s    


	
B
r   c                   @   s|  e Zd Zejdddd Zedd Zdd Zd	d
 Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zejd-ed.fed.fed.fe d/fe!d0fe"d0fe#d1fe$d2fe%d3fe&d4fe'd4fe(d5fe)d6fe*d7fe+d3fgd8d9 Z,d:d; Z-d<d= Z.ejj/e0d>u d?d@dAdB Z1ejj/e2d>u dCd@dDdE Z3d>S )F&TestFiberForceLengthActiveDeGroote2016TrN   c                 C   s   t d| _t d| _t d| _t d| _t d| _t d| _t d| _t d| _t d	| _	t d
| _
t d| _t d| _t d| _| j| j| j| j| j| j| j| j	| j
| j| j| jf| _d S )Nr   rR   rS   rT   rU   c_4c_5c_6c_7c_8c_9c_10c_11)r   r   rV   rW   rX   rY   c4c5c6c7c8c9c10c11rZ   r[   r.   r.   r2   ,_fiber_force_length_active_arguments_fixtureL  s    













zSTestFiberForceLengthActiveDeGroote2016._fiber_force_length_active_arguments_fixturec                   C   r^   )Nr   )r_   r   r   r   r8   r.   r.   r.   r2   r`   `  ra   z1TestFiberForceLengthActiveDeGroote2016.test_classc                 C   rb   )NzkFiberForceLengthActiveDeGroote2016(l_M_tilde, c_0, c_1, c_2, c_3, c_4, c_5, c_6, c_7, c_8, c_9, c_10, c_11))r   r   rZ   rc   rd   r5   fl_M_actr.   r.   r2   rg   f  s
   z4TestFiberForceLengthActiveDeGroote2016.test_instancec                 C   s   t | jg| jR   }|| jt| j| j | j| j| j   d  d  | j	t| j| j
 | j| j| j   d  d   | jt| j| j | j| j| j   d  d   ks[J d S r   )r   r   rZ   r7   rV   r	   rW   rX   rY   r   r   r  r  r  r  r  r  r  r.   r.   r2   ri   n  s   000z0TestFiberForceLengthActiveDeGroote2016.test_doitc                 C   s   t | jg| jR  jdd}|| jtt| j| j | j| j	| j   d  d  | j
tt| j| j | j| j| j   d  d   | jtt| j| j | j| j| j   d  d   kscJ d S )NFrl   r   )r   r   rZ   r7   rV   r	   r   rW   rX   rY   r   r   r  r  r  r  r  r  r  r.   r.   r2   rn   v  s   444z?TestFiberForceLengthActiveDeGroote2016.test_doit_evaluate_falsec                 C   sz   t dt dt dt dt dt dt dt dt d	t d
t dt df}t| jg|R  }t| j}||ks;J d S )Nz0.814z1.06z0.162z0.0633z0.433z0.717z-0.0299rr   z0.1z1.0z0.354z0.0)r   r   r   rs   )r5   rZ   fl_M_act_manualfl_M_act_constantsr.   r.   r2   rv   ~  s    z9TestFiberForceLengthActiveDeGroote2016.test_with_defaultsc                 C   s  t | jg| jR  }| j| j| j| j d  | j| j| j  d  | j| j | j| j| j  d    t| j| j d  d| j| j| j  d    | j| j	| j| j
 d  | j| j	| j  d  | j
| j | j| j	| j  d    t| j| j
 d  d| j| j	| j  d     | j| j| j| j d  | j| j| j  d  | j| j | j| j| j  d    t| j| j d  d| j| j| j  d     }|| j|ksJ d S Nr      )r   r   rZ   rV   rY   rW   rX   r	   r   r  r   r  r  r  r  r  ry   r5   r	  r?   r.   r.   r2   r     s4   * .* .* .zGTestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_l_M_tildec                 C   s`   t | jg| jR  }t| j| j d  d| j| j| j  d   }| | j	|ks.J d S r   )
r   r   rZ   r	   rW   rX   rY   r7   ry   rV   r  r.   r.   r2   r}     s   0z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c0c                 C      t | jg| jR  }| j| j| j  | j| j| j  d  t| j| j d  d| j| j| j  d    }|| j|ks@J d S r   	r   r   rZ   rV   rW   rX   rY   r	   ry   r  r.   r.   r2   r~        &.z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c1c                 C      t | jg| jR  }| j| j| j d  | j| j| j  d  t| j| j d  d| j| j| j  d    }|| j|ksBJ d S r  r  r  r.   r.   r2   r        *.z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c2c                 C      t | jg| jR  }| j| j | j| j d  | j| j| j  d  t| j| j d  d| j| j| j  d    }|| j|ksEJ d S r  r  r  r.   r.   r2   r        0.z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c3c                 C   \   t | jg| jR  }t| j| j d  d| j| j| j  d   }|| j|ks,J d S r   )	r   r   rZ   r	   r   r  r  ry   r   r  r.   r.   r2   test_differentiate_wrt_c4     0z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c4c                 C   r  r   	r   r   rZ   r   r   r  r  r	   ry   r  r.   r.   r2   test_differentiate_wrt_c5  r  z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c5c                 C   r  r  r  r  r.   r.   r2   test_differentiate_wrt_c6  r  z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c6c                 C   r  r  r  r  r.   r.   r2   test_differentiate_wrt_c7  r  z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c7c                 C   r  r   )	r   r   rZ   r	   r  r  r  ry   r  r  r.   r.   r2   test_differentiate_wrt_c8  r  z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c8c                 C   r  r   	r   r   rZ   r  r  r  r  r	   ry   r  r.   r.   r2   test_differentiate_wrt_c9  r  z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c9c                 C   r  r  r  r  r.   r.   r2   test_differentiate_wrt_c10  r  zATestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c10c                 C   r  r  r  r  r.   r.   r2   test_differentiate_wrt_c11  r  zATestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c11c                 C   r   )Nz4\operatorname{fl}^M_{act} \left( l_{M tilde} \right))r   r   rZ   r   r=   r  r.   r.   r2   r     r   z@TestFiberForceLengthActiveDeGroote2016.test_function_print_latexc                 C   r   )Na=  c_{0} e^{- \frac{\left(- c_{1} + l_{M tilde}\right)^{2}}{2 \left(c_{2} + c_{3} l_{M tilde}\right)^{2}}} + c_{4} e^{- \frac{\left(- c_{5} + l_{M tilde}\right)^{2}}{2 \left(c_{6} + c_{7} l_{M tilde}\right)^{2}}} + c_{8} e^{- \frac{\left(- c_{9} + l_{M tilde}\right)^{2}}{2 \left(c_{10} + c_{11} l_{M tilde}\right)^{2}}})r   r   rZ   r   r=   r7   r  r.   r.   r2   r     s   zBTestFiberForceLengthActiveDeGroote2016.test_expression_print_latexr,   a7  (0.81399999999999995*exp(-19.051973784484073*pow(l_M_tilde - 1.0600000000000001, 2)/pow(0.39074074074074072*l_M_tilde + 1, 2)) + 0.433*exp(-12.499999999999998*pow(l_M_tilde - 0.71699999999999997, 2)/pow(l_M_tilde - 0.14949999999999999, 2)) + 0.10000000000000001*exp(-3.9899134986753491*pow(l_M_tilde - 1.0, 2)))aP  (0.81399999999999995*exp(-19.051973784484073*std::pow(l_M_tilde - 1.0600000000000001, 2)/std::pow(0.39074074074074072*l_M_tilde + 1, 2)) + 0.433*exp(-12.499999999999998*std::pow(l_M_tilde - 0.71699999999999997, 2)/std::pow(l_M_tilde - 0.14949999999999999, 2)) + 0.10000000000000001*exp(-3.9899134986753491*std::pow(l_M_tilde - 1.0, 2)))a_  (0.81399999999999995*std::exp(-19.051973784484073*std::pow(l_M_tilde - 1.0600000000000001, 2)/std::pow(0.39074074074074072*l_M_tilde + 1, 2)) + 0.433*std::exp(-12.499999999999998*std::pow(l_M_tilde - 0.71699999999999997, 2)/std::pow(l_M_tilde - 0.14949999999999999, 2)) + 0.10000000000000001*std::exp(-3.9899134986753491*std::pow(l_M_tilde - 1.0, 2)))a-        (0.814d0*exp(-19.051973784484073d0*(l_M_tilde - 1.06d0)**2/(
     @ 0.39074074074074072d0*l_M_tilde + 1.0d0)**2) + 0.433d0*exp(
     @ -12.499999999999998d0*(l_M_tilde - 0.717d0)**2/(l_M_tilde -
     @ 0.14949999999999999d0)**2) + 0.1d0*exp(-3.9899134986753491d0*(
     @ l_M_tilde - 1.0d0)**2))z(0.814*exp(-19.0519737844841*(l_M_tilde - 1.06).^2./(0.390740740740741*l_M_tilde + 1).^2) + 0.433*exp(-12.5*(l_M_tilde - 0.717).^2./(l_M_tilde - 0.1495).^2) + 0.1*exp(-3.98991349867535*(l_M_tilde - 1.0).^2))z(0.814*math.exp(-19.0519737844841*(l_M_tilde - 1.06)**2/(0.390740740740741*l_M_tilde + 1)**2) + 0.433*math.exp(-12.5*(l_M_tilde - 0.717)**2/(l_M_tilde - 0.1495)**2) + 0.1*math.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))z(0.814*numpy.exp(-19.0519737844841*(l_M_tilde - 1.06)**2/(0.390740740740741*l_M_tilde + 1)**2) + 0.433*numpy.exp(-12.5*(l_M_tilde - 0.717)**2/(l_M_tilde - 0.1495)**2) + 0.1*numpy.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))z(0.814*cupy.exp(-19.0519737844841*(l_M_tilde - 1.06)**2/(0.390740740740741*l_M_tilde + 1)**2) + 0.433*cupy.exp(-12.5*(l_M_tilde - 0.717)**2/(l_M_tilde - 0.1495)**2) + 0.1*cupy.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))z(0.814*jax.numpy.exp(-19.0519737844841*(l_M_tilde - 1.06)**2/(0.390740740740741*l_M_tilde + 1)**2) + 0.433*jax.numpy.exp(-12.5*(l_M_tilde - 0.717)**2/(l_M_tilde - 0.1495)**2) + 0.1*jax.numpy.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))aJ  (mpmath.mpf((0, 7331860193359167, -53, 53))*mpmath.exp(-mpmath.mpf((0, 5362653877279683, -48, 53))*(l_M_tilde + mpmath.mpf((1, 2386907802506363, -51, 52)))**2/(mpmath.mpf((0, 3519479708796943, -53, 52))*l_M_tilde + 1)**2) + mpmath.mpf((0, 7800234554605699, -54, 53))*mpmath.exp(-mpmath.mpf((0, 7036874417766399, -49, 53))*(l_M_tilde + mpmath.mpf((1, 6458161865649291, -53, 53)))**2/(l_M_tilde + mpmath.mpf((1, 5386305154335113, -55, 53)))**2) + mpmath.mpf((0, 3602879701896397, -55, 52))*mpmath.exp(-mpmath.mpf((0, 8984486472937407, -51, 53))*(l_M_tilde + mpmath.mpf((1, 1, 0, 1)))**2))c                 C   r   r-   )r   rs   r   r=   )r5   r>   r?   r	  r.   r.   r2   r     s    5z6TestFiberForceLengthActiveDeGroote2016.test_print_codec                 C   r   )Na  (0.79798269973507 - 0.79798269973507*l_M_tilde)*math.exp(-3.98991349867535*(l_M_tilde - 1.0)**2) + (10.825*(0.717 - l_M_tilde)/(l_M_tilde - 0.1495)**2 + 10.825*(l_M_tilde - 0.717)**2/(l_M_tilde - 0.1495)**3)*math.exp(-12.5*(l_M_tilde - 0.717)**2/(l_M_tilde - 0.1495)**2) + (31.0166133211401*(1.06 - l_M_tilde)/(0.390740740740741*l_M_tilde + 1)**2 + 13.6174190361677*(0.943396226415094*l_M_tilde - 1)**2/(0.390740740740741*l_M_tilde + 1)**3)*math.exp(-21.4067977442463*(0.943396226415094*l_M_tilde - 1)**2/(0.390740740740741*l_M_tilde + 1)**2))r   rs   r   ry   r&   r=   )r5   r	  fl_M_act_dl_M_tilder?   r.   r.   r2   r     s
   zATestFiberForceLengthActiveDeGroote2016.test_derivative_print_codec                 C   r   )Nr   s?)r   rs   r   r'   rI   r   )r5   r	  fl_M_act_callabler.   r.   r2   r     r   z4TestFiberForceLengthActiveDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   r   r   r   r   g       @g	> P^?g]Q?r#  g)`?gߌ'|?)r   rs   r   r'   r)   r   r   r   r5   r	  r$  r   r?   r.   r.   r2   r     
   z:TestFiberForceLengthActiveDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r%  r&  )
r   rs   r   r(   r   r'   r)   r   r   r   r'  r.   r.   r2   r     
   z8TestFiberForceLengthActiveDeGroote2016.test_lambdify_jax)4r8   r9   r:   rI   r   r  rH   r`   rg   ri   rn   rv   r   r}   r~   r   r   r  r  r  r  r  r  r   r!  r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   r   r)   r   r(   r   r.   r.   r.   r2   r   J  s    


	  
4
r   c                   @   sD  e Zd Zejdddd Zedd Zdd Zd	d
 Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zejded fed fed fed!fed"fed"fed#fed$fed%fed&fe d&fe!d'fe"d(fe#d)fe$d*fgd+d, Z%d-d. Z&d/d0 Z'ejj(e)d1u d2d3d4d5 Z*ejj(e+d1u d6d3d7d8 Z,d1S )9"TestFiberForceVelocityDeGroote2016TrN   c                 C   rP   )N	v_M_tilderR   rS   rT   rU   )r   r+  rV   rW   rX   rY   rZ   r[   r.   r.   r2   ._muscle_fiber_force_velocity_arguments_fixture  r]   zQTestFiberForceVelocityDeGroote2016._muscle_fiber_force_velocity_arguments_fixturec                   C   r^   )Nr   )r_   r   r   r   r8   r.   r.   r.   r2   r`     ra   z-TestFiberForceVelocityDeGroote2016.test_classc                 C   rb   )Nz=FiberForceVelocityDeGroote2016(v_M_tilde, c_0, c_1, c_2, c_3))r   r+  rZ   rc   rd   r5   fv_Mr.   r.   r2   rg     rh   z0TestFiberForceVelocityDeGroote2016.test_instancec                 C   sh   t | jg| jR   }| jt| j| j | j t| j| j | j d d   | j	 }||ks2J d S Nr   r   )
r   r+  rZ   r7   rV   r
   rW   rX   r   rY   r5   r.  r?   r.   r.   r2   ri     s   z,TestFiberForceVelocityDeGroote2016.test_doitc                 C   sp   t | jg| jR  jdd}| jt| j| j | j tt	| j| j | j d d   | j
 }||ks6J d S )NFrl   r   r   )r   r+  rZ   r7   rV   r
   rW   rX   r   r   rY   r0  r.   r.   r2   rn     s    z;TestFiberForceVelocityDeGroote2016.test_doit_evaluate_falsec                 C   rp   Nz-0.318z-8.149z-0.374z0.886)r   r   r+  rs   )r5   rZ   fv_M_manualfv_M_constantsr.   r.   r2   rv     rw   z5TestFiberForceVelocityDeGroote2016.test_with_defaultsc                 C   sZ   t | jg| jR  }| j| j tt| j| j | j d d  }|| j|ks+J d S r/  )	r   r+  rZ   rV   rW   r   r   rX   ry   r0  r.   r.   r2    test_differentiate_wrt_v_M_tilde#     
 zCTestFiberForceVelocityDeGroote2016.test_differentiate_wrt_v_M_tildec                 C   sd   t | jg| jR  }t| j| j | j tt| j| j | j d d  }|| j	|ks0J d S r/  )
r   r+  rZ   r
   rW   rX   r   r   ry   rV   r0  r.   r.   r2   r}   +  s    z<TestFiberForceVelocityDeGroote2016.test_differentiate_wrt_c0c                 C   sZ   t | jg| jR  }| j| j tt| j| j | j d d  }|| j|ks+J d S r/  	r   r+  rZ   rV   r   r   rW   rX   ry   r0  r.   r.   r2   r~   3  r5  z<TestFiberForceVelocityDeGroote2016.test_differentiate_wrt_c1c                 C   sT   t | jg| jR  }| jtt| j| j | j d d  }|| j|ks(J d S r/  r6  r0  r.   r.   r2   r   ;  s    z<TestFiberForceVelocityDeGroote2016.test_differentiate_wrt_c2c                 C   r   r   )r   r+  rZ   r   ry   rY   r0  r.   r.   r2   r   C  r   z<TestFiberForceVelocityDeGroote2016.test_differentiate_wrt_c3c                 C   r   r-   )r   r+  rZ   r   r   r-  r.   r.   r2   r   H  r   z/TestFiberForceVelocityDeGroote2016.test_inversec                 C   r   )Nz.\operatorname{fv}^M \left( v_{M tilde} \right))r   r+  rZ   r   r=   r0  r.   r.   r2   r   L  r   z<TestFiberForceVelocityDeGroote2016.test_function_print_latexc                 C   r   )Nzsc_{0} \log{\left(c_{1} v_{M tilde} + c_{2} + \sqrt{\left(c_{1} v_{M tilde} + c_{2}\right)^{2} + 1} \right)} + c_{3})r   r+  rZ   r   r=   r7   r0  r.   r.   r2   r   Q  s   z>TestFiberForceVelocityDeGroote2016.test_expression_print_latexr,   z(0.88600000000000001 - 0.318*log(-8.1489999999999991*v_M_tilde - 0.374 + sqrt(1 + pow(-8.1489999999999991*v_M_tilde - 0.374, 2))))z(0.88600000000000001 - 0.318*log(-8.1489999999999991*v_M_tilde - 0.374 + std::sqrt(1 + std::pow(-8.1489999999999991*v_M_tilde - 0.374, 2))))z(0.88600000000000001 - 0.318*std::log(-8.1489999999999991*v_M_tilde - 0.374 + std::sqrt(1 + std::pow(-8.1489999999999991*v_M_tilde - 0.374, 2))))z      (0.886d0 - 0.318d0*log(-8.1489999999999991d0*v_M_tilde - 0.374d0 +
     @ sqrt(1.0d0 + (-8.149d0*v_M_tilde - 0.374d0)**2)))zW(0.886 - 0.318*log(-8.149*v_M_tilde - 0.374 + sqrt(1 + (-8.149*v_M_tilde - 0.374).^2)))za(0.886 - 0.318*math.log(-8.149*v_M_tilde - 0.374 + math.sqrt(1 + (-8.149*v_M_tilde - 0.374)**2)))zc(0.886 - 0.318*numpy.log(-8.149*v_M_tilde - 0.374 + numpy.sqrt(1 + (-8.149*v_M_tilde - 0.374)**2)))za(0.886 - 0.318*cupy.log(-8.149*v_M_tilde - 0.374 + cupy.sqrt(1 + (-8.149*v_M_tilde - 0.374)**2)))zk(0.886 - 0.318*jax.numpy.log(-8.149*v_M_tilde - 0.374 + jax.numpy.sqrt(1 + (-8.149*v_M_tilde - 0.374)**2)))aC  (mpmath.mpf((0, 7980378539700519, -53, 53)) - mpmath.mpf((0, 5728578726015271, -54, 53))*mpmath.log(-mpmath.mpf((0, 4587479170430271, -49, 53))*v_M_tilde + mpmath.mpf((1, 3368692521273131, -53, 52)) + mpmath.sqrt(1 + (-mpmath.mpf((0, 4587479170430271, -49, 53))*v_M_tilde + mpmath.mpf((1, 3368692521273131, -53, 52)))**2)))z\(0.886 - 0.318*math.log(-8.149*v_M_tilde - 0.374 + sqrt(1 + (-8.149*v_M_tilde - 0.374)**2)))c                 C   r   r-   )r   rs   r+  r=   )r5   r>   r?   r.  r.   r.   r2   r   Y  s   Uz2TestFiberForceVelocityDeGroote2016.test_print_codec                 C   r   )Nz42.591382*(1 + (-8.149*v_M_tilde - 0.374)**2)**(-1/2))r   rs   r+  ry   r&   r=   )r5   r.  dfv_M_dv_M_tilder?   r.   r.   r2   r     r   z=TestFiberForceVelocityDeGroote2016.test_derivative_print_codec                 C   r   )Nr   gJ<_Y	?)r   rs   r+  r'   rI   r   )r5   r.  fv_M_callabler.   r.   r2   r     r   z0TestFiberForceVelocityDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   g      g      r   r   g$bG?g5?g[Y	?gŇ^)\?)r   rs   r+  r'   r)   r   r   r   r5   r.  r8  r+  r?   r.   r.   r2   r     r   z6TestFiberForceVelocityDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r9  r:  )
r   rs   r+  r(   r   r'   r)   r   r   r   r;  r.   r.   r2   r     r   z4TestFiberForceVelocityDeGroote2016.test_lambdify_jax)-r8   r9   r:   rI   r   r,  rH   r`   rg   ri   rn   rv   r4  r}   r~   r   r   r   r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   r   r)   r   r(   r   r.   r.   r.   r2   r*    s    




T
r*  c                   @   rL   )7)TestFiberForceVelocityInverseDeGroote2016TrN   c                 C   rP   )Nr.  rR   rS   rT   rU   )r   r.  rV   rW   rX   rY   rZ   r[   r.   r.   r2   r     r]   zXTestFiberForceVelocityInverseDeGroote2016._tendon_force_length_inverse_arguments_fixturec                   C   r^   )Nr   )r_   r   r   r   r8   r.   r.   r.   r2   r`     ra   z4TestFiberForceVelocityInverseDeGroote2016.test_classc                 C   rb   )Nz?FiberForceVelocityInverseDeGroote2016(fv_M, c_0, c_1, c_2, c_3))r   r.  rZ   rc   rd   r5   fv_M_invr.   r.   r2   rg     rh   z7TestFiberForceVelocityInverseDeGroote2016.test_instancec                 C   sF   t | jg| jR   }|t| j| j | j | j | j ks!J d S r-   )	r   r.  rZ   r7   r   rY   rV   rX   rW   r=  r.   r.   r2   ri     rj   z3TestFiberForceVelocityInverseDeGroote2016.test_doitc                 C   sN   t | jg| jR  jdd}|tt| j| j | j | j | j	 ks%J d S rk   )
r   r.  rZ   r7   r   r   rY   rV   rX   rW   r=  r.   r.   r2   rn     ro   zBTestFiberForceVelocityInverseDeGroote2016.test_doit_evaluate_falsec                 C   rp   r1  )r   r   r.  rs   )r5   rZ   fv_M_inv_manualfv_M_inv_constantsr.   r.   r2   rv     rw   z<TestFiberForceVelocityInverseDeGroote2016.test_with_defaultsc                 C   sN   t | jg| jR  }t| j| j | j | j| j  }|| j|ks%J d S r-   r   r.  rZ   r   rY   rV   rW   ry   r5   r>  r?   r.   r.   r2   test_differentiate_wrt_fv_M   r   zETestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_fv_Mc                 C   s^   t | jg| jR  }| j| j t| j| j | j  | jd | j  }|| j|ks-J d S r   )r   r.  rZ   rY   r   rV   rW   ry   rB  r.   r.   r2   r}     r   zCTestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_c0c                 C   sR   t | jg| jR  }| jt| j| j | j  | jd  }|| j|ks'J d S r   )	r   r.  rZ   rX   r   rY   rV   rW   ry   rB  r.   r.   r2   r~   
  r   zCTestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_c1c                 C   s6   t | jg| jR  }d| j }|| j|ksJ d S r   )r   r.  rZ   rW   ry   rX   rB  r.   r.   r2   r     s   
zCTestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_c2c                 C   sP   t | jg| jR  }t| j| j | j  | j| j  }|| j|ks&J d S r-   rA  rB  r.   r.   r2   r     s   $zCTestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_c3c                 C   r   r-   )r   r.  rZ   r   r   r=  r.   r.   r2   r     r   z6TestFiberForceVelocityInverseDeGroote2016.test_inversec                 C   r   )Nz=\left( \operatorname{fv}^M \right)^{-1} \left( fv_{M} \right))r   r.  rZ   r   r=   rB  r.   r.   r2   r     r   zCTestFiberForceVelocityInverseDeGroote2016.test_function_print_latexc                 C   r   )NzK\frac{- c_{2} + \sinh{\left(\frac{- c_{3} + fv_{M}}{c_{0}} \right)}}{c_{1}})r   r.  rZ   r   r=   r7   r0  r.   r.   r2   r   "  r   zETestFiberForceVelocityInverseDeGroote2016.test_expression_print_latexr,   zV(-0.12271444348999878*(0.374 - sinh(3.1446540880503142*(fv_M - 0.88600000000000001))))z[(-0.12271444348999878*(0.374 - std::sinh(3.1446540880503142*(fv_M - 0.88600000000000001))))z[      (-0.122714443489999d0*(0.374d0 - sinh(3.1446540880503142d0*(fv_M -
     @ 0.886d0))))zD(-0.122714443489999*(0.374 - sinh(3.14465408805031*(fv_M - 0.886))))zI(-0.122714443489999*(0.374 - math.sinh(3.14465408805031*(fv_M - 0.886))))zJ(-0.122714443489999*(0.374 - numpy.sinh(3.14465408805031*(fv_M - 0.886))))zI(-0.122714443489999*(0.374 - cupy.sinh(3.14465408805031*(fv_M - 0.886))))zN(-0.122714443489999*(0.374 - jax.numpy.sinh(3.14465408805031*(fv_M - 0.886))))z(-mpmath.mpf((0, 8842507551592581, -56, 53))*(mpmath.mpf((0, 3368692521273131, -53, 52)) - mpmath.sinh(mpmath.mpf((0, 7081131489576251, -51, 53))*(fv_M + mpmath.mpf((1, 7980378539700519, -53, 53))))))c                 C   r   r-   )r   rs   r.  r=   )r5   r>   r?   r>  r.   r.   r2   r   '  s   Sz9TestFiberForceVelocityInverseDeGroote2016.test_print_codec                 C   r   )NzE0.385894476383644*math.cosh(3.14465408805031*fv_M - 2.78616352201258))r   rs   r.  ry   r&   r=   )r5   r>  dfv_M_inv_dfv_Mr?   r.   r.   r2   r   }  s
   zDTestFiberForceVelocityInverseDeGroote2016.test_derivative_print_codec                 C   r   )Nr   gM8'$JO)r   rs   r.  r'   rI   r   )r5   r>  fv_M_inv_callabler.   r.   r2   r     r   z7TestFiberForceVelocityInverseDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   r   r   r   r   r   ggUYgm7H:gƲ$JOg^8?gH?)r   rs   r.  r'   r)   r   r   r   r5   r>  rE  r.  r?   r.   r.   r2   r     r(  z=TestFiberForceVelocityInverseDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   rF  rG  )
r   rs   r.  r(   r   r'   r)   r   r   r   rH  r.   r.   r2   r     r)  z;TestFiberForceVelocityInverseDeGroote2016.test_lambdify_jax)-r8   r9   r:   rI   r   r   rH   r`   rg   ri   rn   rv   rC  r}   r~   r   r   r   r   r   rJ   rK   r   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   r   r   r   r   r)   r   r(   r   r.   r.   r.   r2   r<    s    



R	
r<  c                   @   sr   e Zd Zedd Zeejjdddd Zeej	dde
ie
eeeeeed	d
gdd Zedd Zd	S )!TestCharacteristicCurveCollectionc               	   C   s|   t tttttttd} | jtu sJ | j	tu sJ | j
tu s J | jtu s'J | jtu s.J | jtu s5J | jtu s<J d S N)tendon_force_lengthtendon_force_length_inversefiber_force_length_passive"fiber_force_length_passive_inversefiber_force_length_activefiber_force_velocityfiber_force_velocity_inverse)r   r   r   r   r   r   r   r   rK  rL  rM  rN  rO  rP  rQ  curvesr.   r.   r2   test_valid_constructor  s    	z8TestCharacteristicCurveCollection.test_valid_constructorz.kw_only dataclasses only valid in Python >3.10r   c               	   C   sD   t t ttttttt	t
} W d    d S 1 sw   Y  d S r-   )rI   raises	TypeErrorr   r   r   r   r   r   r   r   )_r.   r.   r2   %test_invalid_constructor_keyword_only  s   "zGTestCharacteristicCurveCollection.test_invalid_constructor_keyword_onlyr6   rK  N)rK  rL  rM  rN  rO  rP  rQ  extra_kwargc                 C   s>   t t tdi | }W d    d S 1 sw   Y  d S )Nr.   )rI   rU  rV  r   )r6   rW  r.   r.   r2   *test_invalid_constructor_wrong_number_args  s   "zLTestCharacteristicCurveCollection.test_invalid_constructor_wrong_number_argsc               	   C   sl  t tttttttd} t	t
 d | _W d    n1 sw   Y  t	t
 d | _W d    n1 s6w   Y  t	t
 d | _W d    n1 sNw   Y  t	t
 d | _W d    n1 sfw   Y  t	t
 d | _W d    n1 s~w   Y  t	t
 d | _W d    n1 sw   Y  t	t
 d | _W d    d S 1 sw   Y  d S rJ  )r   r   r   r   r   r   r   r   rI   rU  AttributeErrorrK  rL  rM  rN  rO  rP  rQ  rR  r.   r.   r2   test_instance_is_immutable  s<   	"z<TestCharacteristicCurveCollection.test_instance_is_immutable)r8   r9   r:   rH   rT  rI   rJ   skiprX  rK   r   r   r   r   r   r   r   rZ  r\  r.   r.   r.   r2   rI    s0    
rI  )G__doc__rI   sympy.core.exprr   sympy.core.functionr   sympy.core.numbersr   r   sympy.core.symbolr   r   sympy.external.importtoolsr   &sympy.functions.elementary.exponentialr	   r
   %sympy.functions.elementary.hyperbolicr   r   (sympy.functions.elementary.miscellaneousr    sympy.physics.biomechanics.curver   r   r   r   r   r   r   r   r   sympy.printing.cr   r   r   sympy.printing.cxxr   r   r   sympy.printing.fortranr   sympy.printing.lambdareprr   sympy.printing.latexr   sympy.printing.octaver    sympy.printing.numpyr!   r"   r#   r$   sympy.printing.pycoder%   r&   sympy.utilities.lambdifyr'   r(   r)   configupdater+   rM   r   r   r   r   r*  r<  rI  r.   r.   r.   r2   <module>   sT    ,* > B < 6   + f R