Re: [sympy] validating dimensional consistency of expression

2020-05-27 Thread Ben
I agree with your assessment. 

Here's my minimum working example where I don't use eval(str()) and get the 
problem.
>>> import sys
>>> sys.version
'3.6.9 (default, Apr 18 2020, 01:56:04) \n[GCC 8.4.0]'
>>> import sympy
>>> sympy.__version__
'1.5.1'
>>> from sympy.physics.units import mass, length, time
>>> from sympy.physics.units.systems.si import dimsys_SI
>>> from sympy.parsing.latex import parse_latex
>>> eq = parse_latex("F = m a")
>>> F = mass * length / time**2
>>> m = mass
>>> a = length / time**2
>>> dimsys_SI.equivalent_dims( eq.lhs, eq.rhs )
False

For context, here are the variables
>>> eq.lhs
F
>>> eq.rhs
a*m
>>> F
Dimension(length*mass/time**2)
>>> a
Dimension(length/time**2)
>>> a*m
Dimension(length*mass/time**2)
>>> m
Dimension(mass, M)


On Wednesday, May 27, 2020 at 8:59:42 PM UTC-4, Aaron Meurer wrote:
>
> Why are you using eval(str(eq.lhs))? That should just give back eq.lhs. 
>
> Aaron Meurer 
>
> On Wed, May 27, 2020 at 6:35 PM Ben > 
> wrote: 
> > 
> > Thanks Aaron for your help. 
> > 
> > With your guidance, I solved my problem (though my use of eval() feels 
> hacky). 
> > 
> > >>> import sympy 
> > >>> from sympy.physics.units import mass, length, time 
> > >>> from sympy.physics.units.systems.si import dimsys_SI 
> > >>> from sympy.parsing.latex import parse_latex 
> > >>> eq = parse_latex("F = m a") 
> > >>> F = mass * length / time**2 
> > >>> m = mass 
> > >>> a = length / time**2 
> > >>> dimsys_SI.equivalent_dims( eval(str(eq.lhs)), eval(str(eq.rhs)) ) 
> > True 
> > 
> > 
> > I used eval() rather than variable substitution 
> > >>> Fdim = mass * length / time**2 
> > >>> mdim = mass 
> > >>> adim = length / time**2 
> > >>> lhs_dim = eq.lhs.subs([(F, Fdim), (m, mdim), (a, adim)]) 
> > >>> rhs_dim = eq.rhs.subs([(F, Fdim), (m, mdim), (a, adim)]) 
> > because I was not able to figure out how to simplify the RHS 
> > >>> rhs_dim 
> > Dimension(length/time**2)*Dimension(mass, M) 
> > 
> > Even though the RHS dimensions simplify to be equivalent to the LHS, I 
> get an error when I compare the LHS and RHS: 
> > >>> dimsys_SI.equivalent_dims( lhs_dim, rhs_dim ) 
> > Traceback (most recent call last): 
> >   File "", line 1, in  
> >   File 
> "/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
> line 455, in equivalent_dims 
> > deps2 = self.get_dimensional_dependencies(dim2) 
> >   File 
> "/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
> line 448, in get_dimensional_dependencies 
> > dimdep = self._get_dimensional_dependencies_for_name(name) 
> >   File 
> "/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
> line 422, in _get_dimensional_dependencies_for_name 
> > for k, v in d.items(): 
> > AttributeError: 'NoneType' object has no attribute 'items' 
> > 
> > 
> > On Wednesday, May 27, 2020 at 7:01:02 PM UTC-4, Aaron Meurer wrote: 
> >> 
> >> You're right that you have to define the Python variable name to 
> >> access F like that. See 
> >> https://docs.sympy.org/latest/tutorial/gotchas.html. 
> >> 
> >> You can get all the symbols in an expression with eq.free_symbols. Or 
> >> if you know the symbol is F you can just set 
> >> 
> >> F = symbols('F') 
> >> 
> >> since symbols with the same name are equal, so F will be the same as 
> >> the symbol F in the expression from parse_latex. 
> >> 
> >> Aaron Meurer 
> >> 
> >> On Wed, May 27, 2020 at 2:37 PM Ben  wrote: 
> >> > 
> >> > Hello, 
> >> > 
> >> > I have a string written in Latex for which I know the dimensions of 
> each symbol. My goal is to validate the dimensional consistency of the 
> expression. I'm having trouble with substitution. For example, 
> >> > 
> >> > >>> from sympy.physics.units import mass, length, time 
> >> > >>> from sympy.physics.units.systems.si import dimsys_SI 
> >> > >>> from sympy.parsing.latex import parse_latex 
> >> > >>> eq = parse_latex("F = m a") 
> >> > >>> eq 
> >> > Eq(F, a*m) 
> >> > 
> >> > I can get the symbols from that expression 
> >> > >>> set_of_symbols_in_eq = eq.free_symbols 
> >> > 
> >> > And for each symbol in the set I know what dimensions each has: 
> >> > >>> Fdim = mass * length / time**2 
> >> > >>> mdim = mass 
> >> > >>> adim = length / time**2 
> >> > 
> >> > When I try substituting the dimensions into the original expression, 
> I get an error 
> >> > >>> eq.subs({F: Fdim, m: mdim, a: adim}) 
> >> > Traceback (most recent call last): 
> >> >   File "", line 1, in  
> >> > NameError: name 'F' is not defined 
> >> > 
> >> > That is surprising, because F is a Symbol: 
> >> > >>> eq.lhs 
> >> > F 
> >> > >>> type(eq.lhs) 
> >> >  
> >> > 
> >> > I think that error means that although F is a Symbol, there isn't a 
> variable named F that points to the Symbol F? 
> >> > If that's the case, I don't know how to access the symbols in the 
> abstract syntax tree provided by eq. 
> >> > How would I indicate to SymPy that "F = m a" in eq has variables with 
> certain dimensions? 
> 

Re: [sympy] validating dimensional consistency of expression

2020-05-27 Thread Aaron Meurer
Why are you using eval(str(eq.lhs))? That should just give back eq.lhs.

Aaron Meurer

On Wed, May 27, 2020 at 6:35 PM Ben  wrote:
>
> Thanks Aaron for your help.
>
> With your guidance, I solved my problem (though my use of eval() feels hacky).
>
> >>> import sympy
> >>> from sympy.physics.units import mass, length, time
> >>> from sympy.physics.units.systems.si import dimsys_SI
> >>> from sympy.parsing.latex import parse_latex
> >>> eq = parse_latex("F = m a")
> >>> F = mass * length / time**2
> >>> m = mass
> >>> a = length / time**2
> >>> dimsys_SI.equivalent_dims( eval(str(eq.lhs)), eval(str(eq.rhs)) )
> True
>
>
> I used eval() rather than variable substitution
> >>> Fdim = mass * length / time**2
> >>> mdim = mass
> >>> adim = length / time**2
> >>> lhs_dim = eq.lhs.subs([(F, Fdim), (m, mdim), (a, adim)])
> >>> rhs_dim = eq.rhs.subs([(F, Fdim), (m, mdim), (a, adim)])
> because I was not able to figure out how to simplify the RHS
> >>> rhs_dim
> Dimension(length/time**2)*Dimension(mass, M)
>
> Even though the RHS dimensions simplify to be equivalent to the LHS, I get an 
> error when I compare the LHS and RHS:
> >>> dimsys_SI.equivalent_dims( lhs_dim, rhs_dim )
> Traceback (most recent call last):
>   File "", line 1, in 
>   File 
> "/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
> line 455, in equivalent_dims
> deps2 = self.get_dimensional_dependencies(dim2)
>   File 
> "/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
> line 448, in get_dimensional_dependencies
> dimdep = self._get_dimensional_dependencies_for_name(name)
>   File 
> "/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
> line 422, in _get_dimensional_dependencies_for_name
> for k, v in d.items():
> AttributeError: 'NoneType' object has no attribute 'items'
>
>
> On Wednesday, May 27, 2020 at 7:01:02 PM UTC-4, Aaron Meurer wrote:
>>
>> You're right that you have to define the Python variable name to
>> access F like that. See
>> https://docs.sympy.org/latest/tutorial/gotchas.html.
>>
>> You can get all the symbols in an expression with eq.free_symbols. Or
>> if you know the symbol is F you can just set
>>
>> F = symbols('F')
>>
>> since symbols with the same name are equal, so F will be the same as
>> the symbol F in the expression from parse_latex.
>>
>> Aaron Meurer
>>
>> On Wed, May 27, 2020 at 2:37 PM Ben  wrote:
>> >
>> > Hello,
>> >
>> > I have a string written in Latex for which I know the dimensions of each 
>> > symbol. My goal is to validate the dimensional consistency of the 
>> > expression. I'm having trouble with substitution. For example,
>> >
>> > >>> from sympy.physics.units import mass, length, time
>> > >>> from sympy.physics.units.systems.si import dimsys_SI
>> > >>> from sympy.parsing.latex import parse_latex
>> > >>> eq = parse_latex("F = m a")
>> > >>> eq
>> > Eq(F, a*m)
>> >
>> > I can get the symbols from that expression
>> > >>> set_of_symbols_in_eq = eq.free_symbols
>> >
>> > And for each symbol in the set I know what dimensions each has:
>> > >>> Fdim = mass * length / time**2
>> > >>> mdim = mass
>> > >>> adim = length / time**2
>> >
>> > When I try substituting the dimensions into the original expression, I get 
>> > an error
>> > >>> eq.subs({F: Fdim, m: mdim, a: adim})
>> > Traceback (most recent call last):
>> >   File "", line 1, in 
>> > NameError: name 'F' is not defined
>> >
>> > That is surprising, because F is a Symbol:
>> > >>> eq.lhs
>> > F
>> > >>> type(eq.lhs)
>> > 
>> >
>> > I think that error means that although F is a Symbol, there isn't a 
>> > variable named F that points to the Symbol F?
>> > If that's the case, I don't know how to access the symbols in the abstract 
>> > syntax tree provided by eq.
>> > How would I indicate to SymPy that "F = m a" in eq has variables with 
>> > certain dimensions?
>> >
>> > My goal is to run
>> > >>> dimsys_SI.equivalent_dims(Fdim, mdim * adim)
>> > True
>> > without retyping the expression.
>> >
>> > I think I want something like the following, except with dimensions 
>> > substituted for each symbol.
>> > >>> dimsys_SI.equivalent_dims( eq.lhs, eq.rhs )
>> > False
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to sy...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/sympy/a4e2b3fe-27b2-45b8-a7f6-598caea772de%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/6e6c4358-7894-4099-9d27-74c5fefe2a31%40googlegroups.com.

-- 
You received this message because you are subscribed to 

Re: [sympy] validating dimensional consistency of expression

2020-05-27 Thread Ben
Thanks Aaron for your help. 

With your guidance, I solved my problem (though my use of eval() feels 
hacky).

>>> import sympy
>>> from sympy.physics.units import mass, length, time
>>> from sympy.physics.units.systems.si import dimsys_SI
>>> from sympy.parsing.latex import parse_latex
>>> eq = parse_latex("F = m a")
>>> F = mass * length / time**2
>>> m = mass
>>> a = length / time**2
>>> dimsys_SI.equivalent_dims( eval(str(eq.lhs)), eval(str(eq.rhs)) )
True


I used eval() rather than variable substitution
>>> Fdim = mass * length / time**2
>>> mdim = mass
>>> adim = length / time**2
>>> lhs_dim = eq.lhs.subs([(F, Fdim), (m, mdim), (a, adim)])
>>> rhs_dim = eq.rhs.subs([(F, Fdim), (m, mdim), (a, adim)])
because I was not able to figure out how to simplify the RHS 
>>> rhs_dim
Dimension(length/time**2)*Dimension(mass, M)

Even though the RHS dimensions simplify to be equivalent to the LHS, I get 
an error when I compare the LHS and RHS: 
>>> dimsys_SI.equivalent_dims( lhs_dim, rhs_dim )
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
line 455, in equivalent_dims
deps2 = self.get_dimensional_dependencies(dim2)
  File 
"/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
line 448, in get_dimensional_dependencies
dimdep = self._get_dimensional_dependencies_for_name(name)
  File 
"/usr/local/lib/python3.6/dist-packages/sympy/physics/units/dimensions.py", 
line 422, in _get_dimensional_dependencies_for_name
for k, v in d.items():
AttributeError: 'NoneType' object has no attribute 'items'


On Wednesday, May 27, 2020 at 7:01:02 PM UTC-4, Aaron Meurer wrote:
>
> You're right that you have to define the Python variable name to 
> access F like that. See 
> https://docs.sympy.org/latest/tutorial/gotchas.html. 
>
> You can get all the symbols in an expression with eq.free_symbols. Or 
> if you know the symbol is F you can just set 
>
> F = symbols('F') 
>
> since symbols with the same name are equal, so F will be the same as 
> the symbol F in the expression from parse_latex. 
>
> Aaron Meurer 
>
> On Wed, May 27, 2020 at 2:37 PM Ben > 
> wrote: 
> > 
> > Hello, 
> > 
> > I have a string written in Latex for which I know the dimensions of each 
> symbol. My goal is to validate the dimensional consistency of the 
> expression. I'm having trouble with substitution. For example, 
> > 
> > >>> from sympy.physics.units import mass, length, time 
> > >>> from sympy.physics.units.systems.si import dimsys_SI 
> > >>> from sympy.parsing.latex import parse_latex 
> > >>> eq = parse_latex("F = m a") 
> > >>> eq 
> > Eq(F, a*m) 
> > 
> > I can get the symbols from that expression 
> > >>> set_of_symbols_in_eq = eq.free_symbols 
> > 
> > And for each symbol in the set I know what dimensions each has: 
> > >>> Fdim = mass * length / time**2 
> > >>> mdim = mass 
> > >>> adim = length / time**2 
> > 
> > When I try substituting the dimensions into the original expression, I 
> get an error 
> > >>> eq.subs({F: Fdim, m: mdim, a: adim}) 
> > Traceback (most recent call last): 
> >   File "", line 1, in  
> > NameError: name 'F' is not defined 
> > 
> > That is surprising, because F is a Symbol: 
> > >>> eq.lhs 
> > F 
> > >>> type(eq.lhs) 
> >  
> > 
> > I think that error means that although F is a Symbol, there isn't a 
> variable named F that points to the Symbol F? 
> > If that's the case, I don't know how to access the symbols in the 
> abstract syntax tree provided by eq. 
> > How would I indicate to SymPy that "F = m a" in eq has variables with 
> certain dimensions? 
> > 
> > My goal is to run 
> > >>> dimsys_SI.equivalent_dims(Fdim, mdim * adim) 
> > True 
> > without retyping the expression. 
> > 
> > I think I want something like the following, except with dimensions 
> substituted for each symbol. 
> > >>> dimsys_SI.equivalent_dims( eq.lhs, eq.rhs ) 
> > False 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "sympy" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sy...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/a4e2b3fe-27b2-45b8-a7f6-598caea772de%40googlegroups.com.
>  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/6e6c4358-7894-4099-9d27-74c5fefe2a31%40googlegroups.com.


Re: [sympy] validating dimensional consistency of expression

2020-05-27 Thread Aaron Meurer
You're right that you have to define the Python variable name to
access F like that. See
https://docs.sympy.org/latest/tutorial/gotchas.html.

You can get all the symbols in an expression with eq.free_symbols. Or
if you know the symbol is F you can just set

F = symbols('F')

since symbols with the same name are equal, so F will be the same as
the symbol F in the expression from parse_latex.

Aaron Meurer

On Wed, May 27, 2020 at 2:37 PM Ben  wrote:
>
> Hello,
>
> I have a string written in Latex for which I know the dimensions of each 
> symbol. My goal is to validate the dimensional consistency of the expression. 
> I'm having trouble with substitution. For example,
>
> >>> from sympy.physics.units import mass, length, time
> >>> from sympy.physics.units.systems.si import dimsys_SI
> >>> from sympy.parsing.latex import parse_latex
> >>> eq = parse_latex("F = m a")
> >>> eq
> Eq(F, a*m)
>
> I can get the symbols from that expression
> >>> set_of_symbols_in_eq = eq.free_symbols
>
> And for each symbol in the set I know what dimensions each has:
> >>> Fdim = mass * length / time**2
> >>> mdim = mass
> >>> adim = length / time**2
>
> When I try substituting the dimensions into the original expression, I get an 
> error
> >>> eq.subs({F: Fdim, m: mdim, a: adim})
> Traceback (most recent call last):
>   File "", line 1, in 
> NameError: name 'F' is not defined
>
> That is surprising, because F is a Symbol:
> >>> eq.lhs
> F
> >>> type(eq.lhs)
> 
>
> I think that error means that although F is a Symbol, there isn't a variable 
> named F that points to the Symbol F?
> If that's the case, I don't know how to access the symbols in the abstract 
> syntax tree provided by eq.
> How would I indicate to SymPy that "F = m a" in eq has variables with certain 
> dimensions?
>
> My goal is to run
> >>> dimsys_SI.equivalent_dims(Fdim, mdim * adim)
> True
> without retyping the expression.
>
> I think I want something like the following, except with dimensions 
> substituted for each symbol.
> >>> dimsys_SI.equivalent_dims( eq.lhs, eq.rhs )
> False
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/a4e2b3fe-27b2-45b8-a7f6-598caea772de%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LsN9%2B6y34_4TAY_FvAuErE%2B1UYd6jNeuS1GcxADMJBZw%40mail.gmail.com.


Re: [sympy] Reason for this output.

2020-05-27 Thread Mohit Shah
I got that.
:members: only shows non private methods.
I got that when I read the document on autodoc again.
Is that right?

On Thursday, May 28, 2020 at 1:55:01 AM UTC+5:30, Mohit Shah wrote:
>
> [image: SympyAssumption2.PNG]
> It is something like this.
>
> But recently, I saw that I am getting some warnings while running 'make 
> html' command.
>
> [image: SympyAssumption3.PNG]
>
>
>
> On Wednesday, May 27, 2020 at 10:57:32 PM UTC+5:30, Aaron Meurer wrote:
>>
>> What does the rst file that you are building look like?
>>
>> Aaron Meurer
>>
>> On Wed, May 27, 2020 at 4:27 AM Mohit Shah  wrote:
>>
>>> I would like to know why I am not getting AssumptionContext() class in 
>>> the output? In the output, it started with the AppliedPredicate Class. Can 
>>> anyone explain reason behind this output?
>>>
>>> [image: SympyAssumption.PNG]
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "sympy" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to sy...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sympy/f3552fb8-370d-47af-9b04-c7e53c2ef82b%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/6612baf2-de32-459d-901f-eea61c28fc10%40googlegroups.com.


Re: [sympy] Reason for this output.

2020-05-27 Thread Mohit Shah
I got that.
:members: only shows non private methods.
I got that when I read the document on autodoc again.
Thanks.

On Thursday, May 28, 2020 at 1:55:01 AM UTC+5:30, Mohit Shah wrote:
>
> [image: SympyAssumption2.PNG]
> It is something like this.
>
> But recently, I saw that I am getting some warnings while running 'make 
> html' command.
>
> [image: SympyAssumption3.PNG]
>
>
>
> On Wednesday, May 27, 2020 at 10:57:32 PM UTC+5:30, Aaron Meurer wrote:
>>
>> What does the rst file that you are building look like?
>>
>> Aaron Meurer
>>
>> On Wed, May 27, 2020 at 4:27 AM Mohit Shah  wrote:
>>
>>> I would like to know why I am not getting AssumptionContext() class in 
>>> the output? In the output, it started with the AppliedPredicate Class. Can 
>>> anyone explain reason behind this output?
>>>
>>> [image: SympyAssumption.PNG]
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "sympy" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to sy...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sympy/f3552fb8-370d-47af-9b04-c7e53c2ef82b%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/076a3137-502b-49e2-a2d5-2fd2d5c87ac4%40googlegroups.com.


[sympy] Re: Error while following steps of sympy document

2020-05-27 Thread Mohit Shah
Yes, I tried that as well.
I don't know how but when I cloned the project again from github, It worked.
Thanks for the help.

On Wednesday, May 27, 2020 at 10:08:36 PM UTC+5:30, S.Y. Lee wrote:
>
> Have you tried
> sudo apt-get update
>
>
> On Tuesday, May 26, 2020 at 10:49:46 PM UTC+9, Mohit Shah wrote:
>>
>> I am getting the following error while I was following steps through 
>> sympy document. Please help to resolve this error.
>> Thanks
>>
>> [image: SympyError.PNG]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/449219f9-64a1-4bf7-b8c8-c88115adca3d%40googlegroups.com.


[sympy] validating dimensional consistency of expression

2020-05-27 Thread Ben
Hello,

I have a string written in Latex for which I know the dimensions of each 
symbol. My goal is to validate the dimensional consistency of the 
expression. I'm having trouble with substitution. For example,

>>> from sympy.physics.units import mass, length, time
>>> from sympy.physics.units.systems.si import dimsys_SI
>>> from sympy.parsing.latex import parse_latex
>>> eq = parse_latex("F = m a")
>>> eq
Eq(F, a*m)

I can get the symbols from that expression
>>> set_of_symbols_in_eq = eq.free_symbols

And for each symbol in the set I know what dimensions each has:
>>> Fdim = mass * length / time**2
>>> mdim = mass
>>> adim = length / time**2

When I try substituting the dimensions into the original expression, I get 
an error 
>>> eq.subs({F: Fdim, m: mdim, a: adim})
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'F' is not defined

That is surprising, because *F* is a Symbol:
>>> eq.lhs
F
>>> type(eq.lhs)


I think that error means that although *F* is a Symbol, there isn't a 
variable named F that points to the Symbol F?
If that's the case, I don't know how to access the symbols in the abstract 
syntax tree provided by *eq*. 
How would I indicate to SymPy that "F = m a" in *eq* has variables with 
certain dimensions?

My goal is to run 
>>> dimsys_SI.equivalent_dims(Fdim, mdim * adim)
True
without retyping the expression. 

I think I want something like the following, except with dimensions 
substituted for each symbol.
>>> dimsys_SI.equivalent_dims( eq.lhs, eq.rhs )
False

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/a4e2b3fe-27b2-45b8-a7f6-598caea772de%40googlegroups.com.


Re: [sympy] Re: Can a GSOD slot be used to improve the website?

2020-05-27 Thread Aaron Meurer
I think we can modify the backend, but we should be prepared as
mentors to do the programming work. Conversely, I don't know if it
would make sense to make any changes without feedback from a technical
writer if we are going to get one, so I don't know if it makes sense
to do anything like this now, aside from initial research into what
alternatives are out there.

Aaron Meurer

On Wed, May 27, 2020 at 12:21 PM S.Y. Lee  wrote:
>
> It just gives an another reason to hurry up setting up the static web 
> framework.
> Unfortunately, I don't think that it is possible to edit sympy.org than 
> messing with html files, besides the translations, so it will not be easy for 
> technical writers.
>
> On Tuesday, May 26, 2020 at 1:20:01 AM UTC+9, Jason Moore wrote:
>>
>> I was admiring the new NumPy website: https://numpy.org/ and thinking how 
>> some of these elements, design, and features could be a nice improvement to 
>> the SymPy website. The new NumPy website really gives an air of being a 
>> professional piece of software that is a foundation for so many other 
>> things. SymPy is also similarly professional and influential but I'm not 
>> sure our website makes that as clear as it could be.
>>
>> Can one of the GSOD topics be a website overhall?
>>
>> Jason
>> moorepants.info
>> +01 530-601-9791
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/2079f695-ff3f-4ef5-a1b3-7c2672fb5d49%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6JBwuRwXo%3DzGY3L9OoqR3vfz10gm8_ufOxdkTjq_3ajNA%40mail.gmail.com.


[sympy] Re: Can a GSOD slot be used to improve the website?

2020-05-27 Thread S.Y. Lee
It just gives an another reason to hurry up setting up the static web 
framework.
Unfortunately, I don't think that it is possible to edit sympy.org than 
messing with html files, besides the translations, so it will not be easy 
for technical writers.

On Tuesday, May 26, 2020 at 1:20:01 AM UTC+9, Jason Moore wrote:
>
> I was admiring the new NumPy website: https://numpy.org/ and thinking how 
> some of these elements, design, and features could be a nice improvement to 
> the SymPy website. The new NumPy website really gives an air of being a 
> professional piece of software that is a foundation for so many other 
> things. SymPy is also similarly professional and influential but I'm not 
> sure our website makes that as clear as it could be.
>
> Can one of the GSOD topics be a website overhall?
>
> Jason
> moorepants.info
> +01 530-601-9791
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/2079f695-ff3f-4ef5-a1b3-7c2672fb5d49%40googlegroups.com.


Re: [sympy] Re: Can a GSOD slot be used to improve the website?

2020-05-27 Thread Aaron Meurer
I 100% agree with Jason here. In fact, I would say that the mentors
should help do any programming/tooling related fixes that are needed
to support the GSoD technical writers. This makes GSoD a harder
program to mentor than GSoC.

Aaron Meurer

On Wed, May 27, 2020 at 11:51 AM Jason Moore  wrote:
>
> I think a GSOD spot would be better spent on working on content, not tooling 
> and other things. Its a key distinction in the GSoC and GSoD programs. The 
> docs program is supposed to be suitable for people that don't necessarily 
> have programming know how.
>
> Jason
> moorepants.info
> +01 530-601-9791
>
>
> On Wed, May 27, 2020 at 10:31 AM Aaron Meurer  wrote:
>>
>> It is a possibility. It mainly depends on what we would gain from doing so.
>>
>> I would add that, at least in my opinion, our website isn't in too bad
>> of a state, especially compared to the NumPy site as it was before the
>> refactor. As a reminder, this is what it used to look like
>> https://web.archive.org/web/20200519014349/https://numpy.org/
>>
>> But one thing I would agree with is that it can be difficult to add
>> content to our website. So in that sense, a better static site
>> generator could offer some benefits.
>>
>> Aaron Meurer
>>
>> On Wed, May 27, 2020 at 3:22 AM S.Y. Lee  wrote:
>> >
>> > I see numpy.org is now using hugo.
>> > We may have consider changing the static site generator like
>> > https://github.com/numpy/numpy.org/issues/29
>> >
>> > On Tuesday, May 26, 2020 at 1:20:01 AM UTC+9, Jason Moore wrote:
>> >>
>> >> I was admiring the new NumPy website: https://numpy.org/ and thinking how 
>> >> some of these elements, design, and features could be a nice improvement 
>> >> to the SymPy website. The new NumPy website really gives an air of being 
>> >> a professional piece of software that is a foundation for so many other 
>> >> things. SymPy is also similarly professional and influential but I'm not 
>> >> sure our website makes that as clear as it could be.
>> >>
>> >> Can one of the GSOD topics be a website overhall?
>> >>
>> >> Jason
>> >> moorepants.info
>> >> +01 530-601-9791
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to sympy+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/sympy/cd9836cc-e8af-4306-9645-3119a430e05a%40googlegroups.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sympy+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sympy/CAKgW%3D6LP7N%2Bn5svs%2B9FzmrCyDhsYNKyjyvNu8vFfEpDomFMFbQ%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/CAP7f1Ai0LMad9b0WqXHtA5F%3DdKJzUc68%3Dzmi8j1aeBpQ0p1p_A%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6KNc4x%2BOY%2B%2B_xMFShnh2TkpQLgHZFW_c%3DLcHF0aBoUs3Q%40mail.gmail.com.


Re: [sympy] Re: Can a GSOD slot be used to improve the website?

2020-05-27 Thread Jason Moore
I think a GSOD spot would be better spent on working on content, not
tooling and other things. Its a key distinction in the GSoC and GSoD
programs. The docs program is supposed to be suitable for people that don't
necessarily have programming know how.

Jason
moorepants.info
+01 530-601-9791


On Wed, May 27, 2020 at 10:31 AM Aaron Meurer  wrote:

> It is a possibility. It mainly depends on what we would gain from doing so.
>
> I would add that, at least in my opinion, our website isn't in too bad
> of a state, especially compared to the NumPy site as it was before the
> refactor. As a reminder, this is what it used to look like
> https://web.archive.org/web/20200519014349/https://numpy.org/
>
> But one thing I would agree with is that it can be difficult to add
> content to our website. So in that sense, a better static site
> generator could offer some benefits.
>
> Aaron Meurer
>
> On Wed, May 27, 2020 at 3:22 AM S.Y. Lee  wrote:
> >
> > I see numpy.org is now using hugo.
> > We may have consider changing the static site generator like
> > https://github.com/numpy/numpy.org/issues/29
> >
> > On Tuesday, May 26, 2020 at 1:20:01 AM UTC+9, Jason Moore wrote:
> >>
> >> I was admiring the new NumPy website: https://numpy.org/ and thinking
> how some of these elements, design, and features could be a nice
> improvement to the SymPy website. The new NumPy website really gives an air
> of being a professional piece of software that is a foundation for so many
> other things. SymPy is also similarly professional and influential but I'm
> not sure our website makes that as clear as it could be.
> >>
> >> Can one of the GSOD topics be a website overhall?
> >>
> >> Jason
> >> moorepants.info
> >> +01 530-601-9791
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "sympy" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to sympy+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/cd9836cc-e8af-4306-9645-3119a430e05a%40googlegroups.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAKgW%3D6LP7N%2Bn5svs%2B9FzmrCyDhsYNKyjyvNu8vFfEpDomFMFbQ%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAP7f1Ai0LMad9b0WqXHtA5F%3DdKJzUc68%3Dzmi8j1aeBpQ0p1p_A%40mail.gmail.com.


Re: [sympy] Re: Can a GSOD slot be used to improve the website?

2020-05-27 Thread Aaron Meurer
It is a possibility. It mainly depends on what we would gain from doing so.

I would add that, at least in my opinion, our website isn't in too bad
of a state, especially compared to the NumPy site as it was before the
refactor. As a reminder, this is what it used to look like
https://web.archive.org/web/20200519014349/https://numpy.org/

But one thing I would agree with is that it can be difficult to add
content to our website. So in that sense, a better static site
generator could offer some benefits.

Aaron Meurer

On Wed, May 27, 2020 at 3:22 AM S.Y. Lee  wrote:
>
> I see numpy.org is now using hugo.
> We may have consider changing the static site generator like
> https://github.com/numpy/numpy.org/issues/29
>
> On Tuesday, May 26, 2020 at 1:20:01 AM UTC+9, Jason Moore wrote:
>>
>> I was admiring the new NumPy website: https://numpy.org/ and thinking how 
>> some of these elements, design, and features could be a nice improvement to 
>> the SymPy website. The new NumPy website really gives an air of being a 
>> professional piece of software that is a foundation for so many other 
>> things. SymPy is also similarly professional and influential but I'm not 
>> sure our website makes that as clear as it could be.
>>
>> Can one of the GSOD topics be a website overhall?
>>
>> Jason
>> moorepants.info
>> +01 530-601-9791
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/cd9836cc-e8af-4306-9645-3119a430e05a%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LP7N%2Bn5svs%2B9FzmrCyDhsYNKyjyvNu8vFfEpDomFMFbQ%40mail.gmail.com.


[sympy] Re: Error while following steps of sympy document

2020-05-27 Thread S.Y. Lee
Have you tried
sudo apt-get update


On Tuesday, May 26, 2020 at 10:49:46 PM UTC+9, Mohit Shah wrote:
>
> I am getting the following error while I was following steps through sympy 
> document. Please help to resolve this error.
> Thanks
>
> [image: SympyError.PNG]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/fdd924b9-3a14-493e-89be-7e58dda86abd%40googlegroups.com.


Re: [sympy] Simple definition of equations that might be worth folding into SymPy...

2020-05-27 Thread Jonathan Gutow


On Wednesday, May 27, 2020 at 3:26:00 AM UTC-5, czgdp1807 wrote:
>
> Hi, 
>
> Is https://github.com/sympy/sympy/issues/5031 related to your work? 
>
 
Sort of. This https://github.com/sympy/sympy/pull/18174 and 
https://github.com/sympy/sympy/issues/4986 (where Oscar Benjamin 
 and I have already had a bit of 
discussion) are more directly related.

As it appears there is some interest, I will pursue this more.

Thanks,
Jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/ec46c6f0-e62c-4838-b009-73f7fcba73ff%40googlegroups.com.


Re: [sympy] Question on using Symbol as instance naming

2020-05-27 Thread mcpl snu
Can you recall why it was rejected, please? I really would like to know.

2020년 5월 27일 수요일 오전 4시 51분 16초 UTC+9, Aaron Meurer 님의 말:
>
> I think this was discussed in the past and we decided we don't want a 
> String object. Unfortunately GitHub's issue search is kind of bad so 
> I'm having a hard time finding the discussions. 
>
> Aaron Meurer 
>
> On Tue, May 26, 2020 at 2:34 AM mcpl snu > 
> wrote: 
> > 
> > Currently, many classes in SymPy include Symbol in args to provide the 
> names to their instances. An example for this is sympy.vector.CoordSys3D 
> class. 
> > 
> > Although this can be a clever way to do it, I think this is wierd - 
> perhaps it's an abuse of using Symbol. As far as I know, SymPy's Symbol is 
> a scalar whose operations, e.g. addition, integration, etc... are defined. 
> When we say "This 3D system's name is 'C'", we don't expect that this 'C' 
> can be substituted, divided, or subject to any other operation. Then why 
> use Symbol to denote it in the first place? 
> > 
> > Not only this design is unnecessary, it actually raises error. Please 
> refer to this issue page for example 
> > 
> > Although there can be many ways to circumvent this issue, I think the 
> most simple way is to introduce String class, which wraps str and is a 
> subclass of Atom. 
> > 
> > If there is any reason to use Symbol for this purpose that I overlooked, 
> please leave a comment here. Thank you. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "sympy" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sy...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/1ce4ea17-af3e-4fc4-9870-013bf57a%40googlegroups.com.
>  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/31ddf716-c96e-4e51-84ce-366a3a2bb5ee%40googlegroups.com.


[sympy] Re: Can a GSOD slot be used to improve the website?

2020-05-27 Thread S.Y. Lee
I see numpy.org is now using hugo.
We may have consider changing the static site generator like
https://github.com/numpy/numpy.org/issues/29

On Tuesday, May 26, 2020 at 1:20:01 AM UTC+9, Jason Moore wrote:
>
> I was admiring the new NumPy website: https://numpy.org/ and thinking how 
> some of these elements, design, and features could be a nice improvement to 
> the SymPy website. The new NumPy website really gives an air of being a 
> professional piece of software that is a foundation for so many other 
> things. SymPy is also similarly professional and influential but I'm not 
> sure our website makes that as clear as it could be.
>
> Can one of the GSOD topics be a website overhall?
>
> Jason
> moorepants.info
> +01 530-601-9791
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/cd9836cc-e8af-4306-9645-3119a430e05a%40googlegroups.com.


Re: [sympy] Re: tests for parsing Latex input to Sympy

2020-05-27 Thread Francesco Bonazzi
Parsing a LaTeX expression should ideally return candidate SymPy 
expressions with a matching probability. In case of unambiguous matching, 
only one expression should have a high matching probability. In case of 
ambiguous matching, two or more SymPy expressions should have high 
probability.

Topic also matters. If you have a physics paper, you'd probably want it to 
match some particular kind of expression subsets.

On Tuesday, 26 May 2020 13:33:14 UTC+2, Ben wrote:
>
>
>
> On Tuesday, May 26, 2020 at 7:23:42 AM UTC-4, David Bailey wrote:
>>
>> On 25/05/2020 23:42, Ben wrote:
>>
>>  You're totally correct -- Latex is ambiguous. I don't find your 
>>> observation discouraging since it is perfectly reasonable. 
>>>
>>
>> The issue I'm interested in tackling is the conversion of math presented 
>> in Physics papers (e.g., .tex files on arxiv.org) to a semantically 
>> meaningful and unambiguous representation (e.g., Sympy). 
>>
>> This issue would be moot if Physics papers were written in Sympy.  I 
>> don't have insight on how to construct incentives that would lead to use of 
>> Sympy in Physics papers, so I'm working on the Latex-to-Sympy approach. 
>>
>> Right - well in that case, maybe a system of hints that the user could 
>> add to your parser, would be really useful. For example if a user could 
>> tell your parser that superscripts were usually tensor subscripts rather 
>> than exponents (or alternatively that certain symbols used as superscripts 
>> would never mean exponents) you could come out with a better translation. 
>> Another useful hint, might be a list of the multi-letter symbols in use - 
>> sin, cos, exp, ln etc. so that you could resolve your ambiguity of what ab 
>> means - I mean sometimes sin(x) might mean s*i*n(x) and that could be 
>> handled by user specifying that only certain  multi-letter symbols were in 
>> use.
>>
>> David
>>
>>
>>
> Yeah, in talking this over with a collaborator about this, we think there 
> are various sources to help with parsing. 
>
>- within the math latex string to parse, what can be deduced about the 
>expected context?
>- given other math expressions in the same paper, what would be 
>consistent?
>- given the text in a paper surrounding the math expressions, what 
>would be expected based on keywords?
>- given other papers in the same domain or based on citations, what 
>would be likely?
>- what is statistically likely give the corpus of all articles?
>
> This is, in some sense, the same process a human goes through to decode 
> the intended meaning of any given math expression in a scientific paper. We 
> are looking to encode that process as a Python program. (That's beyond the 
> scope of Sympy but is context for the issue.)
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/aa518861-6ca7-4edb-be2e-e05c4f1fdf7d%40googlegroups.com.


Re: [sympy] Simple definition of equations that might be worth folding into SymPy...

2020-05-27 Thread Gagandeep Singh (B17CS021)
Hi,

Is https://github.com/sympy/sympy/issues/5031 related to your work?

With Regards,
Gagandeep Singh
Github - https://github.com/czgdp1807
LinkedIn - https://www.linkedin.com/in/czgdp1807

On Wed, 27 May, 2020, 11:20 AM Jonathan Gutow,  wrote:

> Dear SymPy Community,
>
> For use by my students I have built a simple definition of equations (so
> far only supporting equalities) that allows them to leverage SymPy to do
> algebraic rearrangements on equations the way they are used to doing it on
> paper, by applying the same operation to both sides. This duplicates
> behavior available in SageMath  and Maxima
>  as well as other symbolic math packages.
> A demonstration may be seen on myBinder:
> https://mybinder.org/v2/gh/gutow/Algebra_with_Sympy.git/master.
> 
>
> Is this something that would be a useful addition to SymPy? If there is
> interest, I will begin looking into what would be involved in adding it to
> SymPy. I would also appreciate any help people can offer. At present it is
> only about 150 lines of code, but could probably use some expansion to make
> it more general. All the tests are in the form of Jupyter notebooks at
> present, so would need work as well.
>
> Regards,
> Jonathan Gutow
> Professor of Physical Chemistry
> University of Wisconsin Oshkosh
> https://www.uwosh.edu/facstaff/gutow
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/c259a4fb-08a8-4208-afd1-8a9b557875db%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAAvS0gU0bOAOJ5AUPSNhP6VP4ZzmwO_VmhTRTaKBcZipqOUj%2Bw%40mail.gmail.com.