For graphing strain load on a shaft in relation to coordinate x, I have created a set of piecewise functions. Now I wanted to munge them into a single parametrized vector to easily get the length via norm() at a specified point.
M_Tx = piecewise([[[0, l1], M_t], [(l1, l1+l2), 0]]) M_by = piecewise([[[0, l1], -A_z * x], [(l1, l1+l2), -B_z * (l1+l2-x)]]) M_bz = piecewise([[[0, l1], A_y * x], [(l1, l1+l2), B_y * (l1+l2-x)]]) N_x = piecewise([[[0, l1], -A_x], [(l1, l1+l2), 0]]) Q_y = piecewise([[[0, l1], -A_y], [(l1, l1+l2), B_y]]) Q_z = piecewise([[[0, l1], -A_z], [(l1, l1+l2), B_z]]) M_vec(x) = vector([M_Tx, M_by, M_bz]).column() show(r"$\vec M=\left(\begin{array}{c} M_{Tx} \\ M_{by} \\ M_{bz} \end{array}\right)=$", M_vec(x = l1).n(digits=4), "kN $=$", round(M_vec(x = l1).norm(), 4), "kN") But, this does not work. Error in lines 27-27 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 996, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "sage/structure/element.pyx", line 838, in sage.structure.element. Element.n (/ext/sage/sage-8.0/src/build/cythonized/sage/structure/element.c: 7961) return self.numerical_approx(prec, digits, algorithm) File "sage/symbolic/expression.pyx", line 5718, in sage.symbolic. expression.Expression.numerical_approx (/ext/sage/sage-8.0/src/build/ cythonized/sage/symbolic/expression.cpp:35056) x = x._convert(kwds) File "sage/symbolic/expression.pyx", line 1261, in sage.symbolic. expression.Expression._convert (/ext/sage/sage-8.0/src/build/cythonized/sage /symbolic/expression.cpp:10465) cdef GEx res = self._gobj.evalf(0, kwds) File "sage/libs/pynac/pynac.pyx", line 1343, in sage.libs.pynac.pynac.py_float (/ext/sage/sage-8.0/src/build/cythonized/sage/libs/pynac/pynac.cpp:15280) return p.complex_field()(n) File "sage/structure/category_object.pyx", line 823, in sage.structure. category_object.CategoryObject.__getattr__ (/ext/sage/sage-8.0/src/build/ cythonized/sage/structure/category_object.c:7662) return self.getattr_from_category(name) File "sage/structure/category_object.pyx", line 838, in sage.structure. category_object.CategoryObject.getattr_from_category (/ext/sage/sage-8.0/src /build/cythonized/sage/structure/category_object.c:7826) attr = getattr_from_other_class(self, cls, name) File "sage/structure/misc.pyx", line 294, in sage.structure.misc.getattr_from_other_class (/ext/sage/sage-8.0/src/build/cythonized/sage/structure/misc.c:1866) raise dummy_attribute_error AttributeError: 'ComplexField_class_with_category' object has no attribute 'complex_field' Is it that piecewise functions are not yet fully fledged out, or is my lack of sage routine that is to blame? Any hints most welcome : ) #Best Regards/Marcel -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.