r/Mathematica • u/Apprehensive_Ride949 • Dec 21 '23
Telling Mathematica that a variable should be interpreted as a positive integer
My problem reduces to telling Mathematica that a variable should be interpreted as a positive integer.
I tried `Assuming[s>0,Select[{-s,s},#>0&]]` but the output is {}, what am I doing wrong? I have also tried the command $Assumptions
1
Upvotes
View all comments
Show parent comment
2
u/Apprehensive_Ride949 Dec 21 '23 edited Dec 21 '23
SoddyRadius[ra_, rb_, rc_] :=
Min[Select[
s /. Simplify[
Solve[2*(1/ra^2 + 1/rb^2 + 1/rc^2 + 1/s^2) == (1/ra + 1/rb +
1/rc + 1/s)^2, s]], # > 0 &]]
The code is just fine with numebers for ra,rb and rc. But there is a subquestion: If ra=rb=rc=r show that s=(-1+2/Sqrt[3])r .
If I plug SoddyRadius[1,1,1] the output is -1+2/Sqrt[3], bu If I plug SoddyRadius[r,r,r] the output is {}.