Ask Your Question

Poetastrophe's profile - activity

2024-02-26 17:10:49 +0200 received badge  Notable Question (source)
2024-02-26 17:10:49 +0200 received badge  Popular Question (source)
2023-02-11 08:37:53 +0200 received badge  Notable Question (source)
2023-02-11 08:37:53 +0200 received badge  Popular Question (source)
2022-01-30 03:51:45 +0200 received badge  Notable Question (source)
2020-10-13 23:27:34 +0200 received badge  Popular Question (source)
2019-01-09 19:15:26 +0200 received badge  Famous Question (source)
2018-08-13 18:23:06 +0200 received badge  Notable Question (source)
2018-08-13 18:23:06 +0200 received badge  Popular Question (source)
2018-03-08 19:30:55 +0200 asked a question using show automatically in flask notebook

Is there a way to make sage flask notebook automatically use show when assigning a variable? For instance if I don't assign the right hand side to variable flask will attempt to typeset it.

vector([1,2,3])

But if I assign it to a variable r

r=vector([1,2,3])

it will only show it immediately if I type

r=vector([1,2,3]);show(r)

or simply

r=vector([1,2,3]);r

But I find it a bit tedious if I have to type that every time, so is there a way to make show, get executed automatically, whenever one is assigning a variable?

2018-02-28 18:56:05 +0200 received badge  Editor (source)
2018-02-28 18:48:39 +0200 asked a question 3d plots flattened when printing to file

When I print to file using The Sage Notebook (flask) - clicking the print option and then printing to file using CUPS - everything is displayed correctly except plot3d plots which are squeezed to have a height of a few centimeters while the width remains the same. I do not have the same problem with other types of plots like "plot" or "countourplot". I do not know whether this has anything to do with my screen being 4k, but it reminds me of similar picture scaling issues I have with maple.

What I get: https://s17.postimg.org/d3q80qlf3/scr...

What I expected: https://s17.postimg.org/72sj3vokv/scr...

2017-11-30 15:30:55 +0200 asked a question Replacing functions in a equation

I want to be able to replace a function within a equation. I find a solution for the function R in the given example, and I want to replace R in the equation, hence R=Rsol, where Rsol is a specific function. But it does not seem to replace the function in de2 at all, what am I doing wrong?

var('Rq,k,K')
M=function('M')(x)
R=function('R')(x)
de2=diff(R)==-K(R-Rq)
de1 = diff(M) == -k(M - R)
Rsol=desolve(de2(k=1,K=2,Rq=20),R,ics=[0,15])
Msol=desolve(de1(k=1,K=2,Rq=20, R=Rsol),M)
2017-11-27 11:56:56 +0200 commented answer Getting the length of a vector

Thank you a lot. Saved my life!

2017-11-26 22:52:01 +0200 asked a question Getting the length of a vector

Is there a way to get the length of a vector according to the form: For a vector (v_1,v_2,v_3, ... , v_n), get the result sqrt(v_1^2 + v_2^2 + v_3^2 + ... + v_n^2).

2017-11-23 18:34:58 +0200 commented answer Characteristic polynomial wont be used in solve

Thanks a lot!

2017-11-23 18:34:42 +0200 received badge  Supporter (source)
2017-11-23 18:34:40 +0200 received badge  Scholar (source)
2017-11-23 18:18:11 +0200 asked a question Characteristic polynomial wont be used in solve

When I try to find roots in a characteristic polynomial it gives me errors:

sage: #Diagonalmatrix
....: 
....: 
....: A=matrix([[1,-1,2],
....:         [-1,1,2],
....:         [2,2,-2]])
....: var('x')
....: poly=A.characteristic_polynomial()
....: eq1=solve(poly==0,x)
....:                                            
x                                                
--------------------------------------------------
TypeError        Traceback (most recent call last)
<ipython-input-86-fee7a7de2ea1> in <module>()
      7 var('x')
      8 poly=A.characteristic_polynomial()
----> 9 eq1=solve(poly==Integer(0),x)

/usr/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
    816 
    817     if not isinstance(f, (list, tuple)):
--> 818         raise TypeError("The first argument must be a symbolic expression or a list of symbolic expressions.")
    819 
    820     if len(f)==1:

TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.
sage:

What can I do in order to use the polynomial in an equation I wish to solve?

2017-11-08 20:48:45 +0200 asked a question LatexMk and sagetex not working

According to the Sagetex github page (https://github.com/sagemath/sagetex/wiki) the following snippet code put into a .latexmkrc dotfile should make latexmk run sagetex.sage files if necessary:

add_cus_dep('sagetex.sage', 'sagetex.sout', 0, 'makesout');
$hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom| ?_st_.current_tex_line|print .SageT)';
sub makesout {
    system("sage '$_[0].sagetex.sage'");
}

But nothing seems to happen, when I run latexmk on the tex file, it gives no errors and does not run the sagetex.sage file, but compiles the pdf nontheless. If I run latexmk and sage manually I have no problems compiling the document with the sage math. Is the code outdated/can it be fixed to work properly?

2017-10-21 10:40:04 +0200 received badge  Student (source)
2017-10-21 02:44:51 +0200 asked a question Parametric 3d plot not showing

If I write somePlot=parametric_plot3d((sin, cos, lambda u: u/10), (0,20)) somePlot.show() Into a .sage file and therafter write sage file.sage it will not show anything. While if I run sage interactively from the terminal and write the same it will open jmol viewer and show the file. Why does this happen?