[sage-support] Re: Using Sage String in LaTeX

2009-01-02 Thread H . S . Rai

On Sat, Jan 3, 2009 at 7:50 AM, H. S. Rai  wrote:
> phi_b to \mbox{phi}_{b}
> epsilon_cu to \epsilon_{\mbox{cu}}
>
> In both cases \mbox is not desirable (although in 2nd case it may be
> accepted, as it do convert symbol of epsilon correctly, but phi is not
> rendered, so to acceptable at all)
>
> IS there a mean to stop putting mbox.

I tried to use:

varOutput = [[x[0].replace('\mbox',''),x[1]] for x in varOutput]

But, I converted:

\mbox{phi}_{b} to {phi}_{b} and
\epsilon_{\mbox{cu}} to \\epsilon_{{cu}}

It puts "\\" before epsilon.

Can we avoid it or a better way to omit "\mbox"

-- 
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: Using Sage String in LaTeX

2009-01-02 Thread H . S . Rai

On Thu, Jan 1, 2009 at 3:53 AM, Justin Walker  wrote:
>
> You can do this by using a document class, like 'amsart', or a
> package, such as 'amsmath',  that provides it.

Thanks for timely help.

Now I found, in sage latex() convert:

phi_b to \mbox{phi}_{b}
epsilon_cu to \epsilon_{\mbox{cu}}

In both cases \mbox is not desirable (although in 2nd case it may be
accepted, as it do convert symbol of epsilon correctly, but phi is not
rendered, so to acceptable at all)

IS there a mean to stop putting mbox.

With kind 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] Using Sage String in LaTeX

2008-12-30 Thread H . S . Rai

I am trying to print symbol and their description in LaTeX. On sage
console things appear to work fine, but whan processed through
sagetex, it reports error.


! Undefined control sequence.
 \text
 {breadth of beam}
l.16 ...0][0]}$ standa for $\sage{varOutput[0][1]}
  $
?
//

The data file and complete .tex file is appended below signature.

How I can print in LaTeX, symbol and their description.

-- 
H.S.Rai

==

///
example01Data.txt
//

b // breadth of beam // 300
d // effective depth of beam // 550
D // overall depth of beam // 600
A_st // area of reinforcement // 0
phi_b // diameter of reinforcing steel bar // 12


support.tex
///

\documentclass{article}
\title{Analysis and Design through SAGE in \LaTeX}
\author{H.S.Rai}
\usepackage{sagetex}
\begin{document}
\maketitle

\begin{sageblock}
f = open('example01Data.txt')
varList = [x.split(' // ') for x in f.readlines()]
[var(x[0]) for x in varList]
varOutput = [[latex(eval(x[0])),x[1]] for x in varList]
\end{sageblock}

\section{Symbol used}
The symbol $\sage{varOutput[0][0]}$ standa for $\sage{varOutput[0][1]}$
\end{document}

--~--~-~--~~~---~--~~
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: Reading data from file

2008-12-30 Thread H . S . Rai

On Mon, Dec 29, 2008 at 7:33 AM, David Joyner  wrote:
>
> sage: f = open("mydatafile.txt")
> sage: l1 = f.readline()

Thanks to William and David for helping me. I may able to achieved
what I targeted with following code:

f = open('example01Data.txt')
varList = [x.split(' // ') for x in f.readlines()]

where data in example01Data.txt is separate by " // ", sample data is
below signature.

Now the problem I am facing to use it in LaTeX, is reported in next email.

Thanks and regards,

-- 
H.S.Rai
===

b // breadth of beam // 300
d // effective depth of beam // 550
D // overall depth of beam // 600
A_st // area of reinforcement // 0
phi_b // diameter of reinforcing steel bar // 12

--~--~-~--~~~---~--~~
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] 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: ,,

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 8:16 PM, Burcin Erocal  wrote:
>
> On Fri, 26 Dec 2008 19:52:26 +0530
> H.S.Rai  wrote:
>
> ... You have to pass those values in
> the substitution explicitly. You can achieve this by doing
>
> sage: abc.subs(locals())


> I suggest that you use .subs() directly, e.g.,
>
> sage: x_ulCal = x_ul.subs(d=d,epsilon_s = epsilon_sMin)

Thanks for your input and suggestion.

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  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 
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 ()
> 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.simp

[sage-support] Re: Style

2008-12-20 Thread H . S . Rai

On Sat, Dec 20, 2008 at 9:19 AM, David Joyner  wrote:


> The preferred format for Sage documentation is latex or,
> rest/sphinx (the new format for Python documentation).

I can use LaTeX.


> http://www.math.washington.edu/~jkantor/Numerical_Sage/Numerical_Sage.html

Thanks.

Please refer this thread

http://tug.org/pipermail/tugindia/2008-December/thread.html#4705

to fulfill my requirement, I tried SAGE with LaTeX (see tex code below
signature), the result is at:
http://gndec.ac.in/~hsrai/tmp/sageLaTeX.pdf

Please note formula after "Using formula" in pdf file has not been
entered manually in .tex file, rather has been provided by SAGE from
formula used for calculation.

This is my first interaction with Math software (any CAS). If there is
better way to achieve "Display of formula and calculation of formula
by entering formula once", then you are requested to guide me.

With regards,

-- 
H.S.Rai



\documentclass{article}
\title{Analysis and Design by SAGE in \LaTeX}
\author{Hardeep Singh Rai}

\usepackage{sagetex}

\begin{document}
\maketitle

\begin{sageblock}
 A(D) = pi/4*D^2
 dia = 2.5
 area = A(dia)
\end{sageblock}

Using formula
\[
A = \sage{latex(A(D))}
\]
for $D = \sage{dia.n(digits=4)}$, area $A = \sage{area.n(digits=4)}$

\end{document}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---