Ask Your Question

adamhg's profile - activity

2022-05-16 04:42:09 +0200 received badge  Notable Question (source)
2022-05-16 04:42:09 +0200 received badge  Popular Question (source)
2022-03-27 21:51:01 +0200 received badge  Notable Question (source)
2018-04-12 18:39:57 +0200 received badge  Popular Question (source)
2013-02-27 20:16:53 +0200 asked a question Solve an expression with fractional exponents

I have an expression which, effectively, looks like this:

expr = x == x^(1/3)*y

except y is a really large number of constants. If I wanted to solve this for x, I should get x=y^(3/2). But instead:

solve(expr,x)

yields

[x == x^(1/3)*y]

In the example I gave, it's obviously not a big deal. But for my actual code, y is a very large number of constant factors, and this means copying those factors out by hand, and then re-inputting them in the correct form ( x = (factors)^(3/2) ) which is error prone and time consuming.

I've tried using 0.333 instead of (1/3) in the exponent, that doesn't make a difference.

Any help here would be appreciated. Thank you ahead of time!

2013-02-21 00:25:34 +0200 commented question How to recursively substitute from global name space?

I've been trying to find the same thing -- so far all I could find was this question, and the same question you asked on google groups in 2008.

2013-02-19 18:11:08 +0200 marked best answer Evaluate expression with unknowns

You need the ._convert() method:

sage: f = (x* 2* pi* log(5)* 6^1.5)/(3^4*pi^2+x)
sage: f._convert(RR)
148.621271129886*x/(x + 799.437956488238)
2013-02-19 18:11:08 +0200 received badge  Scholar (source)
2013-02-19 17:11:29 +0200 commented answer Evaluate expression with unknowns

Aha! This is exactly what I needed, thank you. Thank you @tobias-weich as well, you are right though my final expression wasn't just a polynomial or a division of polynomials.

2013-02-19 17:08:59 +0200 received badge  Supporter (source)
2013-02-19 10:17:24 +0200 received badge  Nice Question (source)
2013-02-18 15:42:33 +0200 received badge  Student (source)
2013-02-18 14:59:38 +0200 asked a question Evaluate expression with unknowns

I'm trying to evaluate an integral that comes out with a crazy long result. I'm not going to paste it here because it really is quite long, which is essentially the problem. The result actually only has a few instances of unknowns in it, 90% of it's length comes from un-evaluated constants (like 2^(1/7), log(11.5), stuff like that). So it sort of looks like:

f(x) = (x* 2* pi* log(5)* 6^1.5) / (3^4*pi^2+x)

except it spans 10 lines.

If I could get sage to just express all of that stuff as a solid number, then the resulting expression wouldn't be so prohibitively long (I think it would actually evaluate out to something similar to the example I gave, number*x/(number+x) ). But numerical_approx() won't take anything with unknowns in it, so I can't just plug that expression into n().

How does one evaluate the knowns in an expression that contains unknowns?

Thank you ahead of time for your help!