Ask Your Question

rewolf's profile - activity

2022-04-25 14:45:35 +0200 received badge  Notable Question (source)
2021-01-27 19:31:23 +0200 received badge  Popular Question (source)
2018-06-30 21:30:55 +0200 received badge  Popular Question (source)
2018-06-30 13:41:03 +0200 asked a question code snippet resp. simplify and factor

this doesn't work

var('c')
mat=matrix([[1,0],[0,c]])
xy0=vector([c,1])
r0=-mat*xy0
p0=r0
for k in range(2):
    la=r0*p0/(p0*mat*p0)
    xy1=xy0+la*p0
    print xy1
    if xy1[0]!=0:
        xy1[0]=xy1[0].factor()
    if (xy1[1])!=0:
        xy1[1]=xy1[1].factor()
    print xy1
    r1=(r0-la*mat*p0)
    p1=r1+r1*r1/(r0.dot_product(r0))*p0
    p1=p1.simplify_full()
    p0=p1
    r0=r1
    xy0=xy1
    print '--------------------'

but this works

var('c')
mat=matrix([[1,0],[0,c]])
xy0=vector([c,1])
r0=-mat*xy0
p0=r0
for k in range(2):
    la=r0*p0/(p0*mat*p0)
    xy1=xy0+la*p0
    print xy1
    xy1=xy1.simplify_full()   # <<<<<<<<< inserted this command
    if xy1[0]!=0:
        xy1[0]=xy1[0].factor()
    if (xy1[1])!=0:
        xy1[1]=xy1[1].factor()
    print xy1
    r1=(r0-la*mat*p0)
    p1=r1+r1*r1/(r0.dot_product(r0))*p0
    p1=p1.simplify_full()
    p0=p1
    r0=r1
    xy0=xy1
    print '--------------------'
2018-06-30 13:18:38 +0200 asked a question how to extract a common factor of vector components

v=vec([ax,ay])

should give

a*vec([x,y])

by a command. Which command?

2018-01-23 03:38:16 +0200 received badge  Nice Question (source)
2018-01-22 21:11:13 +0200 received badge  Student (source)
2018-01-22 19:17:44 +0200 asked a question integrate sqrt(1-cos(x)), integr.interval from 0 to 2*pi

The result equals zero. This ist wrong!