Ask Your Question

trk's profile - activity

2023-07-31 19:55:35 +0200 received badge  Notable Question (source)
2020-06-10 22:40:54 +0200 received badge  Nice Question (source)
2017-07-21 13:31:26 +0200 received badge  Popular Question (source)
2015-02-16 15:10:24 +0200 received badge  Famous Question (source)
2014-05-29 13:50:03 +0200 received badge  Famous Question (source)
2013-08-31 09:18:46 +0200 received badge  Notable Question (source)
2012-11-08 06:59:47 +0200 received badge  Popular Question (source)
2012-09-13 18:56:28 +0200 received badge  Notable Question (source)
2012-01-17 12:22:09 +0200 received badge  Popular Question (source)
2011-10-21 15:11:27 +0200 marked best answer Row echelon form of a matrix containing symbolic expresssions

This is typical---it is assumed that you can divide and things aren't zero. This happens in other math software systems too. The Maple chapter of the Handbook of Linear Algebra discusses this (p. 72-10) and refers to these two references:

  • R.M. Corless and D.J. Jeffrey. Well... it isn’t quite that simple. SIGSAM Bull., 26(3):2–6, 1992.
  • R.M. Corless and D.J. Jeffrey. The Turing factorization of a rectangular matrix. SIGSAM Bull., 31(3):20–28, 1997.

That HLA chapter suggests using LU decomposition to do this, but apparently LU decomposition doesn't work too well for our symbolic matrix.

HOWEVER: You can do this in Sage if you use a different base ring for the matrices:

sage: R.<b1,b2,b3>=QQ[]
sage: A=matrix([[1,1,2,b1],[1,0,1,b2],[2,1,3,b3]])
sage: A.echelon_form()
[            1             0             1            b2]
[            0             1             1       b1 - b2]
[            0             0             0 -b1 - b2 + b3]

Note that rref still gives the answer you got before since rref works over the fraction field:

sage: A.rref()
[1 0 1 0]
[0 1 1 0]
[0 0 0 1]
sage: parent(A)
Full MatrixSpace of 3 by 4 dense matrices over Multivariate Polynomial Ring in b1, b2, b3 over Rational Field
sage: parent(A.echelon_form())
Full MatrixSpace of 3 by 4 dense matrices over Multivariate Polynomial Ring in b1, b2, b3 over Rational Field
sage: parent(A.rref())
Full MatrixSpace of 3 by 4 dense matrices over Fraction Field of Multivariate Polynomial Ring in b1, b2, b3 over Rational Field
2011-10-16 17:23:18 +0200 asked a question Row echelon form of a matrix containing symbolic expresssions

Hi,

I want to find out the row echelon form of this matrix:

$ \left(\begin{array}{rrrr} 1 & 1 & 2 & b_{1} \\ 1 & 0 & 1 & b_{2} \\ 2 & 1 & 3 & b_{3} \end{array}\right) $

By manually performing elementary row operations on paper, I get this answer:

$ \left(\begin{array}{rrrr} 1 & 1 & 2 & b_{1} \\ 0 & 1 & 1 & b_{1} - b_{2} \\ 0 & 0 & 0 & -b_{1} - b_{2} + b_{3} \end{array}\right) $

I thought I can do the following in sage:

var('b_1,b_2,b_3')
A=matrix(SR,[[1,1,2,b_1],[1,0,1,b_2],[2,1,3,b_3]])
show(A)
A.echelon_form()

But I get:

$ \left(\begin{array}{rrrr} 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right) $

What is the correct function and/or parameters I should use to get the expected answer?

Thank you.

2011-03-04 23:55:44 +0200 marked best answer How to plot solids of revolution

It might take a bit of tweaking to get what you want, but one option is to take a look at the semi-secret function revolution_plot3d. The documentation (help(revolution_plot3d) or revolution_plot3d?) has an example which is similar to yours but still different:


        sage: line=u
        sage: parabola=u^2
        sage: sur1=revolution_plot3d(line,(u,0,1),opacity=0.5,rgbcolor=(1,0.5,0),show_curve=True,parallel_axis='x')
        sage: sur2=revolution_plot3d(parabola,(u,0,1),opacity=0.5,rgbcolor=(0,1,0),show_curve=True,parallel_axis='x')
        sage: (sur1+sur2).show()

image description

which produces the above picture. You could also do it with parametric_plot3d/implicit_plot3d, but you'd have to do the revolution manually (i.e. multiply x, y, and z by the appropriate trigonometric functions).

2011-02-28 10:46:02 +0200 received badge  Nice Question (source)
2011-02-27 08:54:58 +0200 asked a question How to plot solids of revolution

Hi,

Is it possible to plot the solid generated by revolving a curve about a line?

For example, I want to see what kind of solid is generated from this question:

Use shells to find the solid generated from the region in the 1st quadrant bounded by $y=x$ and $y=x^2$, revolved about $x=-1$.

The volume of the solid is $\frac{\pi}{2}$. How can I view this solid? I checked the sage calculus tutorial for clues but couldn't find any.

2011-02-25 16:24:45 +0200 received badge  Scholar (source)
2011-02-25 16:24:45 +0200 marked best answer Unexpected solve() result

Try

sage: ans.solve(x,to_poly_solve=True)
[x == 5/3*sqrt(3)]

Another reminder to make sure that the global solve? has the same information about this option as the local x.solve?. Though in this case,

sage: ans.solve?

would give you information about this option.

2011-02-21 11:24:49 +0200 received badge  Nice Question (source)
2011-02-21 02:38:23 +0200 received badge  Student (source)
2011-02-20 09:36:48 +0200 received badge  Editor (source)
2011-02-20 09:35:47 +0200 asked a question Unexpected solve() result

Hi,

Let

$\hspace{1in} f(x) = -\frac{1}{2} x + \sqrt{x^{2} + 25} + 4 $

I would like to find the first derivative of f(x) and then the value of x when $f'(x)=0 $.

This is what I did:

f(x)=(x^2+25)^(1/2)+(1/2)*(8-x)
ans=f(x).diff(x)==0
print ans.solve(x)

But that gives the answer:

$\hspace{1in} x = \frac{1}{2} \sqrt{x^{2} + 25} $

I had to change the last line to:

print ((ans.solve(x)[0]*2)^2).solve(x)

To give the correct answer:

$ \hspace{1in} x = -\frac{5}{3}\sqrt{3}, x = \frac{5}{3}\sqrt{3} $

Why do I have to do that?

2011-02-20 09:10:46 +0200 received badge  Supporter (source)