o
    GZh(                    @   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numpyZ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-   Z/var/www/auris/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kwargsr/   r0   r-   r-   r1   doitQ   s   
zZTestCharacteristicCurveFunction.test_print_code_parenthesize.<locals>.ExampleFunction.doitN)__name__
__module____qualname__classmethodr2   r6   r-   r-   r-   r1   ExampleFunctionK   s    
r;   za, b, c, d, e, f)r   r   doprint)code_printerexpectedr;   r/   r0   cdeff1f2Zf3r-   r-   r1   test_print_code_parenthesize4   s   



 z<TestCharacteristicCurveFunction.test_print_code_parenthesizeN)r7   r8   r9   staticmethodpytestmarkparametrizer   r   r   r   r   r   r   r    r&   r#   r$   r!   r"   r%   r   rE   r-   r-   r-   r1   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Z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   rN   c0c1c2c3	constantsr4   r-   r-   r1   &_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   r7   r-   r-   r-   r1   
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   rN   rW   
isinstancestrr4   fl_Tr-   r-   r1   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   rN   rW   r6   rS   r	   rV   rT   rU   rb   r-   r-   r1   	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   rN   rW   r6   rS   r	   rV   r   rT   rU   rb   r-   r-   r1   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   rN   with_defaults)r4   rW   Zfl_T_manualZfl_T_constantsr-   r-   r1   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   rN   rW   rS   rV   r	   r   rT   diffr4   rc   r>   r-   r-   r1    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   rN   rW   r	   rV   r   rT   rt   rS   ru   r-   r-   r1   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,   rs   ru   r-   r-   r1   test_differentiate_wrt_c1   rw   z;TestTendonForceLengthDeGroote2016.test_differentiate_wrt_c1c                 C   4   t | jg| jR  }td}|| j|ksJ d S N)r   rN   rW   r   rt   rU   ru   r-   r-   r1   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   rN   rW   rS   rT   r	   rV   r   rt   ru   r-   r-   r1   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   rN   rW   inverser   rb   r-   r-   r1   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   rN   rW   r   r<   ru   r-   r-   r1   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   rN   rW   r   r<   r6   ru   r-   r-   r1   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   rp   rN   r<   )r4   r=   r>   rc   r-   r-   r1   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   rp   rN   rt   r&   r<   )r4   rc   Zdfl_T_dl_T_tilder>   r-   r-   r1   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   rp   rN   r'   rG   approx)r4   rc   fl_T_callabler-   r-   r1   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   rp   rN   r'   r)   arraytestingassert_allcloser4   rc   r   rN   r>   r-   r-   r1   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   rp   rN   r(   jitr'   r)   r   r   r   r   r-   r-   r1   test_lambdify_jax  
   z3TestTendonForceLengthDeGroote2016.test_lambdify_jax)-r7   r8   r9   rG   fixturerY   rF   r]   rd   rf   rk   rq   rv   rx   ry   r}   r   r   r   r   rH   rI   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-   r1   rK   \   s    



C
rK   c                   @   rJ   )7(TestTendonForceLengthInverseDeGroote2016TrL   c                 C   rM   )Nrc   rO   rP   rQ   rR   )r   rc   rS   rT   rU   rV   rW   rX   r-   r-   r1   ._tendon_force_length_inverse_arguments_fixture  rZ   zWTestTendonForceLengthInverseDeGroote2016._tendon_force_length_inverse_arguments_fixturec                   C   r[   )Nr   )r\   r   r   r   r7   r-   r-   r-   r1   r]   $  r^   z3TestTendonForceLengthInverseDeGroote2016.test_classc                 C   r_   )Nz>TendonForceLengthInverseDeGroote2016(fl_T, c_0, c_1, c_2, c_3))r   rc   rW   r`   ra   r4   fl_T_invr-   r-   r1   rd   *  re   z6TestTendonForceLengthInverseDeGroote2016.test_instancec                 C   sF   t | jg| jR   }|t| j| j | j | j | j ks!J d S r,   )	r   rc   rW   r6   r
   rU   rS   rV   rT   r   r-   r-   r1   rf   /  rg   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 rh   )
r   rc   rW   r6   r
   r   rU   rS   rV   rT   r   r-   r-   r1   rk   3  rl   zATestTendonForceLengthInverseDeGroote2016.test_doit_evaluate_falsec                 C   rm   rn   )r   r   rc   rp   )r4   rW   Zfl_T_inv_manualZfl_T_inv_constantsr-   r-   r1   rq   7  rr   z;TestTendonForceLengthInverseDeGroote2016.test_with_defaultsc                 C   sB   t | jg| jR  }d| j| j| j   }|| j|ksJ d S N   r   rc   rW   rV   rU   rt   r4   r   r>   r-   r-   r1   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   rc   rW   rS   rV   rt   r   r-   r-   r1   rx   G  s   zBTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_c0c                 C   rz   r   )r   rc   rW   r   rt   rT   r   r-   r-   r1   ry   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-   r1   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   rc   rW   r
   r   rU   rS   rV   rt   r   r-   r-   r1   r   V     &zBTestTendonForceLengthInverseDeGroote2016.test_differentiate_wrt_c3c                 C   r   r,   )r   rc   rW   r   r   r   r-   r-   r1   r   [  r   z5TestTendonForceLengthInverseDeGroote2016.test_inversec                 C   r   )Nz=\left( \operatorname{fl}^T \right)^{-1} \left( fl_{T} \right))r   rc   rW   r   r<   r   r-   r-   r1   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   rc   rW   r   r<   r6   ru   r-   r-   r1   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   rp   rc   r<   )r4   r=   r>   r   r-   r-   r1   r   i  r   z8TestTendonForceLengthInverseDeGroote2016.test_print_codec                 C   r   )Nz.1/(33.93669377311689*fl_T + 8.484173443279222))r   rp   rc   rt   r&   r<   )r4   r   Zdfl_T_inv_dfl_Tr>   r-   r-   r1   r     r   zCTestTendonForceLengthInverseDeGroote2016.test_derivative_print_codec                 C   r   )N        mIs?)r   rp   rc   r'   rG   r   )r4   r   fl_T_inv_callabler-   r-   r1   r     r   z6TestTendonForceLengthInverseDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   gɿ{Gzr   r   gRQ?r   gPgf?g}?r   gyl?g­?gp?)r   rp   rc   r'   r)   r   r   r   r4   r   r   rc   r>   r-   r-   r1   r     
   z<TestTendonForceLengthInverseDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r   r   )
r   rp   rc   r(   r   r'   r)   r   r   r   r   r-   r-   r1   r     
   z:TestTendonForceLengthInverseDeGroote2016.test_lambdify_jax)-r7   r8   r9   rG   r   r   rF   r]   rd   rf   rk   rq   r   rx   ry   r}   r   r   r   r   rH   rI   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-   r1   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'TestFiberForceLengthPassiveDeGroote2016TrL   c                 C   0   t d| _t d| _t d| _| j| jf| _d S )N	l_M_tilderO   rP   )r   r   rS   rT   rW   rX   r-   r-   r1   -_fiber_force_length_passive_arguments_fixture     


zUTestFiberForceLengthPassiveDeGroote2016._fiber_force_length_passive_arguments_fixturec                   C   r[   )Nr   )r\   r   r   r   r7   r-   r-   r-   r1   r]     r^   z2TestFiberForceLengthPassiveDeGroote2016.test_classc                 C   r_   )Nz8FiberForceLengthPassiveDeGroote2016(l_M_tilde, c_0, c_1))r   r   rW   r`   ra   r4   fl_M_pasr-   r-   r1   rd     re   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   rW   r6   r	   rT   rS   r   r-   r-   r1   rf        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 NFri   r   )r   r   rW   r6   r	   rT   r   rS   r   r-   r-   r1   rk        <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   rp   )r4   rW   Zfl_M_pas_manualZfl_M_pas_constantsr-   r-   r1   rq        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   rW   rT   r	   r   rS   rt   r4   r   r>   r-   r-   r1    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-   r1   rx     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   rW   r	   rT   r   rS   rt   r   r-   r-   r1   ry     s   >:zATestFiberForceLengthPassiveDeGroote2016.test_differentiate_wrt_c1c                 C   r   r,   )r   r   rW   r   r   r   r-   r-   r1   r     r   z4TestFiberForceLengthPassiveDeGroote2016.test_inversec                 C   r   )Nz4\operatorname{fl}^M_{pas} \left( l_{M tilde} \right))r   r   rW   r   r<   r   r-   r-   r1   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   rW   r   r<   r6   r   r-   r-   r1   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   rp   r   r<   )r4   r=   r>   r   r-   r-   r1   r   "  r   z7TestFiberForceLengthPassiveDeGroote2016.test_print_codec                 C   r   )Nz;0.12438240242516*math.exp(6.66666666666667*(l_M_tilde - 1)))r   rp   r   rt   r&   r<   )r4   r   Zfl_M_pas_dl_M_tilder>   r-   r-   r1   r   i  r   zBTestFiberForceLengthPassiveDeGroote2016.test_derivative_print_codec                 C   r   )Nr   r   )r   rp   r   r'   rG   r   )r4   r   fl_M_pas_callabler-   r-   r1   r   o  r   z5TestFiberForceLengthPassiveDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)         ?皙??r   皙?333333?      ?g1olgx#^#ggΫr   g4],eI?g-˯?gO#?)r   rp   r   r'   r)   r   r   r   r4   r   r   r   r>   r-   r-   r1   r   t  s
   	z;TestFiberForceLengthPassiveDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r   r   )
r   rp   r   r(   r   r'   r)   r   r   r   r   r-   r-   r1   r     s
   	z9TestFiberForceLengthPassiveDeGroote2016.test_lambdify_jax)+r7   r8   r9   rG   r   r   rF   r]   rd   rf   rk   rq   r   rx   ry   r   r   r   rH   rI   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-   r1   r     s    


	
C
r   c                   @   r   )3.TestFiberForceLengthPassiveInverseDeGroote2016TrL   c                 C   r   )Nr   rO   rP   )r   r   rS   rT   rW   rX   r-   r-   r1   r     r   z\TestFiberForceLengthPassiveInverseDeGroote2016._fiber_force_length_passive_arguments_fixturec                   C   r[   )Nr   )r\   r   r   r   r7   r-   r-   r-   r1   r]     r^   z9TestFiberForceLengthPassiveInverseDeGroote2016.test_classc                 C   r_   )Nz>FiberForceLengthPassiveInverseDeGroote2016(fl_M_pas, c_0, c_1))r   r   rW   r`   ra   r4   fl_M_pas_invr-   r-   r1   rd     re   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   rW   r6   rS   r
   r	   rT   r   r-   r-   r1   rf     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   rW   r6   rS   r
   r   r	   rT   r   r-   r-   r1   rk     r   zGTestFiberForceLengthPassiveInverseDeGroote2016.test_doit_evaluate_falsec                 C   r   r   )r   r   r   rp   )r4   rW   Zfl_M_pas_inv_manualZfl_M_pas_inv_constantsr-   r-   r1   rq     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   rW   rS   r	   rT   rt   r4   r   r>   r-   r-   r1   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   rW   r
   r	   rT   rt   rS   r   r-   r-   r1   rx        "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   rW   rS   r	   rT   r
   rt   r   r-   r-   r1   ry     s   2*zHTestFiberForceLengthPassiveInverseDeGroote2016.test_differentiate_wrt_c1c                 C   r   r,   )r   r   rW   r   r   r   r-   r-   r1   r     r   z;TestFiberForceLengthPassiveInverseDeGroote2016.test_inversec                 C   r   )NzG\left( \operatorname{fl}^M_{pas} \right)^{-1} \left( fl_{M pas} \right))r   r   rW   r   r<   r   r-   r-   r1   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   rW   r   r<   r6   ru   r-   r-   r1   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   rp   r   r<   )r4   r=   r>   r   r-   r-   r1   r     s   Cz>TestFiberForceLengthPassiveInverseDeGroote2016.test_print_codec                 C   r   )Nz232.1588900198865/(214.392600132577*fl_M_pas + 4.0))r   rp   r   rt   r&   r<   )r4   r   Zdfl_M_pas_inv_dfl_Tr>   r-   r-   r1   r      r   zITestFiberForceLengthPassiveInverseDeGroote2016.test_derivative_print_codec                 C   r   )Nr   r   )r   rp   r   r'   rG   r   )r4   r   fl_M_pas_inv_callabler-   r-   r1   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   rp   r   r'   r)   r   r   r   r4   r   r   r   r>   r-   r-   r1   r   +  r   zBTestFiberForceLengthPassiveInverseDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r   r   )
r   rp   r   r(   r   r'   r)   r   r   r   r   r-   r-   r1   r   :  r   z@TestFiberForceLengthPassiveInverseDeGroote2016.test_lambdify_jax)+r7   r8   r9   rG   r   r   rF   r]   rd   rf   rk   rq   r   rx   ry   r   r   r   rH   rI   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-   r1   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&TestFiberForceLengthActiveDeGroote2016TrL   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   rO   rP   rQ   rR   Zc_4Zc_5Zc_6Zc_7Zc_8Zc_9Zc_10Zc_11)r   r   rS   rT   rU   rV   c4c5c6c7c8c9c10c11rW   rX   r-   r-   r1   ,_fiber_force_length_active_arguments_fixtureL  s    













zSTestFiberForceLengthActiveDeGroote2016._fiber_force_length_active_arguments_fixturec                   C   r[   )Nr   )r\   r   r   r   r7   r-   r-   r-   r1   r]   `  r^   z1TestFiberForceLengthActiveDeGroote2016.test_classc                 C   r_   )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   rW   r`   ra   r4   fl_M_actr-   r-   r1   rd   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   rW   r6   rS   r	   rT   rU   rV   r   r   r   r   r   r   r   r   r   r-   r-   r1   rf   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 )NFri   r   )r   r   rW   r6   rS   r	   r   rT   rU   rV   r   r   r   r   r   r   r   r   r   r-   r-   r1   rk   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.0299ro   z0.1z1.0z0.354z0.0)r   r   r   rp   )r4   rW   Zfl_M_act_manualZfl_M_act_constantsr-   r-   r1   rq   ~  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   rW   rS   rV   rT   rU   r	   r   r   r   r   r   r   r   r   rt   r4   r   r>   r-   r-   r1   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   rW   r	   rT   rU   rV   r6   rt   rS   r   r-   r-   r1   rx     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   rW   rS   rT   rU   rV   r	   rt   r   r-   r-   r1   ry        &.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-   r1   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-   r1   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   rW   r	   r   r   r   rt   r   r   r-   r-   r1   test_differentiate_wrt_c4     0z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c4c                 C   r   r   	r   r   rW   r   r   r   r   r	   rt   r   r-   r-   r1   test_differentiate_wrt_c5  r   z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c5c                 C   r   r   r   r   r-   r-   r1   test_differentiate_wrt_c6  r   z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c6c                 C   r   r   r   r   r-   r-   r1   test_differentiate_wrt_c7  r   z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c7c                 C   r   r   )	r   r   rW   r	   r   r   r   rt   r   r   r-   r-   r1   test_differentiate_wrt_c8  r   z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c8c                 C   r   r   	r   r   rW   r   r   r   r   r	   rt   r   r-   r-   r1   test_differentiate_wrt_c9  r   z@TestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c9c                 C   r   r   r  r   r-   r-   r1   test_differentiate_wrt_c10  r   zATestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c10c                 C   r   r   r  r   r-   r-   r1   test_differentiate_wrt_c11  r   zATestFiberForceLengthActiveDeGroote2016.test_differentiate_wrt_c11c                 C   r   )Nz4\operatorname{fl}^M_{act} \left( l_{M tilde} \right))r   r   rW   r   r<   r   r-   r-   r1   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   rW   r   r<   r6   r   r-   r-   r1   r     s   zBTestFiberForceLengthActiveDeGroote2016.test_expression_print_latexr+   aI  (0.81399999999999995*exp(-1.0/2.0*pow(l_M_tilde - 1.0600000000000001, 2)/pow(0.063299999999999995*l_M_tilde + 0.16200000000000001, 2)) + 0.433*exp(-1.0/2.0*pow(l_M_tilde - 0.71699999999999997, 2)/pow(0.20000000000000001*l_M_tilde - 0.029899999999999999, 2)) + 0.10000000000000001*exp(-3.9899134986753491*pow(l_M_tilde - 1.0, 2)))ab  (0.81399999999999995*exp(-1.0/2.0*std::pow(l_M_tilde - 1.0600000000000001, 2)/std::pow(0.063299999999999995*l_M_tilde + 0.16200000000000001, 2)) + 0.433*exp(-1.0/2.0*std::pow(l_M_tilde - 0.71699999999999997, 2)/std::pow(0.20000000000000001*l_M_tilde - 0.029899999999999999, 2)) + 0.10000000000000001*exp(-3.9899134986753491*std::pow(l_M_tilde - 1.0, 2)))aq  (0.81399999999999995*std::exp(-1.0/2.0*std::pow(l_M_tilde - 1.0600000000000001, 2)/std::pow(0.063299999999999995*l_M_tilde + 0.16200000000000001, 2)) + 0.433*std::exp(-1.0/2.0*std::pow(l_M_tilde - 0.71699999999999997, 2)/std::pow(0.20000000000000001*l_M_tilde - 0.029899999999999999, 2)) + 0.10000000000000001*std::exp(-3.9899134986753491*std::pow(l_M_tilde - 1.0, 2)))a6        (0.814d0*exp(-0.5d0*(l_M_tilde - 1.06d0)**2/(
     @ 0.063299999999999995d0*l_M_tilde + 0.16200000000000001d0)**2) +
     @ 0.433d0*exp(-0.5d0*(l_M_tilde - 0.717d0)**2/(
     @ 0.20000000000000001d0*l_M_tilde - 0.029899999999999999d0)**2) +
     @ 0.1d0*exp(-3.9899134986753491d0*(l_M_tilde - 1.0d0)**2))z(0.814*exp(-(l_M_tilde - 1.06).^2./(2*(0.0633*l_M_tilde + 0.162).^2)) + 0.433*exp(-(l_M_tilde - 0.717).^2./(2*(0.2*l_M_tilde - 0.0299).^2)) + 0.1*exp(-3.98991349867535*(l_M_tilde - 1.0).^2))z(0.814*math.exp(-1/2*(l_M_tilde - 1.06)**2/(0.0633*l_M_tilde + 0.162)**2) + 0.433*math.exp(-1/2*(l_M_tilde - 0.717)**2/(0.2*l_M_tilde - 0.0299)**2) + 0.1*math.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))z(0.814*numpy.exp(-1/2*(l_M_tilde - 1.06)**2/(0.0633*l_M_tilde + 0.162)**2) + 0.433*numpy.exp(-1/2*(l_M_tilde - 0.717)**2/(0.2*l_M_tilde - 0.0299)**2) + 0.1*numpy.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))z(0.814*cupy.exp(-1/2*(l_M_tilde - 1.06)**2/(0.0633*l_M_tilde + 0.162)**2) + 0.433*cupy.exp(-1/2*(l_M_tilde - 0.717)**2/(0.2*l_M_tilde - 0.0299)**2) + 0.1*cupy.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))z(0.814*jax.numpy.exp(-1/2*(l_M_tilde - 1.06)**2/(0.0633*l_M_tilde + 0.162)**2) + 0.433*jax.numpy.exp(-1/2*(l_M_tilde - 0.717)**2/(0.2*l_M_tilde - 0.0299)**2) + 0.1*jax.numpy.exp(-3.98991349867535*(l_M_tilde - 1.0)**2))a  (mpmath.mpf((0, 7331860193359167, -53, 53))*mpmath.exp(-mpmath.mpf(1)/mpmath.mpf(2)*(l_M_tilde + mpmath.mpf((1, 2386907802506363, -51, 52)))**2/(mpmath.mpf((0, 2280622851300419, -55, 52))*l_M_tilde + mpmath.mpf((0, 5836665117072163, -55, 53)))**2) + mpmath.mpf((0, 7800234554605699, -54, 53))*mpmath.exp(-mpmath.mpf(1)/mpmath.mpf(2)*(l_M_tilde + mpmath.mpf((1, 6458161865649291, -53, 53)))**2/(mpmath.mpf((0, 3602879701896397, -54, 52))*l_M_tilde + mpmath.mpf((1, 8618088246936181, -58, 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   rp   r   r<   )r4   r=   r>   r   r-   r-   r1   r     s   dz6TestFiberForceLengthActiveDeGroote2016.test_print_codec                 C   r   )Na  (0.79798269973507 - 0.79798269973507*l_M_tilde)*math.exp(-3.98991349867535*(l_M_tilde - 1.0)**2) + (0.433*(0.717 - l_M_tilde)/(0.2*l_M_tilde - 0.0299)**2 + 0.0866*(l_M_tilde - 0.717)**2/(0.2*l_M_tilde - 0.0299)**3)*math.exp(-1/2*(l_M_tilde - 0.717)**2/(0.2*l_M_tilde - 0.0299)**2) + (0.814*(1.06 - l_M_tilde)/(0.0633*l_M_tilde + 0.162)**2 + 0.0515262*(l_M_tilde - 1.06)**2/(0.0633*l_M_tilde + 0.162)**3)*math.exp(-1/2*(l_M_tilde - 1.06)**2/(0.0633*l_M_tilde + 0.162)**2))r   rp   r   rt   r&   r<   )r4   r   Zfl_M_act_dl_M_tilder>   r-   r-   r1   r   o  s
   zATestFiberForceLengthActiveDeGroote2016.test_derivative_print_codec                 C   r   )Nr   s?)r   rp   r   r'   rG   r   )r4   r   fl_M_act_callabler-   r-   r1   r   w  r   z4TestFiberForceLengthActiveDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   r   r   r   r   g       @g	> P^?g]Q?r	  g)`?gߌ'|?)r   rp   r   r'   r)   r   r   r   r4   r   r
  r   r>   r-   r-   r1   r   |  
   z:TestFiberForceLengthActiveDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r  r  )
r   rp   r   r(   r   r'   r)   r   r   r   r  r-   r-   r1   r     
   z8TestFiberForceLengthActiveDeGroote2016.test_lambdify_jax)4r7   r8   r9   rG   r   r   rF   r]   rd   rf   rk   rq   r   rx   ry   r}   r   r   r  r  r  r  r  r  r  r   r   rH   rI   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-   r1   r   J  s    


	
c
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"TestFiberForceVelocityDeGroote2016TrL   c                 C   rM   )N	v_M_tilderO   rP   rQ   rR   )r   r  rS   rT   rU   rV   rW   rX   r-   r-   r1   ._muscle_fiber_force_velocity_arguments_fixture  rZ   zQTestFiberForceVelocityDeGroote2016._muscle_fiber_force_velocity_arguments_fixturec                   C   r[   )Nr   )r\   r   r   r   r7   r-   r-   r-   r1   r]     r^   z-TestFiberForceVelocityDeGroote2016.test_classc                 C   r_   )Nz=FiberForceVelocityDeGroote2016(v_M_tilde, c_0, c_1, c_2, c_3))r   r  rW   r`   ra   r4   fv_Mr-   r-   r1   rd     re   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  rW   r6   rS   r
   rT   rU   r   rV   r4   r  r>   r-   r-   r1   rf     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 )NFri   r   r   )r   r  rW   r6   rS   r
   rT   rU   r   r   rV   r  r-   r-   r1   rk     s    z;TestFiberForceVelocityDeGroote2016.test_doit_evaluate_falsec                 C   rm   Nz-0.318z-8.149z-0.374z0.886)r   r   r  rp   )r4   rW   Zfv_M_manualZfv_M_constantsr-   r-   r1   rq     rr   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  rW   rS   rT   r   r   rU   rt   r  r-   r-   r1    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  rW   r
   rT   rU   r   r   rt   rS   r  r-   r-   r1   rx     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  rW   rS   r   r   rT   rU   rt   r  r-   r-   r1   ry     r  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  r  r  r-   r-   r1   r}     s    z<TestFiberForceVelocityDeGroote2016.test_differentiate_wrt_c2c                 C   rz   r   )r   r  rW   r   rt   rV   r  r-   r-   r1   r     r~   z<TestFiberForceVelocityDeGroote2016.test_differentiate_wrt_c3c                 C   r   r,   )r   r  rW   r   r   r  r-   r-   r1   r     r   z/TestFiberForceVelocityDeGroote2016.test_inversec                 C   r   )Nz.\operatorname{fv}^M \left( v_{M tilde} \right))r   r  rW   r   r<   r  r-   r-   r1   r     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  rW   r   r<   r6   r  r-   r-   r1   r     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   rp   r  r<   )r4   r=   r>   r  r-   r-   r1   r      s   Uz2TestFiberForceVelocityDeGroote2016.test_print_codec                 C   r   )Nz42.591382*(1 + (-8.149*v_M_tilde - 0.374)**2)**(-1/2))r   rp   r  rt   r&   r<   )r4   r  Zdfv_M_dv_M_tilder>   r-   r-   r1   r   X  r   z=TestFiberForceVelocityDeGroote2016.test_derivative_print_codec                 C   r   )Nr   gJ<_Y	?)r   rp   r  r'   rG   r   )r4   r  fv_M_callabler-   r-   r1   r   ^  r   z0TestFiberForceVelocityDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   g      g      r   r   g$bG?g5?g[Y	?gŇ^)\?)r   rp   r  r'   r)   r   r   r   r4   r  r  r  r>   r-   r-   r1   r   c  r   z6TestFiberForceVelocityDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r  r  )
r   rp   r  r(   r   r'   r)   r   r   r   r  r-   r-   r1   r   p  r   z4TestFiberForceVelocityDeGroote2016.test_lambdify_jax)-r7   r8   r9   rG   r   r  rF   r]   rd   rf   rk   rq   r  rx   ry   r}   r   r   r   r   rH   rI   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-   r1   r    s    




T
r  c                   @   rJ   )7)TestFiberForceVelocityInverseDeGroote2016TrL   c                 C   rM   )Nr  rO   rP   rQ   rR   )r   r  rS   rT   rU   rV   rW   rX   r-   r-   r1   r     rZ   zXTestFiberForceVelocityInverseDeGroote2016._tendon_force_length_inverse_arguments_fixturec                   C   r[   )Nr   )r\   r   r   r   r7   r-   r-   r-   r1   r]     r^   z4TestFiberForceVelocityInverseDeGroote2016.test_classc                 C   r_   )Nz?FiberForceVelocityInverseDeGroote2016(fv_M, c_0, c_1, c_2, c_3))r   r  rW   r`   ra   r4   fv_M_invr-   r-   r1   rd     re   z7TestFiberForceVelocityInverseDeGroote2016.test_instancec                 C   sF   t | jg| jR   }|t| j| j | j | j | j ks!J d S r,   )	r   r  rW   r6   r   rV   rS   rU   rT   r   r-   r-   r1   rf     rg   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 rh   )
r   r  rW   r6   r   r   rV   rS   rU   rT   r   r-   r-   r1   rk     rl   zBTestFiberForceVelocityInverseDeGroote2016.test_doit_evaluate_falsec                 C   rm   r  )r   r   r  rp   )r4   rW   Zfv_M_inv_manualZfv_M_inv_constantsr-   r-   r1   rq     rr   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  rW   r   rV   rS   rT   rt   r4   r!  r>   r-   r-   r1   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  rW   rV   r   rS   rT   rt   r#  r-   r-   r1   rx     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  rW   rU   r   rV   rS   rT   rt   r#  r-   r-   r1   ry     r   zCTestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_c1c                 C   s6   t | jg| jR  }d| j }|| j|ksJ d S r{   )r   r  rW   rT   rt   rU   r#  r-   r-   r1   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,   r"  r#  r-   r-   r1   r     s   $zCTestFiberForceVelocityInverseDeGroote2016.test_differentiate_wrt_c3c                 C   r   r,   )r   r  rW   r   r   r   r-   r-   r1   r     r   z6TestFiberForceVelocityInverseDeGroote2016.test_inversec                 C   r   )Nz=\left( \operatorname{fv}^M \right)^{-1} \left( fv_{M} \right))r   r  rW   r   r<   r#  r-   r-   r1   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  rW   r   r<   r6   r  r-   r-   r1   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   rp   r  r<   )r4   r=   r>   r!  r-   r-   r1   r     s   Sz9TestFiberForceVelocityInverseDeGroote2016.test_print_codec                 C   r   )NzE0.385894476383644*math.cosh(3.14465408805031*fv_M - 2.78616352201258))r   rp   r  rt   r&   r<   )r4   r!  Zdfv_M_inv_dfv_Mr>   r-   r-   r1   r   $  s
   zDTestFiberForceVelocityInverseDeGroote2016.test_derivative_print_codec                 C   r   )Nr   gM8'$JO)r   rp   r  r'   rG   r   )r4   r!  fv_M_inv_callabler-   r-   r1   r   -  r   z7TestFiberForceVelocityInverseDeGroote2016.test_lambdifyNr   r   c                 C   r   )Nr)   r   r   r   r   r   ggUYgm7H:gƲ$JOg^8?gH?)r   rp   r  r'   r)   r   r   r   r4   r!  r%  r  r>   r-   r-   r1   r   2  r  z=TestFiberForceVelocityInverseDeGroote2016.test_lambdify_numpyr   c                 C   r   )Nr(   r&  r'  )
r   rp   r  r(   r   r'   r)   r   r   r   r(  r-   r-   r1   r   @  r  z;TestFiberForceVelocityInverseDeGroote2016.test_lambdify_jax)-r7   r8   r9   rG   r   r   rF   r]   rd   rf   rk   rq   r$  rx   ry   r}   r   r   r   r   rH   rI   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-   r1   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   r+  r,  r-  r.  r/  r0  r1  Zcurvesr-   r-   r1   test_valid_constructorQ  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,   )rG   raises	TypeErrorr   r   r   r   r   r   r   r   )_r-   r-   r1   %test_invalid_constructor_keyword_onlyd  s   "zGTestCharacteristicCurveCollection.test_invalid_constructor_keyword_onlyr5   r+  N)r+  r,  r-  r.  r/  r0  r1  Zextra_kwargc                 C   s>   t t tdi | }W d    d S 1 sw   Y  d S )Nr-   )rG   r4  r5  r   )r5   r6  r-   r-   r1   *test_invalid_constructor_wrong_number_argsr  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 r*  )r   r   r   r   r   r   r   r   rG   r4  AttributeErrorr+  r,  r-  r.  r/  r0  r1  r2  r-   r-   r1   test_instance_is_immutable  s<   	"z<TestCharacteristicCurveCollection.test_instance_is_immutable)r7   r8   r9   rF   r3  rG   rH   skipr7  rI   r   r   r   r   r   r   r   r8  r:  r-   r-   r-   r1   r)  O  s0    
r)  )G__doc__rG   Zsympy.core.exprr   Zsympy.core.functionr   Zsympy.core.numbersr   r   Zsympy.core.symbolr   r   Zsympy.external.importtoolsr   Z&sympy.functions.elementary.exponentialr	   r
   Z%sympy.functions.elementary.hyperbolicr   r   Z(sympy.functions.elementary.miscellaneousr   Z sympy.physics.biomechanics.curver   r   r   r   r   r   r   r   r   Zsympy.printing.cr   r   r   Zsympy.printing.cxxr   r   r   Zsympy.printing.fortranr   Zsympy.printing.lambdareprr   Zsympy.printing.latexr   Zsympy.printing.octaver    Zsympy.printing.numpyr!   r"   r#   r$   Zsympy.printing.pycoder%   r&   Zsympy.utilities.lambdifyr'   r(   r)   configupdater*   rK   r   r   r   r   r  r  r)  r-   r-   r-   r1   <module>   sR    ,* > B < 6  Q f R