Creating tables in Sage Math Cloud - sage

I am having an issue creating tables in sage math cloud. It seems that running the table or html.table commands is running differently in sage cloud than in sage, at least as far as I can tell.
In sage (non-cloud), I can run:
rows = [[100,2,3], [4,5,60]]
table(rows)
fine. It outputs tex code if the "typeset" checkbox is selected, and a table if "typeset" is not selected.
Running
rows = [[100,2,3], [4,5,60]]
html.table(rows)
Gives a nice looking html table regardless of the typeset button. If I try it in sage cloud, with typeset_mode(True), table(rows) gives an
Unknown environment 'tabular'
error, and html.tables(rows) gives an error. Running it with typeset_mode(False) gives a good table for table(rows), and an error for html.table(rows). Hopefully I'm missing something obvious - but does anyone have any ideas for getting the tables working in Sage Cloud, ideally keeping typeset_mode(True)?

Related

OpenAI Gym - Env.Render() function returning "Display surface quit"

A screenshot of my code with error
I am following the tutorial seen at https://www.youtube.com/watch?v=7SVv07QXO5M&ab_channel=HackersRealm
The exact code I am following is here: https://github.com/aswintechguy/Reinforcement-Learning-Projects/blob/main/Cartpole%20Balance%20-%20OpenAI%20Gym%20-%20Reinforcement%20Learning/CartPole%20Balance%20-%20OpenAI%20Gym%20-%20Reinforcement%20Learning.ipynb
Not sure what I am doing wrong but the guy doing the tutorial had no issues so I'm not sure how to troubleshoot this. I'm also doing this in a Jupyter Notebook. Any ideas what I might be doing wrong here?
I have seen similar error, in my case i got this error when i ran the env.close() and tried running again, i'm suspecting, this was the reason for my error, because once env.close() has been called there is no environment to perform rest of the operations so I had to re-run the cell to create the environment to try it again. Im assuming this may have been your case.
Try running the cell with make environment and retry the cell which throws u the error.

Problem with updating R code inserts in Pluto.jl

I have some amount of code in R left over from my past research. It's not very fast, but it works. Julia generously allows to postpone the full migration process for later, using this R code via Rcall, this is very convenient. Recently I decided to prepare one interactive demo using Pluto and among other things in one place used the insertion of R code via Rcall. At the first launch, if only open notebook, everything works, but if change anything in this code block and recalculate it, Pluto returns an error like this:
cannot assign a value to variable workspace407.b from module workspace408
This error occurs even when using the simplest code, so the problem is not an error in the R code, but in the relationship between the environments when updating cell with this code. If run this code directly from Julia, without Pluto, there is no such problem. Here is a completely primitive example that demonstrates the problem:
begin
a = 2
#rput a
R"""
b = a*2
"""
#rget b
b
end
For this to work, using Rcall must be called somewhere before and R must be installed and configured for external startup. On the first run of Pluto notebook with this code, everything works as it should. But if change for example b = a*2 to b = a*3 and update cell with this code, Pluto will give an error. How to solve this problem?

R studio console suddenly does not show output

here are my console output examples
as you see, there are no output values when using r studio console.
Actually, there are many related issues about this, but no clear solutions. Only a temporal or Adhoc solution like: restart R or using r notebook script.
Anyway, this phenomenon happens just 1 day ago, with the same code, same operations.
At the first time, console works and a few minutes later it doesn't work.
It is so annoying me to restart or run r notebook script...
Is anybody have the same issues as me?
(I cannot give reproducible data, because it works well the other's computer)
Click on the gear icon beside knit and make sure that "chunk output in console" is enabled.

How to open up a matrix that's running into an error

I am running into an error on a big job in R. I running it as an R script. I keep getting the error that Error in chol.default(F.mat) :
the leading minor of order 1 is not positive definite.
I normally run my job in a qsub but that only gives me an error output but I can't poke around. I then tried running my job locally but my 4gb Macbook was completely overwhelmed.
Now I am trying using screen name and running it on a screen with options(error=recover). Now I am running into the same error as above but I don't know how to access the data frames. I get recover called non-interactively; frames dumped, use debugger() to view but then I get put into my bash line and I don't know how to open up the data frame.
Any ideas?
This is a bit awkward since (1) it's more or less remote debugging and (2) I don't actually ever try to debug non-interactively myself, but: it seems that
options(error=function() dump.frames(to.file=TRUE)) might be worth trying?
After your frames dump to a file (last.dump.rda in the working directory,by default), you should be able to run load("last.dump.rda"); debugger(last.dump) to get back to the debugging environment.
Two caveats:
I haven't actually tested this, just read & interpreted ?dump.frames;
I strongly recommend that you test this with short test runs, either running your original code on a small subset of your data or setting a mini-test script something like
options(error=function() dump.frames(to.file=TRUE))
Sys.sleep(60)
stop("testing error exit")

Extract what was printed deep in the R console

When I execute commands in R, the output is printed in the console. After some threshold (I guess, some maximum number of lines), the R console no longer shows the first commands and their output. I cannot scroll up that far because it is simply no longer there.
How can I access this "early" output if it has disappeared from the console?
I care mostly about error messages and messages generated by my own script. I do use a script file and save my results to a file, if anyone wonders, but this still does not help solve my problem.
(I have tried saving the R workspace and R history and then loading it again, but did not know what to do next and was not able to find what I needed...)

Resources