The value of np.arcsin that can be in the range of np.arange (0, 2, 0.05) is calculated. The domain of the inverse trigonometric function was set with arr = arr [arr<= 1].

I want to integrate two arrays with different lengths, np.arange (0, 2, 0.05) and arr = arr [arr<= 1] and make them correspond to text data. It cannot be implemented successfully.

Because i am a beginner, please let me know. Thank you.


I ran np.savetxt to write text data, but it was not possible because the array length was different.

import numpy as np
arr = np.arcsin (
    np.arange (0, 2, 0.05)
arr = arr [arr&lt;= 1]
np.savetxt ('test.txt', np.arange (0, 1.5, 0.05), arr)
  • Answer # 1

    It can be connected with numpy.hstack, so save the result.

    Why did you think that if you pass an array to np.savetxt, it will join you?
    The program will writenevereven if written properly, so let's examine it first.
    Google search: numpy array join

    Also, when executed, the following warning appears.

    RuntimeWarning: invalid value encountered in arcsin
      np.arange (0, 2, 0.05)

    You are out of the domain of arcsin. Because the range of sin (x) is [-1, 1].

Related articles