Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

code work line by line in console but not loaded as a sage file

Hi, I tried the tutorial to solve equations system. I enter the code commands line by line in sage it works but when put it all together in a sage file it does not show the results. It seams it's just the last line of the code that shows the resuklts that is not working.

Here is the code:

var('A1,A2,N1,N2,q')

eq1 = A1==N1/(N2*q + N1)^2

eq2 = A2== q^2N2/(N2q+N1)^2

solns = solve ([eq1,eq2,A1==0.160,A2==0.015,N2==10],A1,A2,q,N1,N2, solution_dict = True)

[[s[N1].n(30),s[q].n(30)] for s in solns]

code work line by line in console but not loaded as a sage file

Hi, I tried the tutorial to solve equations an equation system. I enter the code commands commands line by line in sage Sage and it works works, but when put it all together in a sage file file it does not show the results. It seams seems it's just the last line of the code that that shows the resuklts results that is not working.

Here is the code:

var('A1,A2,N1,N2,q')

var('A1, A2, N1, N2, q')
eq1 = A1==N1/(N2*q A1 == N1/(N2*q + N1)^2

N1)^2 eq2 = A2== q^2N2/(N2q+N1)^2

A2 == q^2*N2/(N2*q + N1)^2 eqns = [eq1, eq2, A1 == 0.160, A2 == 0.015, N2 == 10] solns = solve ([eq1,eq2,A1==0.160,A2==0.015,N2==10],A1,A2,q,N1,N2, solution_dict = True)

[[s[N1].n(30),s[q].n(30)] (eqns, A1, A2, q, N1, N2, solution_dict=True) [[s[N1].n(30), s[q].n(30)] for s in solns]

solns]

code work line by line in console but not loaded as a sage file

I tried the tutorial to solve an equation system. I enter the code commands line by line in Sage and it works, but when put it all together in a sage file it does not show the results. It seems it's just the last line of the code that shows the results that is not working.

Here is the code:

var('A1, A2, N1, N2, q')
eq1 = A1 == N1/(N2*q + N1)^2
eq2 = A2 == q^2*N2/(N2*q + N1)^2
eqns = [eq1, eq2, A1 == 0.160, A2 == 0.015, N2 == 10]
solns = solve (eqns, A1, A2, q, N1, N2, solution_dict=True)
[[s[N1].n(30), s[q].n(30)] for s in solns]