Python sympy.acos() Examples
The following are 5
code examples of sympy.acos().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sympy
, or try the search function
.
Example #1
Source File: test_sympy_conv.py From symengine.py with MIT License | 6 votes |
def test_conv7b(): x = sympy.Symbol("x") y = sympy.Symbol("y") assert sympify(sympy.sin(x/3)) == sin(Symbol("x") / 3) assert sympify(sympy.sin(x/3)) != cos(Symbol("x") / 3) assert sympify(sympy.cos(x/3)) == cos(Symbol("x") / 3) assert sympify(sympy.tan(x/3)) == tan(Symbol("x") / 3) assert sympify(sympy.cot(x/3)) == cot(Symbol("x") / 3) assert sympify(sympy.csc(x/3)) == csc(Symbol("x") / 3) assert sympify(sympy.sec(x/3)) == sec(Symbol("x") / 3) assert sympify(sympy.asin(x/3)) == asin(Symbol("x") / 3) assert sympify(sympy.acos(x/3)) == acos(Symbol("x") / 3) assert sympify(sympy.atan(x/3)) == atan(Symbol("x") / 3) assert sympify(sympy.acot(x/3)) == acot(Symbol("x") / 3) assert sympify(sympy.acsc(x/3)) == acsc(Symbol("x") / 3) assert sympify(sympy.asec(x/3)) == asec(Symbol("x") / 3)
Example #2
Source File: _liu_vinokur.py From quadpy with GNU General Public License v3.0 | 6 votes |
def liu_vinokur_12(): lmbda = frac(4, 27) * ( 4 * sqrt(79) * cos((acos(67 * sqrt(79) / 24964) + 2 * numpy.pi) / 3) + 71 ) alpha1 = (+sqrt(9 * lmbda ** 2 - 248 * lmbda + 1680) + 28 - 3 * lmbda) / ( 112 - 10 * lmbda ) alpha2 = (-sqrt(9 * lmbda ** 2 - 248 * lmbda + 1680) + 28 - 3 * lmbda) / ( 112 - 10 * lmbda ) w1 = ((21 - lmbda) * alpha2 - 7) / (420 * alpha1 ** 2 * (alpha2 - alpha1)) w2 = ((21 - lmbda) * alpha1 - 7) / (420 * alpha2 ** 2 * (alpha1 - alpha2)) weights = numpy.concatenate( [numpy.full(4, w1), numpy.full(4, w2), numpy.full(6, lmbda ** 2 / 840)] ) points = numpy.concatenate( [_r_alpha(alpha1), _r_alpha(alpha2), _r_beta(1 / sqrt(lmbda))] ) degree = 5 return T3Scheme("Liu-Vinokur 12", weights, points, degree, source)
Example #3
Source File: test_sympy_conv.py From symengine.py with MIT License | 5 votes |
def test_conv7(): x = Symbol("x") y = Symbol("y") assert sin(x/3) == sin(sympy.Symbol("x") / 3) assert cos(x/3) == cos(sympy.Symbol("x") / 3) assert tan(x/3) == tan(sympy.Symbol("x") / 3) assert cot(x/3) == cot(sympy.Symbol("x") / 3) assert csc(x/3) == csc(sympy.Symbol("x") / 3) assert sec(x/3) == sec(sympy.Symbol("x") / 3) assert asin(x/3) == asin(sympy.Symbol("x") / 3) assert acos(x/3) == acos(sympy.Symbol("x") / 3) assert atan(x/3) == atan(sympy.Symbol("x") / 3) assert acot(x/3) == acot(sympy.Symbol("x") / 3) assert acsc(x/3) == acsc(sympy.Symbol("x") / 3) assert asec(x/3) == asec(sympy.Symbol("x") / 3) assert sin(x/3)._sympy_() == sympy.sin(sympy.Symbol("x") / 3) assert sin(x/3)._sympy_() != sympy.cos(sympy.Symbol("x") / 3) assert cos(x/3)._sympy_() == sympy.cos(sympy.Symbol("x") / 3) assert tan(x/3)._sympy_() == sympy.tan(sympy.Symbol("x") / 3) assert cot(x/3)._sympy_() == sympy.cot(sympy.Symbol("x") / 3) assert csc(x/3)._sympy_() == sympy.csc(sympy.Symbol("x") / 3) assert sec(x/3)._sympy_() == sympy.sec(sympy.Symbol("x") / 3) assert asin(x/3)._sympy_() == sympy.asin(sympy.Symbol("x") / 3) assert acos(x/3)._sympy_() == sympy.acos(sympy.Symbol("x") / 3) assert atan(x/3)._sympy_() == sympy.atan(sympy.Symbol("x") / 3) assert acot(x/3)._sympy_() == sympy.acot(sympy.Symbol("x") / 3) assert acsc(x/3)._sympy_() == sympy.acsc(sympy.Symbol("x") / 3) assert asec(x/3)._sympy_() == sympy.asec(sympy.Symbol("x") / 3)
Example #4
Source File: _helpers.py From quadpy with GNU General Public License v3.0 | 5 votes |
def cartesian_to_spherical_sympy(X): vacos = numpy.vectorize(sympy.acos) return numpy.stack([_atan2_0(X), vacos(X[:, 2])], axis=1)
Example #5
Source File: em.py From typhon with MIT License | 4 votes |
def zeeman_theta(u, v, w, z=0, a=0): """ Find Zeeman angle along the magnetic field """ try: import sympy as sp except ModuleNotFoundError: raise RuntimeError("Must have sympy installed to use") U, V, W, Z, A = np.meshgrid(u, v, w, z, a, copy=False) N = len(U.flatten()) if type(sp.symbols('u')) == type(u): sin = sp.sin cos = sp.cos acos = sp.acos sqrt = sp.sqrt d = np.empty((N), type(u)) else: sin = np.sin cos = np.cos acos = np.arccos sqrt = np.sqrt d = np.empty((N), float) for i in range(N): H = np.array([U.flat[i], V.flat[i], W.flat[i]]) L = np.array([sin(Z.flat[i])*cos(A.flat[i]), sin(Z.flat[i])*sin(A.flat[i]), cos(Z.flat[i])]) d[i] = acos(H.dot(L) / sqrt(H.dot(H))) if type(sp.symbols('u')) == type(u): return d[0] shape = [] for input in [u, v, w, z, a]: if np.isscalar(input): continue shape.append(len(input)) if shape: d = d.reshape(shape) else: d = d[0] return d