+ 8
How do we write this kind of code in python, not to get errors ? I mean in this matrix there are variable values are not given.
This kind of code works in octave. T01=matrix('cos(t1), -sin(t1), 0, a0; sin(t1)*cos(alf0), cos(t1)*cos(alf0), -sin(alf0), -sin(alf0)*d1; sin(t1)*sin(alf0), cos(t1)*sin(alf0), cos(alf0), cos(alf0)*d1;0, 0, 0, 1'); The errors are: Traceback (most recent call last): File "/home/zhenis/Downloads/ExampleVectors.py", line 21, in <module> T01=matrix(double('cos(t1), -sin(t1), 0, a0; sin(t1)*cos(alf0), cos(t1)*cos(alf0), -sin(alf0), -sin(alf0)*d1; sin(t1)*sin(alf0), cos(t1)*sin(alf0), cos(alf0), cos(alf0)*d1;0, 0, 0, 1')); ValueError: could not convert string to float: cos(t1), -sin(t1), 0, a0; sin(t1)*cos(alf0), cos(t1)*cos(alf0), -sin(alf0), -sin(alf0)*d1; sin(t1)*sin(alf0), cos(t1)*sin(alf0), cos(alf0), cos(alf0)*d1;0, 0, 0, 1
2 Respuestas
+ 2
Try rewriting the parameters in bracketed form instead of string. Then it works for me.
https://code.sololearn.com/c0LjAWwp1p9c/?ref=app
+ 9
Please include code from code playground.