Ask Your Question

Revision history [back]

Solve for integer and real number

In a project I'm doing I stumbled on a way to solve something, but I don't know how I can excecute it. For simplicity I will ask an easier question analogue to how I want to solve mine.

Lets say we have a list of vectors: L = [vector([1,0,0]), vector([0,1,0]), vector([0,0,1])]

I want to solve which vector multiplied by a constant would give me the vector([6,0,0])

I tried something like this:

var('x') var('i', domain = 'integer')

solve([x * L[i] == vector([6,0,0])], i, x)

but it gives error "unable to convert i to integer" even though I explicitly stated that i is an integer.

Can someone please help me?

Solve for integer and real number

In a project I'm doing I stumbled on a way to solve something, but I don't know how I can excecute it. For simplicity I will ask an easier question analogue to how I want to solve mine.

Lets say we have a list of vectors: vectors:

L = [vector([1,0,0]), vector([0,1,0]), vector([0,0,1])]

vector([0,0,1])]

I want to solve which vector multiplied by a constant would give me the vector([6,0,0])

I tried something like this:

var('x')
var('i', domain = 'integer')

'integer')

solve([x * L[i] == vector([6,0,0])], i, x)

x)

but it gives error "unable to convert i to integer" even though I explicitly stated that i is an integer.

Can someone please help me?