« first day (2017 days earlier)      last day (1561 days later) » 

15:56
Perhaps the question is "given an equation like 2 * x = 4, how do I make sympy solve for x?"
Got it. It would be to convert the value of the symbolic variable x to a value of the integer type, as if it were the return of a certain function.
I have no idea what you mean.
solveset looks useful here
As if it were x.subs(x, Int (x)), x being a symbolic variable.
So rather than having x you want to have x which is also an int?
16:01
A conversion.
OK, great, I know you're looking for a conversion. A conversion of what to what? I just don't understand what you are exactly looking for.
What is Int (x) when x is a symbol?
>>> from sympy import solveset
>>> from sympy.abc import x
>>> solution = solveset(Eq(2*x, 4))
>>> solution
FiniteSet(2)
>>> list(solution)[0]
2
We need a punchy acronym like "MCVE" for problem statements that don't have any code yet
"I have the string "3 * x = 6", I want the integer 2, how do I do it?" is neither complete nor verifiable but it's a fairly decent description of a problem
Do you want x to be a variable that can only take integer values, and not floating point values?
Suppose I have num = 6, num is an integer type. And I have a symbolic variable "x", which has a value of 67. I want to assign that value 67 to the variable "num".
@Marco " have a symbolic variable "x", which has a value of 67" <- I have no idea what that means
16:10
I'm not super acquainted with sympy. Can you show some example code that creates x?
symbolic variables by definition don't have numerical values
Sorry. My fault. Just a symbolic variable "x". Is what I mean. I wanted to do the following. x.subs (x, num), somehow.
So... do exactly that :(
just with the syntax I showed, because I know that works
>>> x
x
>>> x.subs(x, 2)
2
That works too.
But is this return value integer?
@Marco why ask me? Ask python
I'm -><- this close to sending you away
16:15
If the question is "how do I turn a sympy.core.numbers.Integer into an int?", I think just calling int() on it will work
@Kevin no, the question seems to be "How do I do that?"
lol, flagged
that should expedite my help
30 messages moved from Python

« first day (2017 days earlier)      last day (1561 days later) »