Ask Your Question

Rejeesh's profile - activity

2022-10-16 12:57:38 +0200 received badge  Great Question (source)
2015-10-21 21:13:35 +0200 received badge  Famous Question (source)
2014-06-29 20:35:45 +0200 received badge  Famous Question (source)
2014-06-29 20:35:45 +0200 received badge  Notable Question (source)
2014-02-07 08:43:47 +0200 received badge  Notable Question (source)
2013-10-01 13:13:22 +0200 received badge  Popular Question (source)
2013-05-10 12:00:46 +0200 received badge  Popular Question (source)
2012-09-18 16:51:13 +0200 received badge  Good Question (source)
2012-05-09 16:48:53 +0200 received badge  Nice Question (source)
2012-02-23 11:48:32 +0200 commented question Solve non linear symbolic equation

Yes I did try that. I realized that things need not be complicated. So I re-modelled my problem with some approximations and ended up with a simpler equation that sage could handle. But I don't know how to make approximations (like neglect all powers of a variable) and ended up doing that by hand. Is there any way to make sage do the approximations?

2012-02-23 06:09:06 +0200 asked a question Solve non linear symbolic equation

Hi, I want to solve a an expression (quiet long one involving trigonometric functions) which has a lot of symbolic parameters (8 to be exact) for x. It takes a lot of time (I didn't get an output after 45 mins). Is there any way for me to speed up things. I am sure my way is inefficient.

2012-02-22 13:55:14 +0200 received badge  Student (source)
2012-02-22 13:21:59 +0200 commented answer Extract solutions from solve

@kcrisman Thanks a lot for that. Those semicolons come from C (and maybe a bit from Octave/Matlab). I just can't think of a world without semicolons. And like you said, a bit of Google and some docs would have answered me.

2012-02-22 13:12:56 +0200 answered a question Extract solutions from solve

@kcrisman Thanks a lot for that. Those semicolons come from C (and maybe a bit from Octave/Matlab). I just can't think of a world without semicolons. And like you said, a bit of Google and some docs would have answered me.

2012-02-22 12:54:49 +0200 received badge  Scholar (source)
2012-02-22 12:54:49 +0200 marked best answer Extract solutions from solve

I am new to sage. So, sorry if my question is trivial.

Not at all! Likely you could have found this by doing a little more reconnaissance, but hopefully others in the same boat will now find this instead.

Incidentally, x is the only predefined variable, so your first line is not needed. Also, the semicolons are not necessary to suppress output.

I hope this example answers your questions.

sage: f = x^2 - 5*x + 6
sage: z = solve(f,x) # f==0 is implicit
sage: z
[x == 3, x == 2]
sage: z[0]
x == 3
sage: z[1]
x == 2
sage: z[0].rhs()
3
sage: z[0].lhs()
x

Essentially, Sage returns Python lists, and this is how to extract stuff from them. It returns a symbolic equality, and then the rhs() method gets the "right hand side".

There is another way to get solutions as Python dicts, but that is slightly more advanced so maybe someone else can comment on that.

2012-02-22 12:54:39 +0200 received badge  Supporter (source)
2012-02-22 11:27:44 +0200 asked a question Extract solutions from solve

I am new to sage. So, sorry if my question is trivial.

How can I get the values of a solve operation. Say I have

x = var('x');
f = x^2 - 5*x + 6;
z = solve(f = 0, x);
show(z);

gives me something like

[x == 2, x == 3]

How can I take the value 2 or 3 from that?

Also, when I was trying to solve another equation (quiet a long one), I get the solution as

[0 = something something.....]

What does that zero mean?