Ask Your Question

Tofi's profile - activity

2021-06-10 06:34:33 +0200 received badge  Popular Question (source)
2020-07-02 03:10:15 +0200 received badge  Famous Question (source)
2020-04-06 12:11:27 +0200 received badge  Notable Question (source)
2020-04-06 12:11:27 +0200 received badge  Popular Question (source)
2019-11-21 21:19:53 +0200 received badge  Scholar (source)
2019-11-19 01:27:26 +0200 asked a question How to find all roots with solve?

I have the following quantity:

c_p = 1 - (4*sin(th)^2+2*5*sin(th)/pi+(5/(2*pi))^2)

and I am trying to find its roots (the solutions for c_p==0).

When plotting c_p as a function of th between $-\pi$ and $\pi$, I can see the curve crosses the x-axis at four positions. However, solve(c_p==0, th) is only giving two roots: $$\left[theta = -\arcsin\left(\frac{5}{4 \ \pi} + \frac{1}{2}\right),\quad theta = -\arcsin\left(\frac{5}{4 \ \pi} - \frac{1}{2}\right)\right].$$ It appears that solve can only find the roots that are in the domain of the $\arcsin$ function, i.e in the interval $[-\dfrac{\pi}{2},\dfrac{\pi}{2}]$. Is there a way to get the other two roots?

2019-11-02 13:11:56 +0200 received badge  Supporter (source)
2019-11-01 16:24:11 +0200 received badge  Editor (source)
2019-11-01 16:23:29 +0200 answered a question How to obtain high quality plots in the Jupyter notebook?

So here is what I found after doing some research. It is not a perfect solution, but it gets the job done.

Figures appear to have low resolution in Jupyter because I am zooming into the notebook's page in my browser. At 100% zoom level, figures appear clear in the notebook, though I have the zoom level set to 150%, and the figures are scaled up in size without a change in resolution, so they become blurry. The problem is that at 100% zoom, the font size in the notebook becomes so small that it is unreadable (I think this is a problem for any laptop with 1080p screen resolution or higher).

The solution I found is to keep zoom level at 100% and to change the font size using Jupyter theme settings. Install Jupyter themes, then switch to a custom theme with large font size by running the following command in the terminal:

jt -t monokai -f roboto -fs 16 -ofs 16 -cellw 95% -N

Here is what each term means:

  • -t monokai sets the theme to monokai
  • -f roboto sets the font type to roboto
  • -fs 16 sets the input cell font size to 16
  • -ofs 16 sets the output cell font size to 16
  • -cellw 95% sets the cell width to 95% of the page's width
  • -N sets the notebook's name to visible. You can omit this flag if you don't want to the Notebook's title at the top of the page.

Now the font size looks great, and the figures are clear, except that they are small. We can increase the size of the figures and their font size using the figsize and fontsize optional arguments of the plot command. For example:

plot(sin(x), (x,0,2*pi), figsize=10, fontsize=16)

produces a large and clear figure with a readable font.

The only downside to this solution is that I have to include figsize=10, fontsize=16 in every plot command I use.

2019-11-01 15:06:45 +0200 received badge  Student (source)
2019-11-01 14:36:55 +0200 asked a question How to obtain high quality plots in the Jupyter notebook?

When plotting figures in the Jupyter notebook, the result is always a grained and low resolution image. With Python's matplotlib, this issue can be mitigated using the following command:

%config InlineBackend.figure_format = 'svg'

which makes matplotlib.pylplot.plot produce very high resolution figures in the notebook. Is there a way to obtain the same result with SageMath's plot command?