Ask Your Question
1

Greek variables

asked 4 years ago

Cyrille gravatar image

Is it possible now that sagemath is under Python 3 to use greek letters as variables ? I remember this answer by tmonteil "it is not possible to use unicode λ in variables names, since Sage relies on Python 2, which does not allow it, so you have to wait the migration of Sage to Python 3 for that."

Preview: (hide)

Comments

Nicolas Thiéry started a discussion on this theme on sage-devel on 2020-02-21:

slelievre gravatar imageslelievre ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 4 years ago

dan_fulea gravatar image

Let's see...

sage: λ = 89                                                                                                                  
sage: print(λ)                                                                                                                
89
sage: print("λ is %s" % λ)                                                                                                    
λ is 89
sage: print("λ is {}".format(λ))                                                                                              
λ is 89
sage: print(f"λ is {λ}")                                                                                                      
λ is 89
sage: print("λ² + λ is {}".format(λ^2+λ))                                                                                     
λ² + λ is 8010

sage: probabilité = 1/3                                                                                                       
sage: q = 1 - probabilité                                                                                                     
sage: q                                                                                                                       
2/3

... ça marche...

Preview: (hide)
link

Comments

Ok super and how do you have access to greek characters. Window 10 says [Windows key +.] but it doen't works

Cyrille gravatar imageCyrille ( 4 years ago )

Write

\phiTAB

(meaning press tab key)

FrédéricC gravatar imageFrédéricC ( 4 years ago )

FrédéricC Thanks but to be precise the cod must be \phi<tab>

Cyrille gravatar imageCyrille ( 4 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

1 follower

Stats

Asked: 4 years ago

Seen: 2,191 times

Last updated: Apr 22 '20