Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that).

How does one find what single symbols have special meaning in sage? Either lower case or upper case?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that).

How does one find what single symbols have special meaning in sage? Either lower case or upper case?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it if says object not found. But I think there should be a faster way?

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that).that). Same for E is special symbol and there might be more.

How does one find what single symbols have special meaning in sage? Either lower case case or upper case?case?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it if says object not found. But I think there should be a faster way?

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that). Same for E is special symbol and there might be more.

How does one find what single symbols have special meaning in sage? Either lower case or upper case?? To avoid using any of these in a symbolic expression?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it if says object not found. But I think there should be a faster way?

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that). Same for E is special symbol and there might be more.

How does one find what single symbols have special meaning in sage? Either lower case or upper case? To avoid using any of these in a symbolic expression?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it if says object not found. But I think there should be a faster way?

Btw, I think it is an error from sagemath to allow a user to do

   var(`I`)

or

 var('E')

At the very least, there should be a warning give, that this now overwrites special build-in symbol. So that I*I no longer gives -1 when doing this. But this is for another discussion.

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that). Same for E is special symbol and there might be more.

How does one find what single symbols have special meaning in sage? Either lower case or upper case? To avoid using any of these in a symbolic expression?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it if says object not found. But I think there should be a faster way?

Btw, I think it is an error from sagemath to allow a user to do

   var(`I`)

or

 var('E')

At the very least, there should be a warning give, given, that this now overwrites special build-in symbol. So that I*I no longer gives -1 when doing this. But this is for another discussion.

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that). Same for E is special symbol and there might be more.

How does one find what single symbols have special meaning in sage? Either lower case or upper case? To avoid using any of these in a symbolic expression?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs. hangs (because I is a simple now and not sqrt(-1) it was having hard time integrating it).

But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it and if it says object not found. found or not. But I think there should be a faster way?

Btw, I think it is an error from sagemath to allow a user to do

   var(`I`)

or

 var('E')

At the very least, there should be a warning given, given that this now overwrites a special build-in symbol. So that I*I no longer gives -1 as expected when doing this. But this is for another discussion.discussion.

-Nasser

how to find all special single letter symbols in sagemath?

I want to do var(....) and list all the single letters I could possibly use in symbolic expression. I just want to make sure I do not use a letter that has special meaning in sagemath. For example I is the sqrt(-1) so I will not include that in my var command (it causes problem when using external CAS systems from sage if I do that). Same for E is special symbol and there might be more.

How does one find what single symbols have special meaning in sage? Either lower case or upper case? To avoid using any of these in a symbolic expression?

Here is an example where by mistakes I added I to var and this causes fricas to hang when calling from sagemath

age: var('x e d c b a I')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

This hangs (because I is a simple now and not sqrt(-1) it was having hard time integrating it).

But if do (from clear session)

age: var('x e d c b a')
sage: integrate((a+I*a*tan(d*x+c))^(1/2)*tan(d*x+c)^(5/2),x, algorithm="fricas")

It now works and returns result very quickly.

I googled but having hard time getting such a list and I do not know what command to use in sage to find this out.

I know I could do ? on each letter to see if sagemath shows something about it and if it says object not found or not. But I think there should be a faster way?

Btw, I think it is an error from sagemath to allow a user to do

   var(`I`)

or

 var('E')

At the very least, there should be a warning given that this now overwrites a special build-in symbol. So that I*I no longer gives -1 as expected when doing this. But this is for another discussion.

-Nasser

update

Thanks to the answer. These are the letters that can be used

import string
alphabet = list(string.ascii_lowercase)
print(alphabet)

['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

my_vars = [i for i in alphabet if i not in globals()]
print(my_vars)
['a', 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'o', 'p', 'q', 's', 't', 'u', 'v', 'w', 'y', 'z']

alphabet = list(string.ascii_uppercase)
print(alphabet)

['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

my_vars = [i for i in alphabet if i not in globals()]
print(my_vars)

['A', 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'P', 'Q', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

So the safe letters to use in var are

 'a', 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'o', 'p', 'q', 's', 't', 'u', 'v', 'w', 'y', 'z'
 'A', 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'P', 'Q', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'