About 75,800 results
Open links in new tab
  1. python - numpy.sin function in degrees? - Stack Overflow

    Jan 22, 2015 · I'm working on a problem that has to do with calculating angles of refraction and what not. However, it seems that I'm unable to use the numpy.sin() function in degrees. I have tried to use numpy.degrees() and numpy.rad2deg(). numpy.sin(90) numpy.degrees(numpy.sin(90)) Both return ~ 0.894 and ~ 51.2 respectively. Thanks for your help.

  2. math - Using Sin-1 or inverse sin in python - Stack Overflow

    Sep 15, 2012 · ^ in Python isn't exponentiation, it's xor; use ** for exponentiation. If your code runs without a syntax error, then you should post your real code instead of this pseudocode. If your code runs without a syntax error, then you should post your real code instead of …

  3. How do we use sin,cos,tan generically (including user-defined …

    Aug 23, 2011 · If you want to be internally consistent and duck-typed, you can at least put the extensibility shim that python is missing into your own code. def sin(x): try: return x.__sin__() except AttributeError: return math.sin(x) Now you can import this sin function and use it indiscriminately wherever you used math.sin previously.

  4. Correct use of cos() and sin() in Python - Stack Overflow

    Mar 19, 2017 · Which all makes sense, except for the fact that I don't understand how the functions cos() and sin() work in Seed7. The manual says: sin. const func float: sin (in float: x) Compute the sine of x, where x is given in radians. Returns: the trigonometric sine of an angle. but I can't make the equivalent in Python.

  5. trigonometry - Sine square in python - Stack Overflow

    Mar 31, 2020 · Need help. How I can get sine square in python? Is there specific method or function? Some supposedly obvious solutions are NOT suitable. Examples: import numpy as np import math x = np.arange(0, ...

  6. python - How can I use math.sin () in fillna in pandas - Stack …

    math.sin is expecting a single value, i.e.: >>> math.sin(1) 0.8414709848078965 You need a vectorized function to find the sine of each value in a Series, which in this case is provided by the numpy library:

  7. python - How to plot graph sine wave - Stack Overflow

    import matplotlib.pyplot as plt # For ploting import numpy as np # to work with numerical data efficiently fs = 100 # sample rate f = 2 # the frequency of the signal x = np.arange(fs) # the points on the x axis for plotting # compute the value (amplitude) of the sin wave at the for each sample y = np.sin(2*np.pi*f * (x/fs)) #this instruction can only be used with IPython Notbook.

  8. python - How to calculate sine and cosine without importing math ...

    Feb 4, 2014 · I started programming in python not too long ago and I am having trouble with a part of a program. The program will ask for input from the user and he can input: A, B, C, M, or Q. I have completed the A, M, and Q part but I can't figure out how to do the parts for B (calculate the sine of the number you want) and C (calculate the sine).

  9. python - Trigonometric Functions: How do I write Sine and Cosine ...

    May 16, 2021 · I have been trying not to use any module as it is not helping in in importing stuff. So I thought I should write the code myself for both of them. The problem here is that I don't really know how do we make them. I couldn't find them anywhere on the net as everywhere I only saw the use of math module which I don't want to use.

  10. python - How to use sine in sympy? - Stack Overflow

    Sep 29, 2023 · I am asking to use SymPy to solve a differential equation, y'=(2y-3y^2)sin(x). Here is my code import math import sympy as sym sym.init_printing() from IPython.display import display_latex import s...

Refresh