Revision history [back]

ϕ is a valid Python identifier, see:

sage: ϕ = 2
sage: ϕ
2


So, you should provide the whole code, what you want to achieve, and what is the problem, so that we can help debugging.

ϕ is a valid Python identifier, see:

sage: ϕ = 2
sage: ϕ
2


So, you should provide the whole code, what you want to achieve, and what is the problem, so that we can help debugging.

EDIT

TL;DR in the last line, this should be:

sage: f(x, D, phi, I, w_0)=sola*x + solb


Your strategy is as follows: while some libraries do not accept unicode symbols, Python accepts unicode names. So your trick is to let the Python name ϕ point to the symbol SR.var('phi'), and benefit from the fact that %display latex prints the symbol phi as ϕ.

Now, when you write

sage: f(x, D, ϕ, I, w_0)=sola*x + solb


this not Pythonic (you can not define f(x) = in Python), but we want such statement to be possible for mathematicians, so Sage adds a preparsing layer. See:

sage: preparse('f(x, D, ϕ, I, w_0)=sola*x + solb')
⎯⎯𝚝𝚖𝚙⎯⎯=𝚟𝚊𝚛("𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶");𝚏=𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗(𝚜𝚘𝚕𝚊*𝚡+𝚜𝚘𝚕𝚋).𝚏𝚞𝚗𝚌𝚝𝚒𝚘𝚗(𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶)


As you can see, the symbol ϕ is involved, which is not acceptable for some underlying libraries.

The fist thing is to understand the difference between a symbol, and a Python name, and again the var('x') function is a bit confusing with that respect since it lets the Python name x point to the symbolic variable SR.var('x').

ϕ is a valid Python identifier, see:

sage: ϕ = 2
sage: ϕ
2


So, you should provide the whole code, what you want to achieve, and what is the problem, so that we can help debugging.

EDIT

TL;DR in the last line, this should be:

sage: f(x, D, phi, I, w_0)=sola*x + solb


Your strategy is as follows: while some libraries do not accept unicode symbols, Python accepts unicode names. So your trick is to let the Python name ϕ point to the symbol SR.var('phi'), and benefit from the fact that %display latex prints the symbol phi as ϕ.

Now, when you write

sage: f(x, D, ϕ, I, w_0)=sola*x + solb


this not Pythonic (you can not define f(x) = in Python), but we want such statement to be possible for mathematicians, so Sage adds a preparsing layer. layer to Python. See:

sage: preparse('f(x, D, ϕ, I, w_0)=sola*x + solb')
⎯⎯𝚝𝚖𝚙⎯⎯=𝚟𝚊𝚛("𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶");𝚏=𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗(𝚜𝚘𝚕𝚊*𝚡+𝚜𝚘𝚕𝚋).𝚏𝚞𝚗𝚌𝚝𝚒𝚘𝚗(𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶)


As you can see, the symbol ϕ is involved, which is not acceptable for some underlying libraries.

The fist thing is to understand the difference between a symbol, and a Python name, and again the var('x') function is a bit confusing with that respect since it lets the Python name x point to the symbolic variable SR.var('x').

ϕ is a valid Python identifier, see:

sage: ϕ = 2
sage: ϕ
2


So, you should provide the whole code, what you want to achieve, and what is the problem, so that we can help debugging.

EDIT

TL;DR in the last line, this should be:

sage: f(x, D, phi, I, w_0)=sola*x + solb


Your strategy is as follows: while some libraries do not accept unicode symbols, Python accepts unicode names. So your trick is to let the Python name ϕ point to the symbol SR.var('phi'), and benefit from the fact that %display latex prints the symbol phi as ϕ.

Now, when you write

sage: f(x, D, ϕ, I, w_0)=sola*x + solb


this not Pythonic (you can not define f(x) = in Python), but we want such statement to be possible for mathematicians, so Sage adds a preparsing layer to Python. See:

sage: preparse('f(x, D, ϕ, I, w_0)=sola*x + solb')
⎯⎯𝚝𝚖𝚙⎯⎯=𝚟𝚊𝚛("𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶");𝚏=𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗(𝚜𝚘𝚕𝚊*𝚡+𝚜𝚘𝚕𝚋).𝚏𝚞𝚗𝚌𝚝𝚒𝚘𝚗(𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶)


As you can see, the symbol ϕ is involved, involved (it appears inside the var function), which is not acceptable for some underlying libraries.

The fist thing is to understand the difference between a symbol, and a Python name, and again the var('x') function is a bit confusing with that respect since it lets the Python name x point to the symbolic variable SR.var('x').

ϕ is a valid Python identifier, see:

sage: ϕ = 2
sage: ϕ
2


So, you should provide the whole code, what you want to achieve, and what is the problem, so that we can help debugging.

EDIT

TL;DR in the last line, this should be:

sage: f(x, D, phi, I, w_0)=sola*x + solb


Your strategy is as follows: while some libraries do not accept unicode symbols, Python accepts unicode names. So your trick is to let the Python name ϕ point to the symbol SR.var('phi'), and benefit from the fact that %display latex prints the symbol phi as ϕ.

Now, when you write

sage: f(x, D, ϕ, I, w_0)=sola*x + solb


this not Pythonic (you can not define f(x) = in Python), but we want such statement to be possible for mathematicians, so Sage adds a preparsing layer to Python. See:

sage: preparse('f(x, D, ϕ, I, w_0)=sola*x + solb')
⎯⎯𝚝𝚖𝚙⎯⎯=𝚟𝚊𝚛("𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶");𝚏=𝚜𝚢𝚖𝚋𝚘𝚕𝚒𝚌⎯𝚎𝚡𝚙𝚛𝚎𝚜𝚜𝚒𝚘𝚗(𝚜𝚘𝚕𝚊*𝚡+𝚜𝚘𝚕𝚋).𝚏𝚞𝚗𝚌𝚝𝚒𝚘𝚗(𝚡,𝙳,ϕ,𝙸,𝚠⎯𝟶)


As you can see, the symbol ϕ is involved (it appears inside the var function), which is not acceptable for some underlying libraries.

The fist thing is to understand the difference between a symbol, and a Python name, and again the var('x') function is a bit confusing with that respect since it lets the Python name x point to the symbolic variable symbol SR.var('x').