Sympy failed to render matrix - matplotlib

I'm using IPython's Qtconsole and use default setting of printing setting.
It works well for polynomial, but do not work for Matrix
from sympy import init_printing, Matrix
init_printing()
a=Matrix([1,2])
a
the error is
ValueError:
\left[\begin{smallmatrix}1\\2\end{smallmatrix}\right]
^
Expected "\right" (at char 6), (line:1, col:7)
I have tried http://www.codecogs.com/latex/eqneditor.php and it seems the latex code is correct.
I have tried the dev version of sympy, it still doesn't work. I did not try dev version of matplotlib yet. Because there're only source for the dev version.

TLDR: It is a known issue, yet to be solved. You need to use a proper LaTeX.
Your problem might be related to this. The problem is due to matplotlibs very limited understanding of LaTeX. In this case the \begin{...} flag cannot be interpreted by matplotlib, although it is valid LaTeX.

Related

Wrong min value for a geo tif file

I am working on pre-processing a few geo-tif files. I want to obtain the minimum value for my raster image. My OS is Linux and Rasterio version 1.3.3. When I run my script in a conda environment, I realized that the minimum value is given as zero which is incorrect.
I am using the following code:
with rasterio.open(file) as tif_input_obj:
tif_data = tif_input_obj.read()
print(tif_data.min())
I tried running the same lines of code by typing python in my conda environment. This time the minimum value was obtained correctly. I have also tried gdal and faced the same problem.
has anyone faced this issue before?
Thank you for your help.

Drawing an image using Vulkan

I'm stuck so I took my code and wrote a smallish example to illustrate my issue. The texture renders all black. The target is vkwayland, but I exported my buffers and created vktest to make testing simpler.
Edit: links to sources and renderdocs:
https://www.reddit.com/r/vulkan/comments/abp7re/a_smallish_example_of_drawing_an_image_that/ed977in
Validation layers silent.
Much discussion here: https://www.reddit.com/r/vulkan/comments/abp7re/a_smallish_example_of_drawing_an_image_that/ed4r5br
So, as resolved on reddit:
You are using obsolete SDK (and Validation layers), therefore you get no error in this case.
And you are reading UINT image format through FLOAT sampler, which yields undefined values (in your case zeroes, i.e. black).

How to verify SCIP compiled with Ipopt?

I am using SCIP via Julia (currently with SCIP.jl, previous with AmplNLWriter.jl). I compiled SCIP as follows per the instructions for SCIP.jl:
make SHARE=true GMP=false IPOPT=true READLINE=false ZLIB=false scipoptlib
I am able to call SCIP from Julia. I also confirmed SCIP works with make test. However, when I try to solve a (presumably non-convex) MINLP, I get the following warning message:
Quadratic constraint handler does not have LAPACK for eigenvalue computation. Will assume that matrices (with size > 2x2) are indefinite.
This message makes me suspect SCIP is actually not using IPOPT. How can I resolve this message and verify SCIP is, in fact, using IPOPT?
My model has many bilinear terms, some of which may lead to convex constraints. Thus I anticipate using IPOPT will accelerate SCIP.
Thanks, Alex
There is a method to print this information: SCIPprintExternalCodes().

using pgf backend to matplotlib in julia

I started using Julia to analyse some data, which works perfect.
I also use PyPlot / Matplotlib for plotting, which I got working as well.
Now, these plots need to find their way into my latex document, which I want to achieve using the matplotlib pgf backend. It also works, but I really have no idea how to pass arguments to
mpl.rcParams.update(parameters)
Is there somebody skilled out there in the Julia community who can tell me how to achieve this?
EDIT2:
short update on the issue: Setting rc-options work by setting them in the following way:
PyPlot.matplotlib[:rc]("text", usetex=true) # here: allow tex rendering

PyPlot in Julia only showing plot when code ends

I have recently begun learning to use Julia, converting over from Matlab/Octave. I decided that the best way to get some experience was to convert some code I was already working on i Octave - a Newton solver for a complicated multidimensional problem. I have been able to convert the code over successfully (and with noticeable speedup relative to Octave, without devectorisation or other performance-based changes), with only one issue arising.
I have chosen to use PyPlot for plotting, due to its similarity to Matlab/Octave's plotting functionality. However, there is some behaviour from PyPlot that is undesired. I use the plotting function to display the current state of the vector I am trying to get to zero (using the Newton solver part of the code), so that I can see what it is doing, and adjust the code to try to improve this behaviour. I input the number of Newton steps to take before the code stops, and then I can make adjustments or re-issue the command to continue attempting to converge.
I have the code set up to plot the current state every few steps, so that I can, for instance, have the code take 200 steps, but show me the status after every 10 steps. In Octave, this works perfectly, providing me with up-to-date information - should the behaviour of the code not be desirable, I can quickly cancel the code with Ctrl-C (this part works in Julia, too).
However, Julia does not produce or update the plots when the plot() command is used; instead, it produces the plot, or updates it if the plot window is already open, only when the code finishes. This entirely defeats the purpose of the intermittent plotting within the code. Once the code has completed, the plot is correctly generated, so I know that the plot() command itself is being used correctly.
I have tried adding either draw() or show() immediately after the plot command. I have also tried display(gcf()). None of these have modified the result. I have confirmed that isinteractive() outputs "true". I have also tried turning interactivity off (ioff()) and switching whether to use the python or julia backend (pygui(true) and pygui(false)), with no effect on this behaviour.
Have I missed something? Is there another package or option that needs to be set in order to force PyPlot to generate the current plot immediately, rather than waiting until Julia finishes its current code run to generate the plot?
Or is it perhaps possible that scope is causing a problem, here, as the intermittent plotting happens inside a while loop?
I am using xubuntu 12.10 with Julia 0.2.1.
PyPlot defaults to this behavior in the REPL. To make it show the plots as they are plotted type ion(). To turn it off again type ioff().
ion() is only effective for the current season so if you want it to stay on across sessions just add it to your .juliarc file.
If you're using iPython ion() will plot to a new window but ioff() will plot inline.