§
    OŠtj{¹  ã                   ó  — d dl mZ d dlmZ d dlmZ d dlmZmZ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 d dlmZmZ d d	lmZ d d
lmZ d dl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' d dl(m)Z) d„ Z*d„ Z+ G d„ de"¦  «        Z,dS )é    )ÚRational)ÚS)Úis_eq)Ú	conjugateÚimÚreÚsign)ÚexpÚlog)Úsqrt)ÚacosÚasinÚatan2)ÚcosÚsin)Útrigsimp©Ú	integrate)ÚMutableDenseMatrix)ÚsympifyÚ_sympify)ÚExpr)Ú	fuzzy_notÚfuzzy_or)Úas_int)Úprec_to_dpsc                 ó   — |�u|j         rp|j        du rt          d¦  «        ‚t          d„ | D ¦   «         ¦  «        }|r?t	          |dz  t          d„ | D ¦   «         ¦  «        ¦  «        du rt          d¦  «        ‚dS dS dS dS )z$validate if input norm is consistentNFzInput norm must be positive.c              3   ó6   K  — | ]}|j         o|j        d u V — ŒdS )TN)Ú	is_numberÚis_real©Ú.0Úis     úW/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/algebras/quaternion.pyú	<genexpr>z_check_norm.<locals>.<genexpr>   s0   è è € ÐLÐL¸a˜œÐ9¨¬	°TÐ(9ÐLÐLÐLÐLÐLÐLó    é   c              3   ó    K  — | ]	}|d z  V — Œ
dS )r'   N© r!   s     r$   r%   z_check_norm.<locals>.<genexpr>   s&   è è € Ð+CÐ+C°Q¨A¨q©DÐ+CÐ+CÐ+CÐ+CÐ+CÐ+Cr&   zIncompatible value for norm.)r   Úis_positiveÚ
ValueErrorÚallr   Úsum)ÚelementsÚnormÚ	numericals      r$   Ú_check_normr1      s¬   € àÐ˜DœNÐØÔ˜uÐ$Ð$ÝÐ;Ñ<Ô<Ð<åÐLÐLÀ8ÐLÑLÔLÑLÔLˆ	Øð 	=�˜t Q™w­Ð+CÐ+C¸(Ð+CÑ+CÔ+CÑ(CÔ(CÑDÔDÈÐMÐMÝÐ;Ñ<Ô<Ð<ð ÐÐÐð
	=ð 	=ÐMÐMr&   c                 óF  — t          | ¦  «        t          k    rt          d¦  «        ‚t          | ¦  «        dk    r"t          d                     | ¦  «        ¦  «        ‚|                      ¦   «         }|                      ¦   «         }|s|st          d¦  «        ‚|                      ¦   «         \  }}}||k    s||k    rt          d¦  «        ‚t          | ¦  «        t          d¦  «        z
  }|r5t          d                     d 	                    |¦  «        ¦  «        ¦  «        ‚|S )	zGvalidate seq and return True if seq is lowercase and False if uppercasezExpected seq to be a string.é   zExpected 3 axes, got `{}`.zkseq must either be fully uppercase (for extrinsic rotations), or fully lowercase, for intrinsic rotations).z"Consecutive axes must be differentÚxyzXYZzNExpected axes from `seq` to be from ['x', 'y', 'z'] or ['X', 'Y', 'Z'], got {}Ú )
ÚtypeÚstrr+   ÚlenÚformatÚisupperÚislowerÚlowerÚsetÚjoin)ÚseqÚ	intrinsicÚ	extrinsicr#   ÚjÚkÚbads          r$   Ú_is_extrinsicrE      s  € åˆC�y„y•CÒÐÝÐ7Ñ8Ô8Ð8Ý
ˆ3�x„x�1‚}€}ÝÐ5×<Ò<¸SÑAÔAÑBÔBÐBà—’‘”€IØ—’‘”€IØð (˜ð (Ýð 'ñ (ô (ð 	(ð �iŠi‰kŒk�G€A€qˆ!Ø	ˆQŠˆ�A˜’F�FÝÐ=Ñ>Ô>Ð>å
ˆc‰(Œ(•S˜‘]”]Ñ
"€CØ
ð 8Ýð "ç"(¢&¨¯ª°©¬Ñ"6Ô"6ñ8ô 8ð 	8ð Ðr&   c                   óV  ‡ — e Zd ZdZdZdZd>ˆ fd„	Zd„ Zed	„ ¦   «         Z	ed
„ ¦   «         Z
ed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zd?d„Zed„ ¦   «         Zed„ ¦   «         Zd@d„Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d „ Z!d!„ Z"d"„ Z#e$d#„ ¦   «         Z%d$„ Z&d%„ Z'd&„ Z(d'„ Z)d(„ Z*d)„ Z+d*„ Z,d+„ Z-d,„ Z.d-„ Z/d.„ Z0e$d/„ ¦   «         Z1d0„ Z2dAd1„Z3d2„ Z4d3„ Z5d4„ Z6d5„ Z7d6„ Z8d7„ Z9d8„ Z:ed9„ ¦   «         Z;d:„ Z<d;„ Z=d<„ Z>d=„ Z?ˆ xZ@S )BÚ
Quaternionaö  Provides basic quaternion operations.
    Quaternion objects can be instantiated as ``Quaternion(a, b, c, d)``
    as in $q = a + bi + cj + dk$.

    Parameters
    ==========

    norm : None or number
        Pre-defined quaternion norm. If a value is given, Quaternion.norm
        returns this pre-defined value instead of calculating the norm

    Examples
    ========

    >>> from sympy import Quaternion
    >>> q = Quaternion(1, 2, 3, 4)
    >>> q
    1 + 2*i + 3*j + 4*k

    Quaternions over complex fields can be defined as:

    >>> from sympy import Quaternion
    >>> from sympy import symbols, I
    >>> x = symbols('x')
    >>> q1 = Quaternion(x, x**3, x, x**2, real_field = False)
    >>> q2 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False)
    >>> q1
    x + x**3*i + x*j + x**2*k
    >>> q2
    (3 + 4*I) + (2 + 5*I)*i + 0*j + (7 + 8*I)*k

    Defining symbolic unit quaternions:

    >>> from sympy import Quaternion
    >>> from sympy.abc import w, x, y, z
    >>> q = Quaternion(w, x, y, z, norm=1)
    >>> q
    w + x*i + y*j + z*k
    >>> q.norm()
    1

    References
    ==========

    .. [1] https://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/
    .. [2] https://en.wikipedia.org/wiki/Quaternion

    g      &@Fr   TNc                 ó  •— t          t          ||||f¦  «        \  }}}}t          d„ ||||fD ¦   «         ¦  «        rt          d¦  «        ‚t	          ¦   «                              | ||||¦  «        }||_        |                     |¦  «         |S )Nc              3   ó(   K  — | ]}|j         d u V — ŒdS )FN)Úis_commutativer!   s     r$   r%   z%Quaternion.__new__.<locals>.<genexpr>r   s*   è è € Ð?Ð?¨QˆqÔ 5Ð(Ð?Ð?Ð?Ð?Ð?Ð?r&   z arguments have to be commutative)Úmapr   Úanyr+   ÚsuperÚ__new__Ú_real_fieldÚset_norm)	ÚclsÚaÚbÚcÚdÚ
real_fieldr/   ÚobjÚ	__class__s	           €r$   rN   zQuaternion.__new__o   s”   ø€ Ý� 1 a¨¨A ,Ñ/Ô/‰
ˆˆ1ˆa�åÐ?Ð?°1°a¸¸A°,Ð?Ñ?Ô?Ñ?Ô?ð 	AÝÐ?Ñ@Ô@Ð@Ý‰gŒg�oŠo˜c 1 a¨¨AÑ.Ô.ˆØ$ˆŒØ�Š�TÑÔÐØˆ
r&   c                 ó\   — t          |¦  «        }t          | j        |¦  «         || _        dS )aÃ  Sets norm of an already instantiated quaternion.

        Parameters
        ==========

        norm : None or number
            Pre-defined quaternion norm. If a value is given, Quaternion.norm
            returns this pre-defined value instead of calculating the norm

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy.abc import a, b, c, d
        >>> q = Quaternion(a, b, c, d)
        >>> q.norm()
        sqrt(a**2 + b**2 + c**2 + d**2)

        Setting the norm:

        >>> q.set_norm(1)
        >>> q.norm()
        1

        Removing set norm:

        >>> q.set_norm(None)
        >>> q.norm()
        sqrt(a**2 + b**2 + c**2 + d**2)

        N)r   r1   ÚargsÚ_norm)Úselfr/   s     r$   rP   zQuaternion.set_normy   s-   € õ@ �t‰}Œ}ˆÝ�D”I˜tÑ$Ô$Ð$ØˆŒ
ˆ
ˆ
r&   c                 ó   — | j         d         S )Nr   ©rZ   ©r\   s    r$   rR   zQuaternion.a�   ó   € àŒy˜Œ|Ðr&   c                 ó   — | j         d         S )Né   r^   r_   s    r$   rS   zQuaternion.b¡   r`   r&   c                 ó   — | j         d         S )Nr'   r^   r_   s    r$   rT   zQuaternion.c¥   r`   r&   c                 ó   — | j         d         S )Nr3   r^   r_   s    r$   rU   zQuaternion.d©   r`   r&   c                 ó   — | j         S ©N)rO   r_   s    r$   rV   zQuaternion.real_field­   s   € àÔÐr&   c           	      óô   — t          | j        | j         | j         | j         g| j        | j        | j         | j        g| j        | j        | j        | j         g| j        | j         | j        | j        gg¦  «        S )aœ  Returns 4 x 4 Matrix equivalent to a Hamilton product from the
        left. This can be useful when treating quaternion elements as column
        vectors. Given a quaternion $q = a + bi + cj + dk$ where a, b, c and d
        are real numbers, the product matrix from the left is:

        .. math::

            M  =  \begin{bmatrix} a  &-b  &-c  &-d \\
                                  b  & a  &-d  & c \\
                                  c  & d  & a  &-b \\
                                  d  &-c  & b  & a \end{bmatrix}

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy.abc import a, b, c, d
        >>> q1 = Quaternion(1, 0, 0, 1)
        >>> q2 = Quaternion(a, b, c, d)
        >>> q1.product_matrix_left
        Matrix([
        [1, 0,  0, -1],
        [0, 1, -1,  0],
        [0, 1,  1,  0],
        [1, 0,  0,  1]])

        >>> q1.product_matrix_left * q2.to_Matrix()
        Matrix([
        [a - d],
        [b - c],
        [b + c],
        [a + d]])

        This is equivalent to:

        >>> (q1 * q2).to_Matrix()
        Matrix([
        [a - d],
        [b - c],
        [b + c],
        [a + d]])
        ©ÚMatrixrR   rS   rT   rU   r_   s    r$   Úproduct_matrix_leftzQuaternion.product_matrix_left±   sx   € õX Ø”˜$œ&˜ 4¤6 '¨D¬F¨7Ð3Ø”˜œ $¤& ¨$¬&Ð1Ø”˜œ ¤¨$¬&¨Ð1Ø”˜$œ&˜ $¤&¨$¬&Ð1ð	3ñ 4ô 4ð 	4r&   c           	      óô   — t          | j        | j         | j         | j         g| j        | j        | j        | j         g| j        | j         | j        | j        g| j        | j        | j         | j        gg¦  «        S )aM  Returns 4 x 4 Matrix equivalent to a Hamilton product from the
        right. This can be useful when treating quaternion elements as column
        vectors. Given a quaternion $q = a + bi + cj + dk$ where a, b, c and d
        are real numbers, the product matrix from the left is:

        .. math::

            M  =  \begin{bmatrix} a  &-b  &-c  &-d \\
                                  b  & a  & d  &-c \\
                                  c  &-d  & a  & b \\
                                  d  & c  &-b  & a \end{bmatrix}


        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy.abc import a, b, c, d
        >>> q1 = Quaternion(a, b, c, d)
        >>> q2 = Quaternion(1, 0, 0, 1)
        >>> q2.product_matrix_right
        Matrix([
        [1, 0, 0, -1],
        [0, 1, 1, 0],
        [0, -1, 1, 0],
        [1, 0, 0, 1]])

        Note the switched arguments: the matrix represents the quaternion on
        the right, but is still considered as a matrix multiplication from the
        left.

        >>> q2.product_matrix_right * q1.to_Matrix()
        Matrix([
        [ a - d],
        [ b + c],
        [-b + c],
        [ a + d]])

        This is equivalent to:

        >>> (q1 * q2).to_Matrix()
        Matrix([
        [ a - d],
        [ b + c],
        [-b + c],
        [ a + d]])
        rh   r_   s    r$   Úproduct_matrix_rightzQuaternion.product_matrix_rightã   sx   € õb Ø”˜$œ&˜ 4¤6 '¨D¬F¨7Ð3Ø”˜œ ¤¨$¬&¨Ð1Ø”˜$œ&˜ $¤&¨$¬&Ð1Ø”˜œ $¤& ¨$¬&Ð1ð	3ñ 4ô 4ð 	4r&   c                 óf   — |rt          | j        dd…         ¦  «        S t          | j        ¦  «        S )a³  Returns elements of quaternion as a column vector.
        By default, a ``Matrix`` of length 4 is returned, with the real part as the
        first element.
        If ``vector_only`` is ``True``, returns only imaginary part as a Matrix of
        length 3.

        Parameters
        ==========

        vector_only : bool
            If True, only imaginary part is returned.
            Default value: False

        Returns
        =======

        Matrix
            A column vector constructed by the elements of the quaternion.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy.abc import a, b, c, d
        >>> q = Quaternion(a, b, c, d)
        >>> q
        a + b*i + c*j + d*k

        >>> q.to_Matrix()
        Matrix([
        [a],
        [b],
        [c],
        [d]])


        >>> q.to_Matrix(vector_only=True)
        Matrix([
        [b],
        [c],
        [d]])

        rb   N)ri   rZ   )r\   Úvector_onlys     r$   Ú	to_MatrixzQuaternion.to_Matrix  s5   € ðX ð 	%Ý˜$œ) A B Bœ-Ñ(Ô(Ð(å˜$œ)Ñ$Ô$Ð$r&   c                 ó´   — t          |¦  «        }|dk    r(|dk    r"t          d                     |¦  «        ¦  «        ‚|dk    rt          dg|¢R Ž S t          |Ž S )aû  Returns quaternion from elements of a column vector`.
        If vector_only is True, returns only imaginary part as a Matrix of
        length 3.

        Parameters
        ==========

        elements : Matrix, list or tuple of length 3 or 4. If length is 3,
            assume real part is zero.
            Default value: False

        Returns
        =======

        Quaternion
            A quaternion created from the input elements.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy.abc import a, b, c, d
        >>> q = Quaternion.from_Matrix([a, b, c, d])
        >>> q
        a + b*i + c*j + d*k

        >>> q = Quaternion.from_Matrix([b, c, d])
        >>> q
        0 + b*i + c*j + d*k

        r3   é   z7Input elements must have length 3 or 4, got {} elementsr   )r8   r+   r9   rG   )rQ   r.   Úlengths      r$   Úfrom_MatrixzQuaternion.from_MatrixK  so   € õB �X‘”ˆØ�QŠ;ˆ;˜6 Qš;˜;Ýð (ß(.ª¨v©¬ñ8ô 8ð 8ð �QŠ;ˆ;Ý˜aÐ+ (Ð+Ð+Ð+Ð+å˜xÐ(Ð(r&   c                 óî  ‡
‡‡— t          |¦  «        dk    rt          d¦  «        ‚t          |¦  «        }|                     ¦   «         \  Š
ŠŠˆ
fd„dD ¦   «         }ˆfd„dD ¦   «         }ˆfd„dD ¦   «         }|                      ||d         ¦  «        }|                      ||d         ¦  «        }|                      ||d	         ¦  «        }	|rt          |	|z  |z  ¦  «        S t          ||z  |	z  ¦  «        S )
aâ  Returns quaternion equivalent to rotation represented by the Euler
        angles, in the sequence defined by ``seq``.

        Parameters
        ==========

        angles : list, tuple or Matrix of 3 numbers
            The Euler angles (in radians).
        seq : string of length 3
            Represents the sequence of rotations.
            For extrinsic rotations, seq must be all lowercase and its elements
            must be from the set ``{'x', 'y', 'z'}``
            For intrinsic rotations, seq must be all uppercase and its elements
            must be from the set ``{'X', 'Y', 'Z'}``

        Returns
        =======

        Quaternion
            The normalized rotation quaternion calculated from the Euler angles
            in the given sequence.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import pi
        >>> q = Quaternion.from_euler([pi/2, 0, 0], 'xyz')
        >>> q
        sqrt(2)/2 + sqrt(2)/2*i + 0*j + 0*k

        >>> q = Quaternion.from_euler([0, pi/2, pi] , 'zyz')
        >>> q
        0 + (-sqrt(2)/2)*i + 0*j + sqrt(2)/2*k

        >>> q = Quaternion.from_euler([0, pi/2, pi] , 'ZYZ')
        >>> q
        0 + sqrt(2)/2*i + 0*j + sqrt(2)/2*k

        r3   z3 angles must be given.c                 ó$   •— g | ]}|‰k    rd nd‘ŒS ©rb   r   r)   )r"   Únr#   s     €r$   ú
<listcomp>z)Quaternion.from_euler.<locals>.<listcomp>¨  ó%   ø€ Ð0Ð0Ð0 Q�1˜’6�6ˆaˆa˜qÐ0Ð0Ð0r&   Úxyzc                 ó$   •— g | ]}|‰k    rd nd‘ŒS rv   r)   )r"   rw   rB   s     €r$   rx   z)Quaternion.from_euler.<locals>.<listcomp>©  ry   r&   c                 ó$   •— g | ]}|‰k    rd nd‘ŒS rv   r)   )r"   rw   rC   s     €r$   rx   z)Quaternion.from_euler.<locals>.<listcomp>ª  ry   r&   r   rb   r'   )r8   r+   rE   r<   Úfrom_axis_angler   )rQ   Úanglesr?   rA   ÚeiÚejÚekÚqiÚqjÚqkr#   rB   rC   s             @@@r$   Ú
from_eulerzQuaternion.from_eulerv  s  øøø€ õV ˆv‰;Œ;˜!ÒÐÝÐ6Ñ7Ô7Ð7å! #Ñ&Ô&ˆ	Ø—)’)‘+”+‰ˆˆ1ˆað 1Ð0Ð0Ð0¨%Ð0Ñ0Ô0ˆØ0Ð0Ð0Ð0¨%Ð0Ñ0Ô0ˆØ0Ð0Ð0Ð0¨%Ð0Ñ0Ô0ˆð × Ò   V¨A¤YÑ/Ô/ˆØ× Ò   V¨A¤YÑ/Ô/ˆØ× Ò   V¨A¤YÑ/Ô/ˆàð 	*Ý˜B ™G b™LÑ)Ô)Ð)å˜B ™G b™LÑ)Ô)Ð)r&   c           	      óV  — |                       ¦   «         rt          d¦  «        ‚g d¢}t          |¦  «        }|                     ¦   «         \  }}}d                     |¦  «        dz   }d                     |¦  «        dz   }d                     |¦  «        dz   }|s||}}||k    }	|	rd|z
  |z
  }||z
  ||z
  z  ||z
  z  dz  }
| j        | j        | j        | j        g}|d         }||         }||         }||         |
z  }|	s||z
  ||z   ||z   ||z
  f\  }}}}|r‰|	rB|  	                    ¦   «         dz  }t          ||z  ||z  z   ||z  z
  ||z  z
  |z  ¦  «        |d<   n¦d|  	                    ¦   «         dz  z  }t          ||z  ||z  z   ||z  z
  ||z  z
  |z  ¦  «        |d<   nadt          t          ||z  ||z  z   ¦  «        t          ||z  ||z  z   ¦  «        ¦  «        z  |d<   |	s|dxx         t          j        dz  z  cc<   d}t!          |t          j        ¦  «        rt!          |t          j        ¦  «        rd}t!          |t          j        ¦  «        rt!          |t          j        ¦  «        rd}|dk    r–|rIt          ||¦  «        t          ||¦  «        z   |d<   t          ||¦  «        t          ||¦  «        z
  |d<   n®t          ||z  ||z  z   ||z  ||z  z
  ¦  «        |d<   t          ||z  ||z  z
  ||z  ||z  z   ¦  «        |d<   nct          j        |d| z  <   |dk    rdt          ||¦  «        z  |d|z  <   n0dt          ||¦  «        z  |d|z  <   |d|z  xx         |rdndz  cc<   |	s|dxx         |
z  cc<   |rt%          |d	d	d…         ¦  «        S t%          |¦  «        S )
a}  Returns Euler angles representing same rotation as the quaternion,
        in the sequence given by ``seq``. This implements the method described
        in [1]_.

        For degenerate cases (gymbal lock cases), the third angle is
        set to zero.

        Parameters
        ==========

        seq : string of length 3
            Represents the sequence of rotations.
            For extrinsic rotations, seq must be all lowercase and its elements
            must be from the set ``{'x', 'y', 'z'}``
            For intrinsic rotations, seq must be all uppercase and its elements
            must be from the set ``{'X', 'Y', 'Z'}``

        angle_addition : bool
            When True, first and third angles are given as an addition and
            subtraction of two simpler ``atan2`` expressions. When False, the
            first and third angles are each given by a single more complicated
            ``atan2`` expression. This equivalent expression is given by:

            .. math::

                \operatorname{atan_2} (b,a) \pm \operatorname{atan_2} (d,c) =
                \operatorname{atan_2} (bc\pm ad, ac\mp bd)

            Default value: True

        avoid_square_root : bool
            When True, the second angle is calculated with an expression based
            on ``acos``, which is slightly more complicated but avoids a square
            root. When False, second angle is calculated with ``atan2``, which
            is simpler and can be better for numerical reasons (some
            numerical implementations of ``acos`` have problems near zero).
            Default value: False


        Returns
        =======

        Tuple
            The Euler angles calculated from the quaternion

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy.abc import a, b, c, d
        >>> euler = Quaternion(a, b, c, d).to_euler('zyz')
        >>> euler
        (-atan2(-b, c) + atan2(d, a),
         2*atan2(sqrt(b**2 + c**2), sqrt(a**2 + d**2)),
         atan2(-b, c) + atan2(d, a))


        References
        ==========

        .. [1] https://doi.org/10.1371/journal.pone.0276302

        z(Cannot convert a quaternion with norm 0.)r   r   r   rz   rb   é   r'   r   éÿÿÿÿN)Úis_zero_quaternionr+   rE   r<   ÚindexrR   rS   rT   rU   r/   r   r   r   r   r   ÚPir   ÚZeroÚtuple)r\   r?   Úangle_additionÚavoid_square_rootr~   rA   r#   rB   rC   Ú	symmetricr	   r.   rR   rS   rT   rU   Ún2Úcases                     r$   Úto_eulerzQuaternion.to_euler¶  s*  € ð@ ×"Ò"Ñ$Ô$ð 	IÝÐGÑHÔHÐHà��ˆå! #Ñ&Ô&ˆ	Ø—)’)‘+”+‰ˆˆ1ˆað �KŠK˜‰NŒN˜QÑˆØ�KŠK˜‰NŒN˜QÑˆØ�KŠK˜‰NŒN˜QÑˆàð 	Ø�aˆqˆAð ˜’Fˆ	Øð 	Ø�A‘˜‘	ˆAð �A‘˜!˜a™%Ñ  A¨¡EÑ*¨aÑ/ˆð ”F˜DœF D¤F¨D¬FÐ3ˆØ�QŒKˆØ�QŒKˆØ�QŒKˆØ�QŒK˜$Ñˆàð 	4Ø˜Q™  A¡ q¨1¡u¨a°!©eÐ3‰JˆAˆq�!�Qàð 
	&Øð GØ—Y’Y‘[”[ !‘^�Ý  ! a¡%¨!¨a©%¡-°!°a±%Ñ"7¸!¸a¹%Ñ"?À2Ñ!EÑFÔF��q‘	�	à˜Ÿš™œ a™Ñ'�Ý  ! a¡%¨!¨a©%¡-°!°a±%Ñ"7¸!¸a¹%Ñ"?À2Ñ!EÑFÔF��q‘	�	à�E¥$ q¨1¡u¨q°1©u¡}Ñ"5Ô"5µt¸AÀ¹EÀAÈÁE¹MÑ7JÔ7JÑKÔKÑKˆF�1‰IØð &Ø�q�	�	”	�QœT A™XÑ%�	�	‘	ð ˆÝ�•A”FÑÔð 	¥ a­¬Ñ 0Ô 0ð 	ØˆDÝ�•A”FÑÔð 	¥ a­¬Ñ 0Ô 0ð 	ØˆDà�1Š9ˆ9Øð 8Ý! ! Q™KœK­%°°1©+¬+Ñ5��q‘	Ý! ! Q™KœK­%°°1©+¬+Ñ5��q‘	�	å! ! A¡#¨¨!©¡)¨Q¨q©S°1°Q±3©YÑ7Ô7��q‘	Ý! ! A¡#¨¨!©¡)¨Q¨q©S°1°Q±3©YÑ7Ô7��q‘	�	õ +,¬&ˆF�1˜I˜Ñ&Ñ'Ø�qŠyˆyØ()­E°!°Q©K¬K©��q˜9‘}Ñ%Ð%à()­E°!°Q©K¬K©��q˜9‘}Ñ%Ø�q˜9‘}Ð%Ð%Ô%°	Ð*@¨"¨"¸qÑAÐ%Ð%Ñ%ð ð 	Ø�1ˆIˆIŒI˜ÑˆIˆI‰Iàð 	!Ý˜   " œÑ&Ô&Ð&å˜‘=”=Ð r&   c                 ó  — |\  }}}t          |dz  |dz  z   |dz  z   ¦  «        }||z  ||z  ||z  }}}t          |t          j        z  ¦  «        }t	          |t          j        z  ¦  «        }||z  }	||z  }
||z  } | ||	|
|¦  «        S )aÈ  Returns a rotation quaternion given the axis and the angle of rotation.

        Parameters
        ==========

        vector : tuple of three numbers
            The vector representation of the given axis.
        angle : number
            The angle by which axis is rotated (in radians).

        Returns
        =======

        Quaternion
            The normalized rotation quaternion calculated from the given axis and the angle of rotation.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import pi, sqrt
        >>> q = Quaternion.from_axis_angle((sqrt(3)/3, sqrt(3)/3, sqrt(3)/3), 2*pi/3)
        >>> q
        1/2 + 1/2*i + 1/2*j + 1/2*k

        r'   )r   r   r   ÚHalfr   )rQ   ÚvectorÚangleÚxÚyÚzr/   ÚsrR   rS   rT   rU   s               r$   r}   zQuaternion.from_axis_angleD  s¡   € ð8 ‰	ˆˆAˆqÝ�A�q‘D˜1˜a™4‘K ! Q¡$Ñ&Ñ'Ô'ˆØ˜‘X˜q 4™x¨¨T©ˆqˆAˆÝ��œ‘ÑÔˆÝ��œ‘ÑÔˆØ�‰EˆØ�‰EˆØ�‰Eˆð ˆs�1�a˜˜A‰ŒÐr&   c                 óž  — |                      ¦   «         t          dd¦  «        z  }t          ||d         z   |d         z   |d         z   ¦  «        dz  }t          ||d         z   |d         z
  |d         z
  ¦  «        dz  }t          ||d         z
  |d         z   |d         z
  ¦  «        dz  }t          ||d         z
  |d         z
  |d         z   ¦  «        dz  }|t          |d         |d         z
  ¦  «        z  }|t          |d	         |d
         z
  ¦  «        z  }|t          |d         |d         z
  ¦  «        z  }t	          ||||¦  «        S )a—  Returns the equivalent quaternion of a matrix. The quaternion will be normalized
        only if the matrix is special orthogonal (orthogonal and det(M) = 1).

        Parameters
        ==========

        M : Matrix
            Input matrix to be converted to equivalent quaternion. M must be special
            orthogonal (orthogonal and det(M) = 1) for the quaternion to be normalized.

        Returns
        =======

        Quaternion
            The quaternion equivalent to given matrix.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import Matrix, symbols, cos, sin, trigsimp
        >>> x = symbols('x')
        >>> M = Matrix([[cos(x), -sin(x), 0], [sin(x), cos(x), 0], [0, 0, 1]])
        >>> q = trigsimp(Quaternion.from_rotation_matrix(M))
        >>> q
        sqrt(2)*sqrt(cos(x) + 1)/2 + 0*i + 0*j + sqrt(2 - 2*cos(x))*sign(sin(x))/2*k

        rb   r3   )r   r   )rb   rb   )r'   r'   r'   )r'   rb   )rb   r'   )r   r'   )r'   r   rv   )r   rb   )Údetr   r   r	   rG   )rQ   ÚMÚabsQrR   rS   rT   rU   s          r$   Úfrom_rotation_matrixzQuaternion.from_rotation_matrixo  s?  € ð> �uŠu‰wŒw�  A™œÑ&ˆå�˜˜$œ‘ ! D¤'Ñ)¨A¨d¬GÑ3Ñ4Ô4°qÑ8ˆÝ�˜˜$œ‘ ! D¤'Ñ)¨A¨d¬GÑ3Ñ4Ô4°qÑ8ˆÝ�˜˜$œ‘ ! D¤'Ñ)¨A¨d¬GÑ3Ñ4Ô4°qÑ8ˆÝ�˜˜$œ‘ ! D¤'Ñ)¨A¨d¬GÑ3Ñ4Ô4°qÑ8ˆà•�Q�t”W˜q œwÑ&Ñ'Ô'Ñ'ˆØ•�Q�t”W˜q œwÑ&Ñ'Ô'Ñ'ˆØ•�Q�t”W˜q œwÑ&Ñ'Ô'Ñ'ˆå˜!˜Q  1Ñ%Ô%Ð%r&   c                 ó,   — |                       |¦  «        S rf   ©Úadd©r\   Úothers     r$   Ú__add__zQuaternion.__add__›  ó   € Ø�xŠx˜‰ŒÐr&   c                 ó,   — |                       |¦  «        S rf   r¢   r¤   s     r$   Ú__radd__zQuaternion.__radd__ž  r§   r&   c                 ó2   — |                       |dz  ¦  «        S ©Nrˆ   r¢   r¤   s     r$   Ú__sub__zQuaternion.__sub__¡  s   € Ø�xŠx˜˜b™Ñ!Ô!Ð!r&   c                 óH   — |                       | t          |¦  «        ¦  «        S rf   ©Ú_generic_mulr   r¤   s     r$   Ú__mul__zQuaternion.__mul__¤  s   € Ø× Ò  ¥x°¡¤Ñ7Ô7Ð7r&   c                 óH   — |                       t          |¦  «        | ¦  «        S rf   r®   r¤   s     r$   Ú__rmul__zQuaternion.__rmul__§  s   € Ø× Ò ¥¨%¡¤°$Ñ7Ô7Ð7r&   c                 ó,   — |                       |¦  «        S rf   )Úpow)r\   Úps     r$   Ú__pow__zQuaternion.__pow__ª  s   € Ø�xŠx˜‰{Œ{Ðr&   c                 óV   — t          | j         | j         | j         | j         ¦  «        S rf   )rG   rR   rS   rT   rU   r_   s    r$   Ú__neg__zQuaternion.__neg__­  s&   € Ý˜4œ6˜' D¤F 7¨T¬V¨G°d´f°WÑ=Ô=Ð=r&   c                 ó,   — | t          |¦  «        dz  z  S r«   ©r   r¤   s     r$   Ú__truediv__zQuaternion.__truediv__°  s   € Ø•g˜e‘n”n bÑ(Ñ(Ð(r&   c                 ó,   — t          |¦  «        | dz  z  S r«   rº   r¤   s     r$   Ú__rtruediv__zQuaternion.__rtruediv__³  s   € Ý�u‰~Œ~  b¡Ñ(Ð(r&   c                 ó   —  | j         |Ž S rf   r   ©r\   rZ   s     r$   Ú_eval_IntegralzQuaternion._eval_Integral¶  s   € ØˆtŒ~˜tÐ$Ð$r&   c                 ój   ‡‡— ‰                      dd¦  «          | j        ˆˆfd„| j        D ¦   «         Ž S )NÚevaluateTc                 ó*   •— g | ]} |j         ‰i ‰¤Ž‘ŒS r)   )Údiff)r"   rR   ÚkwargsÚsymbolss     €€r$   rx   z#Quaternion.diff.<locals>.<listcomp>»  s*   ø€ ÐJÐJÐJ¸!˜6˜1œ6 7Ð5¨fÐ5Ð5ÐJÐJÐJr&   )Ú
setdefaultÚfuncrZ   )r\   rÆ   rÅ   s    ``r$   rÄ   zQuaternion.diff¹  sC   øø€ Ø×Ò˜* dÑ+Ô+Ð+ØˆtŒyÐJÐJÐJÐJÐJÀÄ	ÐJÑJÔJÐKÐKr&   c                 ó   — | }t          |¦  «        }t          |t          ¦  «        s“|j        rM|j        rFt          t          |¦  «        |j        z   t          |¦  «        |j        z   |j	        |j
        ¦  «        S |j        r)t          |j        |z   |j        |j	        |j
        ¦  «        S t          d¦  «        ‚t          |j        |j        z   |j        |j        z   |j	        |j	        z   |j
        |j
        z   ¦  «        S )a¯  Adds quaternions.

        Parameters
        ==========

        other : Quaternion
            The quaternion to add to current (self) quaternion.

        Returns
        =======

        Quaternion
            The resultant quaternion after adding self to other

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import symbols
        >>> q1 = Quaternion(1, 2, 3, 4)
        >>> q2 = Quaternion(5, 6, 7, 8)
        >>> q1.add(q2)
        6 + 8*i + 10*j + 12*k
        >>> q1 + 5
        6 + 2*i + 3*j + 4*k
        >>> x = symbols('x', real = True)
        >>> q1.add(x)
        (x + 1) + 2*i + 3*j + 4*k

        Quaternions over complex fields :

        >>> from sympy import Quaternion
        >>> from sympy import I
        >>> q3 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False)
        >>> q3.add(2 + 3*I)
        (5 + 7*I) + (2 + 5*I)*i + 0*j + (7 + 8*I)*k

        z<Only commutative expressions can be added with a Quaternion.)r   Ú
isinstancerG   rV   Ú
is_complexr   rR   r   rS   rT   rU   rJ   r+   )r\   r¥   Úq1Úq2s       r$   r£   zQuaternion.add½  sé   € ðN ˆÝ�U‰^Œ^ˆõ ˜"�jÑ)Ô)ð 	aØŒ}ð a ¤ð aÝ!¥" R¡&¤&¨2¬4¡-µ°B±´¸"¼$±ÀÄÀbÄdÑKÔKÐKØÔ"ð aÝ! "¤$¨¡)¨R¬T°2´4¸¼Ñ>Ô>Ð>å Ð!_Ñ`Ô`Ð`å˜"œ$ ¤™+ r¤t¨b¬d¡{°B´D¸2¼4±KÀÄØœDñB!ñ "ô "ð 	"r&   c                 óH   — |                       | t          |¦  «        ¦  «        S )añ  Multiplies quaternions.

        Parameters
        ==========

        other : Quaternion or symbol
            The quaternion to multiply to current (self) quaternion.

        Returns
        =======

        Quaternion
            The resultant quaternion after multiplying self with other

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import symbols
        >>> q1 = Quaternion(1, 2, 3, 4)
        >>> q2 = Quaternion(5, 6, 7, 8)
        >>> q1.mul(q2)
        (-60) + 12*i + 30*j + 24*k
        >>> q1.mul(2)
        2 + 4*i + 6*j + 8*k
        >>> x = symbols('x', real = True)
        >>> q1.mul(x)
        x + 2*x*i + 3*x*j + 4*x*k

        Quaternions over complex fields :

        >>> from sympy import Quaternion
        >>> from sympy import I
        >>> q3 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False)
        >>> q3.mul(2 + 3*I)
        (2 + 3*I)*(3 + 4*I) + (2 + 3*I)*(2 + 5*I)*i + 0*j + (2 + 3*I)*(7 + 8*I)*k

        r®   r¤   s     r$   ÚmulzQuaternion.muló  s!   € ðN × Ò  ¥x°¡¤Ñ7Ô7Ð7r&   c                 óP  — t          | t          ¦  «        st          |t          ¦  «        s| |z  S t          | t          ¦  «        s…|j        r6| j        r/t          t	          | ¦  «        t          | ¦  «        dd¦  «        |z  S | j        r2t          | |j        z  | |j        z  | |j	        z  | |j
        z  ¦  «        S t          d¦  «        ‚t          |t          ¦  «        s…| j        r6|j        r/| t          t	          |¦  «        t          |¦  «        dd¦  «        z  S |j        r2t          || j        z  || j        z  || j	        z  || j
        z  ¦  «        S t          d¦  «        ‚| j        €
|j        €d}n)|                      ¦   «         |                     ¦   «         z  }t          | j         |j        z  | j	        |j	        z  z
  | j
        |j
        z  z
  | j        |j        z  z   | j        |j        z  | j	        |j
        z  z   | j
        |j	        z  z
  | j        |j        z  z   | j         |j
        z  | j	        |j        z  z   | j
        |j        z  z   | j        |j	        z  z   | j        |j	        z  | j	        |j        z  z
  | j
        |j        z  z   | j        |j
        z  z   |¬¦  «        S )an  Generic multiplication.

        Parameters
        ==========

        q1 : Quaternion or symbol
        q2 : Quaternion or symbol

        It is important to note that if neither q1 nor q2 is a Quaternion,
        this function simply returns q1 * q2.

        Returns
        =======

        Quaternion
            The resultant quaternion after multiplying q1 and q2

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import Symbol, S
        >>> q1 = Quaternion(1, 2, 3, 4)
        >>> q2 = Quaternion(5, 6, 7, 8)
        >>> Quaternion._generic_mul(q1, q2)
        (-60) + 12*i + 30*j + 24*k
        >>> Quaternion._generic_mul(q1, S(2))
        2 + 4*i + 6*j + 8*k
        >>> x = Symbol('x', real = True)
        >>> Quaternion._generic_mul(q1, x)
        x + 2*x*i + 3*x*j + 4*x*k

        Quaternions over complex fields :

        >>> from sympy import I
        >>> q3 = Quaternion(3 + 4*I, 2 + 5*I, 0, 7 + 8*I, real_field = False)
        >>> Quaternion._generic_mul(q3, 2 + 3*I)
        (2 + 3*I)*(3 + 4*I) + (2 + 3*I)*(2 + 5*I)*i + 0*j + (2 + 3*I)*(7 + 8*I)*k

        r   zAOnly commutative expressions can be multiplied with a Quaternion.N©r/   )rÊ   rG   rV   rË   r   r   rJ   rR   rS   rT   rU   r+   r[   r/   )rÌ   rÍ   r/   s      r$   r¯   zQuaternion._generic_mul  st  € õV ˜"�jÑ)Ô)ð 	µ*¸RÅÑ2LÔ2Lð 	Ø˜‘7ˆNõ ˜"�jÑ)Ô)ð 	fØŒ}ð f ¤ð fÝ!¥" R¡&¤&­"¨R©&¬&°!°QÑ7Ô7¸"Ñ<Ð<ØÔ"ð fÝ! " r¤t¡)¨R°"´$©Y¸¸R¼T¹	À2ÈÌÁ9ÑMÔMÐMå Ð!dÑeÔeÐeõ ˜"�jÑ)Ô)ð 	fØŒ}ð f ¤ð fØ�J¥r¨"¡v¤v­r°"©v¬v°q¸!Ñ<Ô<Ñ<Ð<ØÔ"ð fÝ! " r¤t¡)¨R°"´$©Y¸¸R¼T¹	À2ÈÌÁ9ÑMÔMÐMå Ð!dÑeÔeÐeð Œ8Ð ¤Ð 0ØˆDˆDà—7’7‘9”9˜rŸwšw™yœyÑ(ˆDå˜2œ4˜% ¤™* r¤t¨B¬D¡yÑ0°2´4¸¼±9Ñ<¸r¼tÀBÄD¹yÑHØœ$˜rœt™) b¤d¨2¬4¡iÑ/°"´$°r´t±)Ñ;¸b¼dÀ2Ä4¹iÑGØœ4˜% ¤™* r¤t¨B¬D¡yÑ0°2´4¸¼±9Ñ<¸r¼tÀBÄD¹yÑHØœ$˜rœt™) b¤d¨2¬4¡iÑ/°"´$°r´t±)Ñ;¸b¼dÀRÄT¹kÑIØ#ð	%ñ %ô %ð 	%r&   c                 óf   — | }t          |j        |j         |j         |j         |j        ¬¦  «        S )z(Returns the conjugate of the quaternion.rÑ   )rG   rR   rS   rT   rU   r[   ©r\   Úqs     r$   Ú_eval_conjugatezQuaternion._eval_conjugateh  s0   € àˆÝ˜!œ# ¤˜t a¤c T¨A¬C¨4°a´gÐ>Ñ>Ô>Ð>r&   c                 ó¬   — | j         €G| }t          t          |j        dz  |j        dz  z   |j        dz  z   |j        dz  z   ¦  «        ¦  «        S | j         S )z#Returns the norm of the quaternion.Nr'   )r[   r   r   rR   rS   rT   rU   rÓ   s     r$   r/   zQuaternion.normm  sU   € àŒ:ÐØˆAõ � ¤ a¡¨!¬#¨q©&¡°1´3¸±6Ñ!9¸A¼CÀ¹FÑ!BÑCÔCÑDÔDÐDàŒzÐr&   c                 ó:   — | }|d|                      ¦   «         z  z  S )z.Returns the normalized form of the quaternion.rb   rÑ   rÓ   s     r$   Ú	normalizezQuaternion.normalizew  s   € àˆØ�A�a—f’f‘h”h‘JÑÐr&   c                 ó    — | }|                      ¦   «         st          d¦  «        ‚t          |¦  «        d|                      ¦   «         dz  z  z  S )z&Returns the inverse of the quaternion.z6Cannot compute inverse for a quaternion with zero normrb   r'   )r/   r+   r   rÓ   s     r$   ÚinversezQuaternion.inverse|  sH   € àˆØ�vŠv‰xŒxð 	WÝÐUÑVÔVÐVÝ˜‰|Œ|˜q §¢¡¤¨1¡™}Ñ-Ð-r&   c                 ó  — 	 | t          |¦  «        }}n# t          $ r
 t          cY S w xY w|dk     r|                     ¦   «         | }}|dk    r|S t	          dddd¦  «        }|dk    r|dz  r||z  }||z  }|dz  }|dk    °|S )aë  Finds the pth power of the quaternion.

        Parameters
        ==========

        p : int
            Power to be applied on quaternion.

        Returns
        =======

        Quaternion
            Returns the p-th power of the current quaternion.
            Returns the inverse if p = -1.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> q = Quaternion(1, 2, 3, 4)
        >>> q.pow(4)
        668 + (-224)*i + (-336)*j + (-448)*k

        r   rb   )r   r+   ÚNotImplementedrÚ   rG   )r\   rµ   rÔ   Úress       r$   r´   zQuaternion.powƒ  sÀ   € ð2	"Ø� ™œˆqˆAˆAøÝð 	"ð 	"ð 	"Ý!Ð!Ð!Ð!ð	"øøøð ˆqŠ5ˆ5Ø—9’9‘;”;  ˆqˆAà�Š6ˆ6ØˆHå˜˜A˜q !Ñ$Ô$ˆØ�!ŠeˆeØ�1‰uð Ø�q‘�Ø�‰FˆAØ�!‰GˆAð	 �!Šeˆeð ˆ
s   ‚ ”(§(c                 óæ  — | }t          |j        dz  |j        dz  z   |j        dz  z   ¦  «        }t	          |j        ¦  «        t          |¦  «        z  }t	          |j        ¦  «        t          |¦  «        z  |j        z  |z  }t	          |j        ¦  «        t          |¦  «        z  |j        z  |z  }t	          |j        ¦  «        t          |¦  «        z  |j        z  |z  }t          ||||¦  «        S )a»  Returns the exponential of $q$, given by $e^q$.

        Returns
        =======

        Quaternion
            The exponential of the quaternion.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> q = Quaternion(1, 2, 3, 4)
        >>> q.exp()
        E*cos(sqrt(29))
        + 2*sqrt(29)*E*sin(sqrt(29))/29*i
        + 3*sqrt(29)*E*sin(sqrt(29))/29*j
        + 4*sqrt(29)*E*sin(sqrt(29))/29*k

        r'   )	r   rS   rT   rU   r
   rR   r   r   rG   )r\   rÔ   Úvector_normrR   rS   rT   rU   s          r$   r
   zQuaternion.exp°  sÑ   € ð, ˆÝ˜1œ3 ™6 A¤C¨¡F™?¨Q¬S°!©VÑ3Ñ4Ô4ˆÝ�”‰HŒH•s˜;Ñ'Ô'Ñ'ˆÝ�”‰HŒH•s˜;Ñ'Ô'Ñ'¨!¬#Ñ-°Ñ;ˆÝ�”‰HŒH•s˜;Ñ'Ô'Ñ'¨!¬#Ñ-°Ñ;ˆÝ�”‰HŒH•s˜;Ñ'Ô'Ñ'¨!¬#Ñ-°Ñ;ˆå˜!˜Q  1Ñ%Ô%Ð%r&   c                 ó–  — | }t          |j        dz  |j        dz  z   |j        dz  z   ¦  «        }|                     ¦   «         }t          |¦  «        }|j        t          |j        |z  ¦  «        z  |z  }|j        t          |j        |z  ¦  «        z  |z  }|j        t          |j        |z  ¦  «        z  |z  }t          ||||¦  «        S )ag  Returns the logarithm of the quaternion, given by $\log q$.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> q = Quaternion(1, 2, 3, 4)
        >>> q.log()
        log(sqrt(30))
        + 2*sqrt(29)*acos(sqrt(30)/30)/29*i
        + 3*sqrt(29)*acos(sqrt(30)/30)/29*j
        + 4*sqrt(29)*acos(sqrt(30)/30)/29*k

        r'   )	r   rS   rT   rU   r/   Úlnr   rR   rG   )r\   rÔ   rß   Úq_normrR   rS   rT   rU   s           r$   r   zQuaternion.logÏ  sº   € ð  ˆÝ˜1œ3 ™6 A¤C¨¡F™?¨Q¬S°!©VÑ3Ñ4Ô4ˆØ—’‘”ˆÝˆv‰JŒJˆØŒC•$�q”s˜V‘|Ñ$Ô$Ñ$ {Ñ2ˆØŒC•$�q”s˜V‘|Ñ$Ô$Ñ$ {Ñ2ˆØŒC•$�q”s˜V‘|Ñ$Ô$Ñ$ {Ñ2ˆå˜!˜Q  1Ñ%Ô%Ð%r&   c                 óˆ   ‡— ˆfd„| j         D ¦   «         }| j        }|�
 |j        ‰Ž }t          ||¦  «         t	          |d|iŽS )Nc                 ó$   •— g | ]} |j         ‰Ž ‘ŒS r)   )Úsubs)r"   r#   rZ   s     €r$   rx   z)Quaternion._eval_subs.<locals>.<listcomp>ê  s!   ø€ Ð5Ð5Ð5 a�F�A”F˜D�MÐ5Ð5Ð5r&   r/   )rZ   r[   rå   r1   rG   )r\   rZ   r.   r/   s    `  r$   Ú
_eval_subszQuaternion._eval_subsé  s\   ø€ Ø5Ð5Ð5Ð5¨4¬9Ð5Ñ5Ô5ˆØŒzˆØÐØ�4”9˜dÐ#ˆDÝ�H˜dÑ#Ô#Ð#Ý˜8Ð/¨$Ð/Ð/Ð/r&   c                 óV   ‡— t          |¦  «        Št          ˆfd„| j        D ¦   «         Ž S )a  Returns the floating point approximations (decimal numbers) of the quaternion.

        Returns
        =======

        Quaternion
            Floating point approximations of quaternion(self)

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import sqrt
        >>> q = Quaternion(1/sqrt(1), 1/sqrt(2), 1/sqrt(3), 1/sqrt(4))
        >>> q.evalf()
        1.00000000000000
        + 0.707106781186547*i
        + 0.577350269189626*j
        + 0.500000000000000*k

        c                 ó<   •— g | ]}|                      ‰¬ ¦  «        ‘ŒS ))rw   )Úevalf)r"   ÚargÚnprecs     €r$   rx   z*Quaternion._eval_evalf.<locals>.<listcomp>  s'   ø€ ÐDÐDÐD°3˜CŸIšI¨˜IÑ.Ô.ÐDÐDÐDr&   )r   rG   rZ   )r\   Úprecrë   s     @r$   Ú_eval_evalfzQuaternion._eval_evalfñ  s4   ø€ õ, ˜DÑ!Ô!ˆÝÐDÐDÐDÐD¸$¼)ÐDÑDÔDÐEÐEr&   c                 ó¤   — | }|                      ¦   «         \  }}t                               |||z  ¦  «        }||                     ¦   «         |z  z  S )aY  Computes the pth power in the cos-sin form.

        Parameters
        ==========

        p : int
            Power to be applied on quaternion.

        Returns
        =======

        Quaternion
            The p-th power in the cos-sin form.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> q = Quaternion(1, 2, 3, 4)
        >>> q.pow_cos_sin(4)
        900*cos(4*acos(sqrt(30)/30))
        + 1800*sqrt(29)*sin(4*acos(sqrt(30)/30))/29*i
        + 2700*sqrt(29)*sin(4*acos(sqrt(30)/30))/29*j
        + 3600*sqrt(29)*sin(4*acos(sqrt(30)/30))/29*k

        )Úto_axis_anglerG   r}   r/   )r\   rµ   rÔ   Úvr—   rÍ   s         r$   Úpow_cos_sinzQuaternion.pow_cos_sin
  sL   € ð< ˆØ—_’_Ñ&Ô&‰
ˆˆEÝ×'Ò'¨¨1¨u©9Ñ5Ô5ˆØ�Q—V’V‘X”X˜q‘[Ñ!Ð!r&   c           	      ó¦   — t          t          | j        g|¢R Ž t          | j        g|¢R Ž t          | j        g|¢R Ž t          | j        g|¢R Ž ¦  «        S )aŽ  Computes integration of quaternion.

        Returns
        =======

        Quaternion
            Integration of the quaternion(self) with the given variable.

        Examples
        ========

        Indefinite Integral of quaternion :

        >>> from sympy import Quaternion
        >>> from sympy.abc import x
        >>> q = Quaternion(1, 2, 3, 4)
        >>> q.integrate(x)
        x + 2*x*i + 3*x*j + 4*x*k

        Definite integral of quaternion :

        >>> from sympy import Quaternion
        >>> from sympy.abc import x
        >>> q = Quaternion(1, 2, 3, 4)
        >>> q.integrate((x, 1, 5))
        4 + 8*i + 12*j + 16*k

        )rG   r   rR   rS   rT   rU   r¿   s     r$   r   zQuaternion.integrate-  sj   € õ: �) D¤FÐ2¨TÐ2Ð2Ð2µI¸d¼fÐ4LÀtÐ4LÐ4LÐ4LÝ# D¤FÐ2¨TÐ2Ð2Ð2µI¸d¼fÐ4LÀtÐ4LÐ4LÐ4LñNô Nð 	Nr&   c                 ó:  — t          |t          ¦  «        r(t                               |d         |d         ¦  «        }n|                     ¦   «         }|t          d| d         | d         | d         ¦  «        z  t          |¦  «        z  }|j        |j        |j        fS )a  Returns the coordinates of the point pin (a 3 tuple) after rotation.

        Parameters
        ==========

        pin : tuple
            A 3-element tuple of coordinates of a point which needs to be
            rotated.
        r : Quaternion or tuple
            Axis and angle of rotation.

            It's important to note that when r is a tuple, it must be of the form
            (axis, angle)

        Returns
        =======

        tuple
            The coordinates of the point after rotation.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import symbols, trigsimp, cos, sin
        >>> x = symbols('x')
        >>> q = Quaternion(cos(x/2), 0, 0, sin(x/2))
        >>> trigsimp(Quaternion.rotate_point((1, 1, 1), q))
        (sqrt(2)*cos(x + pi/4), sqrt(2)*sin(x + pi/4), 1)
        >>> (axis, angle) = q.to_axis_angle()
        >>> trigsimp(Quaternion.rotate_point((1, 1, 1), (axis, angle)))
        (sqrt(2)*cos(x + pi/4), sqrt(2)*sin(x + pi/4), 1)

        r   rb   r'   )	rÊ   r�   rG   r}   rØ   r   rS   rT   rU   )ÚpinÚrrÔ   Úpouts       r$   Úrotate_pointzQuaternion.rotate_pointM  s‡   € õH �a�ÑÔð 	å×*Ò*¨1¨Q¬4°°1´Ñ6Ô6ˆAˆAð —’‘”ˆAØ•:˜a  Q¤¨¨Q¬°°Q´Ñ8Ô8Ñ8½9ÀQ¹<¼<ÑGˆØ”˜œ ¤Ð'Ð'r&   c                 óv  — | }|j         j        r|dz  }|                     ¦   «         }t          dt	          |j         ¦  «        z  ¦  «        }t          d|j         |j         z  z
  ¦  «        }t          |j        |z  ¦  «        }t          |j        |z  ¦  «        }t          |j        |z  ¦  «        }|||f}||f}|S )a’  Returns the axis and angle of rotation of a quaternion.

        Returns
        =======

        tuple
            Tuple of (axis, angle)

        Examples
        ========

        >>> from sympy import Quaternion
        >>> q = Quaternion(1, 1, 1, 1)
        >>> (axis, angle) = q.to_axis_angle()
        >>> axis
        (sqrt(3)/3, sqrt(3)/3, sqrt(3)/3)
        >>> angle
        2*pi/3

        rˆ   r'   rb   )	rR   Úis_negativerØ   r   r   r   rS   rT   rU   )	r\   rÔ   r—   r›   r˜   r™   rš   rð   Úts	            r$   rï   zQuaternion.to_axis_anglez  s±   € ð* ˆØŒ3Œ?ð 	Ø�B‘ˆAà�KŠK‰MŒMˆÝ˜�T !¤#™YœY™Ñ'Ô'ˆõ ��Q”S˜œ‘W‘ÑÔˆå�Q”S˜1‘WÑÔˆÝ�Q”S˜1‘WÑÔˆÝ�Q”S˜1‘WÑÔˆà��1ˆIˆØ�ˆJˆàˆr&   c           	      óÒ  — | }|                      ¦   «         dz  }|r‹||j        dz  |j        dz  z   |j        dz  z
  |j        dz  z
  z  }||j        dz  |j        dz  z
  |j        dz  z   |j        dz  z
  z  }||j        dz  |j        dz  z
  |j        dz  z
  |j        dz  z   z  }nZdd|z  |j        dz  |j        dz  z   z  z
  }dd|z  |j        dz  |j        dz  z   z  z
  }dd|z  |j        dz  |j        dz  z   z  z
  }d|z  |j        |j        z  |j        |j        z  z
  z  }d|z  |j        |j        z  |j        |j        z  z   z  }	d|z  |j        |j        z  |j        |j        z  z   z  }
d|z  |j        |j        z  |j        |j        z  z
  z  }d|z  |j        |j        z  |j        |j        z  z
  z  }d|z  |j        |j        z  |j        |j        z  z   z  }|st          |||	g|
||g|||gg¦  «        S |\  }}}|||z  z
  ||z  z
  ||	z  z
  }|||
z  z
  ||z  z
  ||z  z
  }|||z  z
  ||z  z
  ||z  z
  }dx}x}}d}t          |||	|g|
|||g||||g||||gg¦  «        S )aÚ  Returns the equivalent rotation transformation matrix of the quaternion
        which represents rotation about the origin if ``v`` is not passed.

        Parameters
        ==========

        v : tuple or None
            Default value: None
        homogeneous : bool
            When True, gives an expression that may be more efficient for
            symbolic calculations but less so for direct evaluation. Both
            formulas are mathematically equivalent.
            Default value: True

        Returns
        =======

        tuple
            Returns the equivalent rotation transformation matrix of the quaternion
            which represents rotation about the origin if v is not passed.

        Examples
        ========

        >>> from sympy import Quaternion
        >>> from sympy import symbols, trigsimp, cos, sin
        >>> x = symbols('x')
        >>> q = Quaternion(cos(x/2), 0, 0, sin(x/2))
        >>> trigsimp(q.to_rotation_matrix())
        Matrix([
        [cos(x), -sin(x), 0],
        [sin(x),  cos(x), 0],
        [     0,       0, 1]])

        Generates a 4x4 transformation matrix (used for rotation about a point
        other than the origin) if the point(v) is passed as an argument.
        éþÿÿÿr'   rb   r   )r/   rR   rS   rT   rU   ri   )r\   rð   ÚhomogeneousrÔ   r›   Úm00Úm11Úm22Úm01Úm02Úm10Úm12Úm20Úm21r˜   r™   rš   Úm03Úm13Úm23Úm30Úm31Úm32Úm33s                           r$   Úto_rotation_matrixzQuaternion.to_rotation_matrix¢  sè  € ðN ˆØ�FŠF‰HŒH�b‰Lˆð ð 	,Ø�Q”S˜!‘V˜aœc 1™f‘_ q¤s¨A¡vÑ-°´°Q±Ñ6Ñ7ˆCØ�Q”S˜!‘V˜aœc 1™f‘_ q¤s¨A¡vÑ-°´°Q±Ñ6Ñ7ˆCØ�Q”S˜!‘V˜aœc 1™f‘_ q¤s¨A¡vÑ-°´°Q±Ñ6Ñ7ˆCˆCà�a˜‘c˜1œ3 ™6 A¤C¨¡F™?Ñ+Ñ+ˆCØ�a˜‘c˜1œ3 ™6 A¤C¨¡F™?Ñ+Ñ+ˆCØ�a˜‘c˜1œ3 ™6 A¤C¨¡F™?Ñ+Ñ+ˆCà�‰c�1”3�q”s‘7˜QœS ¤™WÑ$Ñ%ˆØ�‰c�1”3�q”s‘7˜QœS ¤™WÑ$Ñ%ˆà�‰c�1”3�q”s‘7˜QœS ¤™WÑ$Ñ%ˆØ�‰c�1”3�q”s‘7˜QœS ¤™WÑ$Ñ%ˆà�‰c�1”3�q”s‘7˜QœS ¤™WÑ$Ñ%ˆØ�‰c�1”3�q”s‘7˜QœS ¤™WÑ$Ñ%ˆàð 	GÝ˜C  c˜?¨S°#°s¨O¸cÀ3È¸_ÐMÑNÔNÐNð ‰IˆQ��1à�a˜‘e‘)˜a ™eÑ# a¨¡eÑ+ˆCØ�a˜‘e‘)˜a ™eÑ# a¨¡eÑ+ˆCØ�a˜‘e‘)˜a ™eÑ# a¨¡eÑ+ˆCØÐˆCÐ�#˜ØˆCå˜C  c¨3Ð/°#°s¸CÀÐ1EØ  S¨#Ð.°°c¸3ÀÐ0DðFñ Gô Gð Gr&   c                 ó   — | j         S )am  Returns scalar part($\mathbf{S}(q)$) of the quaternion q.

        Explanation
        ===========

        Given a quaternion $q = a + bi + cj + dk$, returns $\mathbf{S}(q) = a$.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(4, 8, 13, 12)
        >>> q.scalar_part()
        4

        )rR   r_   s    r$   Úscalar_partzQuaternion.scalar_partî  s   € ð$ Œvˆr&   c                 óD   — t          d| j        | j        | j        ¦  «        S )aû  
        Returns $\mathbf{V}(q)$, the vector part of the quaternion $q$.

        Explanation
        ===========

        Given a quaternion $q = a + bi + cj + dk$, returns $\mathbf{V}(q) = bi + cj + dk$.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(1, 1, 1, 1)
        >>> q.vector_part()
        0 + 1*i + 1*j + 1*k

        >>> q = Quaternion(4, 8, 13, 12)
        >>> q.vector_part()
        0 + 8*i + 13*j + 12*k

        r   )rG   rS   rT   rU   r_   s    r$   Úvector_partzQuaternion.vector_part  s   € õ. ˜!˜TœV T¤V¨T¬VÑ4Ô4Ð4r&   c                 ó�   — |                       ¦   «                              ¦   «         }t          d|j        |j        |j        ¦  «        S )aˆ  
        Returns $\mathbf{Ax}(q)$, the axis of the quaternion $q$.

        Explanation
        ===========

        Given a quaternion $q = a + bi + cj + dk$, returns $\mathbf{Ax}(q)$  i.e., the versor of the vector part of that quaternion
        equal to $\mathbf{U}[\mathbf{V}(q)]$.
        The axis is always an imaginary unit with square equal to $-1 + 0i + 0j + 0k$.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(1, 1, 1, 1)
        >>> q.axis()
        0 + sqrt(3)/3*i + sqrt(3)/3*j + sqrt(3)/3*k

        See Also
        ========

        vector_part

        r   )r  rØ   rG   rS   rT   rU   )r\   Úaxiss     r$   r  zQuaternion.axis  s;   € ð2 ×ÒÑ!Ô!×+Ò+Ñ-Ô-ˆå˜!˜TœV T¤V¨T¬VÑ4Ô4Ð4r&   c                 ó   — | j         j        S )a  
        Returns true if the quaternion is pure, false if the quaternion is not pure
        or returns none if it is unknown.

        Explanation
        ===========

        A pure quaternion (also a vector quaternion) is a quaternion with scalar
        part equal to 0.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(0, 8, 13, 12)
        >>> q.is_pure()
        True

        See Also
        ========
        scalar_part

        )rR   Úis_zeror_   s    r$   Úis_purezQuaternion.is_pure8  s   € ð2 ŒvŒ~Ðr&   c                 ó4   — |                       ¦   «         j        S )a‚  
        Returns true if the quaternion is a zero quaternion or false if it is not a zero quaternion
        and None if the value is unknown.

        Explanation
        ===========

        A zero quaternion is a quaternion with both scalar part and
        vector part equal to 0.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(1, 0, 0, 0)
        >>> q.is_zero_quaternion()
        False

        >>> q = Quaternion(0, 0, 0, 0)
        >>> q.is_zero_quaternion()
        True

        See Also
        ========
        scalar_part
        vector_part

        )r/   r  r_   s    r$   r‰   zQuaternion.is_zero_quaternionS  s   € ð< �yŠy‰{Œ{Ô"Ð"r&   c                 ó”   — dt          |                      ¦   «                              ¦   «         |                      ¦   «         ¦  «        z  S )a7  
        Returns the angle of the quaternion measured in the real-axis plane.

        Explanation
        ===========

        Given a quaternion $q = a + bi + cj + dk$ where $a$, $b$, $c$ and $d$
        are real numbers, returns the angle of the quaternion given by

        .. math::
            \theta := 2 \operatorname{atan_2}\left(\sqrt{b^2 + c^2 + d^2}, {a}\right)

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(1, 4, 4, 4)
        >>> q.angle()
        2*atan(4*sqrt(3))

        r'   )r   r  r/   r  r_   s    r$   r—   zQuaternion.angles  s=   € ð. •5˜×)Ò)Ñ+Ô+×0Ò0Ñ2Ô2°D×4DÒ4DÑ4FÔ4FÑGÔGÑGÐGr&   c                 óv  — |                       ¦   «         s|                      ¦   «         rt          d¦  «        ‚t          |                      ¦   «         |                     ¦   «         z
                        ¦   «         |                      ¦   «         |                     ¦   «         z                         ¦   «         g¦  «        S )aS  
        Returns True if the transformation arcs represented by the input quaternions happen in the same plane.

        Explanation
        ===========

        Two quaternions are said to be coplanar (in this arc sense) when their axes are parallel.
        The plane of a quaternion is the one normal to its axis.

        Parameters
        ==========

        other : a Quaternion

        Returns
        =======

        True : if the planes of the two quaternions are the same, apart from its orientation/sign.
        False : if the planes of the two quaternions are not the same, apart from its orientation/sign.
        None : if plane of either of the quaternion is unknown.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q1 = Quaternion(1, 4, 4, 4)
        >>> q2 = Quaternion(3, 8, 8, 8)
        >>> Quaternion.arc_coplanar(q1, q2)
        True

        >>> q1 = Quaternion(2, 8, 13, 12)
        >>> Quaternion.arc_coplanar(q1, q2)
        False

        See Also
        ========

        vector_coplanar
        is_pure

        z)Neither of the given quaternions can be 0)r‰   r+   r   r  r¤   s     r$   Úarc_coplanarzQuaternion.arc_coplanar�  s—   € ðT ×#Ò#Ñ%Ô%ð 	J¨5×+CÒ+CÑ+EÔ+Eð 	JÝÐHÑIÔIÐIå˜$Ÿ)š)™+œ+¨¯
ª
©¬Ñ4×HÒHÑJÔJÈTÏYÊYÉ[Ì[Ð[`×[eÒ[eÑ[gÔ[gÑMg×L{ÒL{ÑL}ÔL}Ð~ÑÔÐr&   c                 ó¨  — t          |                     ¦   «         ¦  «        sBt          |                     ¦   «         ¦  «        s!t          |                     ¦   «         ¦  «        rt          d¦  «        ‚t          |j        |j        |j        g|j        |j        |j        g|j        |j        |j        gg¦  «                             ¦   «         }|j        S )a"  
        Returns True if the axis of the pure quaternions seen as 3D vectors
        ``q1``, ``q2``, and ``q3`` are coplanar.

        Explanation
        ===========

        Three pure quaternions are vector coplanar if the quaternions seen as 3D vectors are coplanar.

        Parameters
        ==========

        q1
            A pure Quaternion.
        q2
            A pure Quaternion.
        q3
            A pure Quaternion.

        Returns
        =======

        True : if the axis of the pure quaternions seen as 3D vectors
        q1, q2, and q3 are coplanar.
        False : if the axis of the pure quaternions seen as 3D vectors
        q1, q2, and q3 are not coplanar.
        None : if the axis of the pure quaternions seen as 3D vectors
        q1, q2, and q3 are coplanar is unknown.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q1 = Quaternion(0, 4, 4, 4)
        >>> q2 = Quaternion(0, 8, 8, 8)
        >>> q3 = Quaternion(0, 24, 24, 24)
        >>> Quaternion.vector_coplanar(q1, q2, q3)
        True

        >>> q1 = Quaternion(0, 8, 16, 8)
        >>> q2 = Quaternion(0, 8, 3, 12)
        >>> Quaternion.vector_coplanar(q1, q2, q3)
        False

        See Also
        ========

        axis
        is_pure

        ú"The given quaternions must be pure)	r   r  r+   ri   rS   rT   rU   r�   r  )rQ   rÌ   rÍ   Úq3rž   s        r$   Úvector_coplanarzQuaternion.vector_coplanar¼  s¬   € õl �R—Z’Z‘\”\Ñ"Ô"ð 	C¥i°·
²
±´Ñ&=Ô&=ð 	CÅÈ2Ï:Ê:É<Ì<ÑAXÔAXð 	CÝÐAÑBÔBÐBå�R”T˜2œ4 ¤Ð&¨¬¨r¬t°R´TÐ(:¸R¼TÀ2Ä4ÈÌÐ<NÐOÑPÔP×TÒTÑVÔVˆØŒyÐr&   c                 óÞ   — t          |                      ¦   «         ¦  «        s!t          |                     ¦   «         ¦  «        rt          d¦  «        ‚| |z  || z  z
                       ¦   «         S )aº  
        Returns True if the two pure quaternions seen as 3D vectors are parallel.

        Explanation
        ===========

        Two pure quaternions are called parallel when their vector product is commutative which
        implies that the quaternions seen as 3D vectors have same direction.

        Parameters
        ==========

        other : a Quaternion

        Returns
        =======

        True : if the two pure quaternions seen as 3D vectors are parallel.
        False : if the two pure quaternions seen as 3D vectors are not parallel.
        None : if the two pure quaternions seen as 3D vectors are parallel is unknown.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(0, 4, 4, 4)
        >>> q1 = Quaternion(0, 8, 8, 8)
        >>> q.parallel(q1)
        True

        >>> q1 = Quaternion(0, 8, 13, 12)
        >>> q.parallel(q1)
        False

        z%The provided quaternions must be pure©r   r  r+   r‰   r¤   s     r$   ÚparallelzQuaternion.parallelø  sd   € õJ �T—\’\‘^”^Ñ$Ô$ð 	F­	°%·-²-±/´/Ñ(BÔ(Bð 	FÝÐDÑEÔEÐEà�U‘
˜U 4™ZÑ'×;Ò;Ñ=Ô=Ð=r&   c                 óÞ   — t          |                      ¦   «         ¦  «        s!t          |                     ¦   «         ¦  «        rt          d¦  «        ‚| |z  || z  z                        ¦   «         S )a|  
        Returns the orthogonality of two quaternions.

        Explanation
        ===========

        Two pure quaternions are called orthogonal when their product is anti-commutative.

        Parameters
        ==========

        other : a Quaternion

        Returns
        =======

        True : if the two pure quaternions seen as 3D vectors are orthogonal.
        False : if the two pure quaternions seen as 3D vectors are not orthogonal.
        None : if the two pure quaternions seen as 3D vectors are orthogonal is unknown.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(0, 4, 4, 4)
        >>> q1 = Quaternion(0, 8, 8, 8)
        >>> q.orthogonal(q1)
        False

        >>> q1 = Quaternion(0, 2, 2, 0)
        >>> q = Quaternion(0, 2, -2, 0)
        >>> q.orthogonal(q1)
        True

        r  r!  r¤   s     r$   Ú
orthogonalzQuaternion.orthogonal"  sd   € õJ �T—\’\‘^”^Ñ$Ô$ð 	C­	°%·-²-±/´/Ñ(BÔ(Bð 	CÝÐAÑBÔBÐBà�U‘
˜U 4™ZÑ'×;Ò;Ñ=Ô=Ð=r&   c                 óT   — |                       ¦   «         |                      ¦   «         z  S )a’  
        Returns the index vector of the quaternion.

        Explanation
        ===========

        The index vector is given by $\mathbf{T}(q)$, the norm (or magnitude) of
        the quaternion $q$, multiplied by $\mathbf{Ax}(q)$, the axis of $q$.

        Returns
        =======

        Quaternion: representing index vector of the provided quaternion.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(2, 4, 2, 4)
        >>> q.index_vector()
        0 + 4*sqrt(10)/3*i + 2*sqrt(10)/3*j + 4*sqrt(10)/3*k

        See Also
        ========

        axis
        norm

        )r/   r  r_   s    r$   Úindex_vectorzQuaternion.index_vectorL  s   € ð> �yŠy‰{Œ{˜TŸYšY™[œ[Ñ(Ð(r&   c                 óD   — t          |                      ¦   «         ¦  «        S )aj  
        Returns the natural logarithm of the norm(magnitude) of the quaternion.

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> q = Quaternion(2, 4, 2, 4)
        >>> q.mensor()
        log(2*sqrt(10))
        >>> q.norm()
        2*sqrt(10)

        See Also
        ========

        norm

        )rá   r/   r_   s    r$   ÚmensorzQuaternion.mensorm  s   € õ* �$—)’)‘+”+‰ŒÐr&   )r   r   r   r   TN)F)TF)NT)AÚ__name__Ú
__module__Ú__qualname__Ú__doc__Ú_op_priorityrJ   rN   rP   ÚpropertyrR   rS   rT   rU   rV   rj   rl   ro   Úclassmethodrs   r…   r“   r}   r    r¦   r©   r¬   r°   r²   r¶   r¸   r»   r½   rÀ   rÄ   r£   rÏ   Ústaticmethodr¯   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(  Ú__classcell__)rX   s   @r$   rG   rG   :   sk  ø€ € € € € ð/ð /ð` €Là€Nðð ð ð ð ð ð"ð "ð "ðH ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ð ð  ñ „Xð ð ð/4ð /4ñ „Xð/4ðb ð44ð 44ñ „Xð44ðl/%ð /%ð /%ð /%ðb ð()ð ()ñ „[ð()ðT ð=*ð =*ñ „[ð=*ð~L!ð L!ð L!ð L!ð\ ð(ð (ñ „[ð(ðT ð)&ð )&ñ „[ð)&ðVð ð ðð ð ð"ð "ð "ð8ð 8ð 8ð8ð 8ð 8ðð ð ð>ð >ð >ð)ð )ð )ð)ð )ð )ð%ð %ð %ðLð Lð Lð4"ð 4"ð 4"ðl'8ð '8ð '8ðR ðI%ð I%ñ „\ðI%ðV?ð ?ð ?ð
ð ð ð ð  ð  ð
.ð .ð .ð+ð +ð +ðZ&ð &ð &ð>&ð &ð &ð40ð 0ð 0ðFð Fð Fð2!"ð !"ð !"ðFNð Nð Nð@ ð*(ð *(ñ „\ð*(ðX&ð &ð &ðPJGð JGð JGð JGðXð ð ð(5ð 5ð 5ð25ð 5ð 5ð:ð ð ð6#ð #ð #ð@Hð Hð Hð4-@ð -@ð -@ð^ ð9ð 9ñ „[ð9ðv(>ð (>ð (>ðT(>ð (>ð (>ðT)ð )ð )ðBð ð ð ð ð ð r&   rG   N)-Úsympy.core.numbersr   Úsympy.core.singletonr   Úsympy.core.relationalr   Ú$sympy.functions.elementary.complexesr   r   r   r	   Ú&sympy.functions.elementary.exponentialr
   r   rá   Ú(sympy.functions.elementary.miscellaneousr   Ú(sympy.functions.elementary.trigonometricr   r   r   r   r   Úsympy.simplify.trigsimpr   Úsympy.integrals.integralsr   Úsympy.matrices.denser   ri   Úsympy.core.sympifyr   r   Úsympy.core.exprr   Úsympy.core.logicr   r   Úsympy.utilities.miscr   Úmpmath.libmp.libmpfr   r1   rE   rG   r)   r&   r$   ú<module>rA     s·  ðØ 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø "Ð "Ð "Ð "Ð "Ð "Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JØ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CØ 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HØ ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø /Ð /Ð /Ð /Ð /Ð /Ø =Ð =Ð =Ð =Ð =Ð =Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø  Ð  Ð  Ð  Ð  Ð  Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'à +Ð +Ð +Ð +Ð +Ð +ð=ð =ð =ðð ð ð6Hð Hð Hð Hð H�ñ Hô Hð Hð Hð Hr&   