12/17/2023 0 Comments Xlist location![]() If entering number 2, your line would look as if you wrote: If entering number 2, your line would look as if you wrote: f3 xlist. pos + V * dt #update vectors dr = dr + V * dt drarrow. The problem is not in xlist but in f2, because input() returns string. autoscale = 0 #delay N = 5 #seconds n = 0 while n < N : rate ( 1 ) #1 second delay n = n + 1 #print header print ( "r_0 vector (m)", " \t ", "t (s)" ) print ( r0, " \t ", t ) #move the S0 coord system and update vectors while t < 1.5 : rate ( 20 ) #update S0 coord sys for axis in S0coordsys : axis. axis = r0 #define the velocity of the moving frame V = vector ( 2, 0, 0 ) t = 0 dt = 0.01 #fix the size if the window scene. pos = vector ( 0, 0, - L / 2 ) + dr #update arrows drarrow. And we can add elements to a list by squeezing them into an empty slice at the desired location: > alist a, d, f > alist1:1 b. pos = vector ( 0, - L / 2, 0 ) + dr zaxis0. ![]() pos = vector ( - L / 2, 0, 0 ) + dr yaxis0. #make a list for the 0 coord sys axes S0coordsys = #place moving frame at the origin and update arrows dr = vector ( 0, 0, 0 ) #update 0 coord sys xaxis0. cyan ) #calculate the position of the particle in the second coordinate system r0 = r - dr #draw the position vector r0 for second coordinate system r0arrow = arrow ( pos = dr, axis = r0, shaftwidth = 2 * sw, color = color. magenta ) rarrow = arrow ( pos = ( 0, 0, 0 ), axis = r, shaftwidth = 2 * sw, color = color. yellow ) #draw a particle at position r and draw the position vector r r = vector ( 2, 0.5, 0 ) R = 0.1 particle = sphere ( pos = r, radius = R, color = color. yellow ) zaxis0 = arrow ( pos = vector ( 0, 0, - L / 2 ) + dr, axis = ( 0, 0, L ), shaftwidth = sw, color = color. yellow ) yaxis0 = arrow ( pos = vector ( 0, - L / 2, 0 ) + dr, axis = ( 0, L, 0 ), shaftwidth = sw, color = color. ![]() green ) #draw second coordinate system xaxis0 = arrow ( pos = vector ( - L / 2, 0, 0 ) + dr, axis = ( L, 0, 0 ), shaftwidth = sw, color = color. #create the scene scene = canvas ( title = 'Linear Coordinate Transformation' ) #draw first coordinate system L = 1 sw = L / 50 xaxis = arrow ( pos = ( - L / 2, 0, 0 ), axis = ( L, 0, 0 ), shaftwidth = sw ) yaxis = arrow ( pos = ( 0, - L / 2, 0 ), axis = ( 0, L, 0 ), shaftwidth = sw ) zaxis = arrow ( pos = ( 0, 0, - L / 2 ), axis = ( 0, 0, L ), shaftwidth = sw ) #dr is the position of the second coordinate system relative to the first dr = 1.1 * vector ( 1, 0, 0 ) drarrow = arrow ( pos = ( 0, 0, 0 ), axis = dr, shaftwidth = 2 * sw, fixedwidth = True, color = color.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |