# Unexpected solve() errors Anonymous

#Area [m^2]
Ab = 0.00313659226
#CB Ratio
cb = 0.262
eng4 =[solve(cb == Vc/(Ab*Lb),Lb) for Vc in xrange(0.000001,0.00002)]
print(eng4)


This returns an empty list [] and I have no idea why. And this one:

#Ideal Gas Law[Relates Pressure and Volume]
#Definitions v3
#Main Tank Pressure[Pascals]
Pp=1013529.32
#Tank Volume[m^3]
Vt=0.0013929
#Moles of Air
#Gas Constant
r=8.3144621
#Ambient Temperature[Kelvin][70F]
t= 294.261

eng5= solve(Pp*Vt == n*r*t,n,solution_dict=1)
v3=eng5
v4=n(v3)
n(v4)


__main__:18: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...) See http://trac.sagemath.org/5930 for details. 75589949342674/131001015929725

Or it just shows the fraction. It's been acting weird lately

Why?

edit retag close merge delete

Sort by » oldest newest most voted The problem is that xrange gives an empty list so the result is an empty list. Try this

import numpy as np
#Area [m^2]
Ab = 0.00313659226
#CB Ratio
cb = 0.262
Lb=var('Lb')
eng4 =[solve(cb == Vc/(Ab*Lb),Lb) for Vc in np.arange(0.0,0.00002,0.000001)]
print(eng4)


Sage is able to solve the problem if you declare n. I don't understand what you are trying to do after solving.

#Ideal Gas Law[Relates Pressure and Volume]
#Definitions v3
#Main Tank Pressure[Pascals]
Pp=1013529.32
#Tank Volume[m^3]
Vt=0.0013929
#Moles of Air
#Gas Constant
r=8.3144621
#Ambient Temperature[Kelvin][70F]
t= 294.261
n=var('n')
eng5= solve(Pp*Vt == n*r*t,n,solution_dict=1)
v3=eng5
print eng5

more

That works pretty well, but with 0 as the start it throws an empty list, which screws up my list comprehension. It works pretty well. Do you know about the other problem or why

I don't understand what you are trying to do after solving. What is n(V3) supposed to do? But now it does solve the equation.