Ask Your Question

disi's profile - activity

2017-02-22 05:59:17 +0100 received badge  Good Question (source)
2017-01-17 11:26:33 +0100 received badge  Notable Question (source)
2016-03-06 09:09:01 +0100 received badge  Famous Question (source)
2014-12-05 00:57:28 +0100 received badge  Notable Question (source)
2013-11-11 15:48:11 +0100 received badge  Popular Question (source)
2013-10-29 05:13:44 +0100 received badge  Popular Question (source)
2012-10-11 16:29:13 +0100 received badge  Nice Question (source)
2012-05-10 08:21:54 +0100 received badge  Student (source)
2012-05-04 13:13:12 +0100 answered a question check if the result is a real number

again, this works perfect :)

for a in maxSol:
    if a[x] in RR:
        print RealField(50)(a[x])
2012-05-04 13:12:16 +0100 commented answer check if the result is a real number

for self reference, this is what I got:

2012-05-04 13:08:14 +0100 marked best answer check if the result is a real number

I think "a in RR" is what you want to use. Your first attempt could work too, using a try/except block.

For testing integrality, or rationality, "in ZZ" and "in QQ" work similarly.

And if you know the numbers you're checking are complex, you could also test to see whether their imaginary parts are zero.

2012-05-04 13:05:48 +0100 commented answer check if the result is a real number

Thanks so much :)

2012-05-04 12:39:24 +0100 asked a question check if the result is a real number

I get several results and want to check, which one is a real number. From trial and error, I can see that maxSol[2][x] is the only plausable solution.

Is there something like isReal()?

my attempt (don't laugh) ;)

for i in maxSol: print RealField(50)(i)

where I obviously get: TypeError: Unable to convert x (='.....

2012-03-01 10:08:52 +0100 commented answer solving sqrt(-1) to a real number

that works perfect, thanks :)

2012-03-01 10:08:34 +0100 marked best answer solving sqrt(-1) to a real number

sage: A(x)=x/2+(4-x*x)^(1/2)

sage: solve(diff(A(x),x),x,to_poly_solve=true)

[x == 2/5*sqrt(5)]

2012-03-01 10:08:34 +0100 received badge  Scholar (source)
2012-03-01 10:08:29 +0100 received badge  Supporter (source)
2012-03-01 09:26:06 +0100 asked a question solving sqrt(-1) to a real number

Here is what I am trying to do:

var('x')
A(x)=x/2+(4-x*x)^(1/2)
assume(0<x<2)
maximum = (derivative(A)==0).maxima_methods().rootscontract().simplify()
view(maximum)
view(solve(maximum,x))
A.plot(A,0,2)

and get i multiplied by the root of x^2... if I put the same equation into wolfram, it gives me a real number 2/sqrt(5) (which is correct and makes sense).

How can I make SageMath solve those? I tried simplify() and full_simplify(), maxima_methods() and rootscontract() gives an error in combination with solve().

I guess it's just some syntax error, sorry for that :(

For now I do most in the Sage - Cell Server, which is great.