[sage-support] Reading data from file

2008-12-28 Thread H . S . Rai

What is the easiest way to read data from file. file function mention
of size, I want to read variable wise, like:

f.read(myInteger1, myFloat1, myString1)

My data file will be:
'b' 'breadth of member' 250
'D' 'overall depth of member' 550

Each line having three entries: variable name,Description,Default vaule

These may be separated by comma, tab or space. If I am able to read
and have list like:

varList[ [ 'b', 'breadth of member', 250 ] , [ 'D', 'overall depth of
member', 550  ]  ]

then that will serve my purpose.

With regards,

-- 
H.S.Rai

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Error in abc.n(digits=5)

2008-12-26 Thread H . S . Rai

On Fri, Dec 26, 2008 at 3:55 PM, Alex Ghitza aghi...@gmail.com wrote:
 Hello,

 I am unable to reproduce the error you obtained.  Here is what I get in
 3.2.2:

Mine is SAGE Version 3.1.4, Release Date: 2008-10-20

The complete sage code is below signature. I don't think version will
be issue, as I am doing very basic things.

Please see if code below work fine for abc.n(digits=5)

With regards,

-- 
H.S.Rai



var('b,D,d,Ast,barTdia,barTno')
var('f_ck,f_y,f_s,epsilon_c,epsilon_s,E_s,proofStrain')
var('dPrimeT,l,w_s,uw_c,P,gamma_ms,gamma_mc,gamma_f')
var('x_u')
var('k_1, k_2')
f_av = k_1*f_ck
epsilon_c = .0035
epsilon_sMin = f_y/gamma_ms/E_s + proofStrain
E_s = RealNumber('200e3')
C = b*x_u*f_av
A_st = pi/Integer(4)*barTdia**Integer(2)*barTno
T = A_st*f_s
eqStrainComp = epsilon_s/(d - x_u) == epsilon_c/x_u
eqStrainCompSol = solve(eqStrainComp,x_u)
epsilon_sMin = f_y/gamma_ms/E_s + proofStrain
eqEquilibH = C == T
eqEquilibHSol = solve(eqEquilibH,x_u)
xuAct = eqEquilibHSol[0].rhs()
b = 250; D = 500; dPrimeT = 50; barTdia = 16; barTno = 4;
l = 6; f_ck = 20; f_y = 250; uw_c = 25; proofStrain = .002;
gamma_ms = 1.15; gamma_mc = 1.5; gamma_f = 1.5;
k_1 = 0.36; k_2 = .42;
f_s = f_y / gamma_ms;
d = D - dPrimeT
epsilon_s = epsilon_sMin
xuActCal = xuAct(f_s=217.39, barTdia=16, barTno=4, b=250, k_1=0.359,f_ck=20)
x_ul = eqStrainCompSol[0].rhs()
x_ulCal = x_ul(d=d,epsilon_s = epsilon_sMin)
abc = x_ulCal

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Error in abc.n(digits=5)

2008-12-25 Thread H . S . Rai

Following session explain problem (unable to display nurical values
when all required values have been defined):

sage: abc
3150/(2000*(proofStrain + 5.00e-6*f_y/gamma_ms) + 7)
sage: print(proofStrain,f_y,gamma_ms)
(0.002, 250, 1.1499)
sage: abc.n tab
abc.nabc.nintegrate
abc.number_of_arguments  abc.numerical_approx
abc.nintegralabc.norm abc.numerator
sage: abc.n(digits=5)

gave error (reproduced below signature.) How to make use of that error
message, and how to solve problem?

-- 
H.S.Rai

===

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (6, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (6, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (6, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (6, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (6, 0))

---
TypeError Traceback (most recent call last)

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/examples/latex_embed/bookRai.py
in module()
 1
  2
  3
  4
  5

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
in numerical_approx(self, prec, digits)
   1319 except TypeError:
   1320 # try to return a complex result
- 1321 approx = self._complex_mpfr_field_(ComplexField(prec))
   1322
   1323 return approx

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
in _complex_mpfr_field_(self, field)
   4883 0
   4884 
- 4885 return self._convert(field)
   4886
   4887 def _complex_double_(self, field):

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
in _convert(self, typ)
   4817 raise
   4818 else:
- 4819 return typ(g)
   4820 return self._operator(*fops)
   4821

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/rings/complex_field.pyc
in __call__(self, x, im)
206 if im is not None:
207 x = x, im
-- 208 return Parent.__call__(self, x)
209
210 def _element_constructor_(self, x):

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/structure/parent.so
in sage.structure.parent.Parent.__call__
(sage/structure/parent.c:3732)()
303
304
-- 305
306
307

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/structure/parent.so
in sage.structure.parent.__call__ (sage/structure/parent.c:3619)()
294
295
-- 296
297
298

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so
in sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:2622)()
 74
 75
--- 76
 77
 78

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so
in sage.structure.coerce_maps._call_
(sage/structure/coerce_maps.c:2537)()
 69
 70
--- 71
 72
 73

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/rings/complex_field.pyc
in _element_constructor_(self, x)
229
230 try:
-- 231 return x._complex_mpfr_field_( self )
232 except AttributeError:
233 pass

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
in _complex_mpfr_field_(self, field)
   4883 0
   4884 
- 4885 return self._convert(field)
   4886
   4887 def _complex_double_(self, field):

/home/hsrai/CAS/sage-3.1.4-pentiumM-ubuntu32bit-x86-i686-Linux/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
in _convert(self, typ)
   4811 
   4812 try:
- 4813 fops = [typ(op) for op in self._operands]
   4814 except TypeError:
   4815 g = self.simplify()