2
$\begingroup$

So I had a system

#for given koefs 
k:=3; n:=3; 
#let us solve system:
koefSolution:= solve({
 sum(a[i], i = 0 .. k) = 0,
 sum(a[i], i = 0 .. k)-(sum(b[i], i = 0 .. k)) = 0,
 sum(i^n*a[i], i = 0 .. k)-(sum(i^(n-1)*b[i], i = 0 .. k)) = 0
});

So I have a vector like

koefSolution := {  a[0] = 7*a[2]+26*a[3]-b[1]-4*b[2]-9*b[3], 
                   a[1] = -8*a[2]-27*a[3]+b[1]+4*b[2]+9*b[3], 
                   a[2] = a[2], 
                   a[3] = a[3], 
                   b[0] = -b[1]-b[2]-b[3], 
                   b[1] = b[1], b[2] = b[2], 
                   b[3] = b[3]}

I have a[0] so I try solve({koefSolution, a[0] = 1}); why it does not solve my system for given a[0]? ( main point here is to fill koefSolution with given a[] and b[] and optimize. So here I am trying to emulate analytic way of solving my system (It shall be capable to work for any given a[], b[], n, k... so that all students in our class would get good marks=))

1 Answers 1

1

In your solution, the free variables are $a[2],a[3],b[1],b[2],b[3]$. Since $a[0]$ is not a free variable, setting it equal to 1 in your koefSolution does not yield a solution.

What you can do is to set $a[0]=1$ in your original system, and solve for the rest of the variables. I did that and I get: $$ a[1]=-1-a[2]-a[3]$$ $$a[2]=a[2]$$ $$a[3]=a[3]$$ $$b[0]=1-7a[2]-26a[3]+3b[2]+8b[3]$$ $$b[1]=-1+7a[2]+26a[3]-4b[2]-9b[3]$$ $$b[2]=b[2]$$ $$b[3]=b[3]$$

The free variables now are $a[2],a[3],b[2],b[3]$.