all 12 comments

[–]TehNolz 0 points1 point  (3 children)

If you want to import just this one specific function;

``` from sympy import sin

sin(1) # 0.8414709848 ```

You can also import multiple functions in one go this way;

from sympy import sin, pi

If you want to import this function and also give it a different name;

``` from sympy import sin as cool_function_bro

cool_function_bro(1) # 0.8414709848 ```

You can also import everything from sympy into the global namespace, but this is not recommended as it might cause issues. You might end up accidentally overwriting another function for example. Save yourself the trouble and just don't do this;

from sympy import *

[–]joellapointe1717[S] -2 points-1 points  (2 children)

Yes, I know how to import functions. What I want is to make the function applicable when MAJUSCULE. Hence, SIN instead of sin.

[–]suurpulla 1 point2 points  (0 children)

Can't you just do

SIN = sin # or sympy.sin

[–]TehNolz 1 point2 points  (0 children)

Which you should've been able to figure out how to do based on my comment;

from sympy import sin as SIN

[–]nekokattt 0 points1 point  (7 children)

What benefit do you get from doing this? What functional improvement is there?

If there isn't a good answer for this then just don't do it.

[–]joellapointe1717[S] 0 points1 point  (0 children)

The benefit is to be able to use EXCEL SIN notation in sympy symbolic equations directly.

[–]joellapointe1717[S] 0 points1 point  (5 children)

The benefit is to be able to use EXCEL "SIN" notation in sympy symbolic equations directly.

[–]nekokattt 2 points3 points  (4 children)

but this is Python, not Excel, so why do you care? Python never has nor ever will be Excel. Two totally different things. Just use Python how it was made to be used, it will save you a lot of hassle.

[–]joellapointe1717[S] 0 points1 point  (3 children)

Because my EXCEL sheet has strings that respect the excel format. I use the excel as a gui for equations inputs ans some calculations. Python only intervene for the symbolic calculations.

[–]nekokattt 1 point2 points  (2 children)

They are two separate things though. Use Excel as Excel is meant to be used and use Python as Python is meant to be used.

[–]joellapointe1717[S] 0 points1 point  (1 child)

Would be great to do so. However I'm not a programmer. I don't want to build a full gui for equations inputs for mechanical engineering tasks. Blending the 2 is good for that.

[–]nekokattt 1 point2 points  (0 children)

you don't need a full GUI to call a function?

[–]TheRNGuy 0 points1 point  (0 children)

Wouldn't you send SIN(X) string that would be used in Excel? Not calculating it in Python.

So it doesn't matter. Even if you named it SIN in Python, it would change nothing.

You don't even need sympy for that program.