First time here? Check out the FAQ!

Ask Your Question
0

How to print equations and numbers on a single line:

asked 8 years ago

lookin03820 gravatar image

updated 8 years ago

I am trying to print a string, an equation and a number on the same line using the following form:

 B=var('B')
 fce=var('fce', latex_name='f_{ce}')
 fce=2.80e6 * B
 values={B:1.0e5}
 print "Electron Gyrofrequency=", show(fce) , "= %0.5e" % fce.substitute(values)

However the output does not show as a single line. Any help would be appreciated.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 8 years ago

Try this:

 show( "Electron Gyrofrequency=", fce , "= %0.5e" % fce.substitute(values) )
Preview: (hide)
link

Comments

Didn't work stuff after "Electron Gyrofrequency=" was not displayed

lookin03820 gravatar imagelookin03820 ( 8 years ago )

It works for me. Which Sage interface are you using ?

tmonteil gravatar imagetmonteil ( 8 years ago )

sage 6.3 on a mac 10.7.5

lookin03820 gravatar imagelookin03820 ( 8 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 8 years ago

Seen: 676 times

Last updated: Jan 04 '17