Ask Your Question
1

Greek variables

asked 2020-04-22 18:08:50 +0100

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."

edit retag flag offensive close merge delete

Comments

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

slelievre gravatar imageslelievre ( 2020-04-23 04:26:18 +0100 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2020-04-22 18:26:29 +0100

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

edit flag offensive delete link more

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 ( 2020-04-22 19:25:43 +0100 )edit

Write

\phiTAB

(meaning press tab key)

FrédéricC gravatar imageFrédéricC ( 2020-04-22 21:31:52 +0100 )edit

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

Cyrille gravatar imageCyrille ( 2020-04-22 23:15:22 +0100 )edit

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: 2020-04-22 18:08:50 +0100

Seen: 1,917 times

Last updated: Apr 22 '20