0

I am having problems with adding returned arrays from functions. Basically I have two functions, single_loads and element_loads, that return me an numpy array.

Now I want to add these two returned arrays, force_vector_single_loads and force_vector_element_loads, in a new function called force_vector. Of course, I can just call these two functions in the force_vector function, but I want to do it separately. By separately, I mean that I want to add the two arrays that have already been calculated, and not execute them in the functions first. How can I do this?

Like this:

def single_loads(self):
    ...
    return force_vector_single_loads

def element_loads(self):
    ...
    return force_vector_element_loads

def force_vector(self):
    force_vector = "force_vector_single_loads" + "force_vector_element_loads"
    return force_vector
mkrieger1
  • 14,486
  • 4
  • 43
  • 54
WARIO
  • 23
  • 4
  • You either need to pass the two arrays as arguments to `force_vector` or you have to store them as instance variables of the class (I'm assuming you have a class because your functions have `self` arguments) and then access them in `force_vector`. – mkrieger1 Dec 19 '21 at 11:42

0 Answers0