TI-83 Plus Basic vector angles - Output command throws domain error - basic

I've been coding a program on my TI-83 Plus to help me with Pre-calculus homework. Function wise it works just fine, but I get a "domain error" every time I try to use the Output command anywhere in the code. The syntax is correct, as I checked in another program I made. I also tried moving it to a different spot, but I get the same error.
Code:
:ClrHome
:Input "U1: ",A
:Input "U2: ",B
:Input "V1: ",C
:Input "V2: ",D
:"""I tried the command here"""
:Disp "U.V-[U]-[
V]-COS"
:Disp (A*C+B*D)
:Disp (A^2)+(B^2)
:Disp (C^2)+(D^2)
:Disp cos^-1((A*C+B*D)/(√((A^2)+(B^2
))*(√((C^2)+(D^2))
Any ideas?

Related

open() throwing mypy issues which reading an image file

I have the following line of code which reads an image (which is fed into a POST request):
files = {"image": (image_path, open(image_path, "rb"))}
While trying to run this through mypy, it keeps throwing the following error:
Argument 1 to "open" has incompatible type "Optional[str]"; expected "Union[Union[str, bytes, PathLike[str], PathLike[bytes]], int]"
I've tried searching this, but I've not found a solution for similar problems.
Is there a different way to read filepaths in order to avoid these issues?
Not the correct answer but if you want to temporarily make it go away to move ahead:
# type: ignore
at the end of the erroring line should work.

Opening .hoc files in neuron simulator + "not a mechanism" problem

I am trying to run a NEURON simulation via python. I got all the libraries in order and am able to run some simple simulations, but am experiencing some troubles with a more complicated code. If you have any idea how to help I will appreciate it very much
Problem number 1:
Neuron doesn't open part of a .hoc file even though it is compiled. I get the error:
NEURON: Can't open import3d/import3d_sec.hoc
in import3d.hoc near line 1
{xopen("import3d/import3d_sec.hoc")}
^
xopen("import3d/i...")
xopen("import3d.hoc")
execute1("{xopen("im...")
load_file("C:/Users/U...")
Problem number 2:
The simulator doesn't recognize a mechanism I am trying to use. here I am a bit lost and don't know to describe further, but this is the error message:
NEURON: Im is not a MECHANISM
in L5PCbiophys5b.hoc near line 26
insert Im
^
xopen("L5PCbiophy...")
execute1("{xopen("L5...")
load_file("C:/Users/U...")
Problem number 3:
Not recognizing as a template:
NEURON: Import3d_Neurolucida3 is not a template
in L5PCtemplate_2.hoc near line 26
nl = new Import3d_Neurolucida3()
^
xopen("L5PCtempla...")
execute1("{xopen("L5...")
load_file("C:/Users/U...")
You can try to use an absolute path
The name for insert should match with the SUFFIX statement in the file; also make sure that file was compiled in and that the dll is loaded (should be a message when you start nrniv)
Perhaps a result of the file xopen problem? If it is a template-containing file you should use load_file() instead of xopen()

How to send "special characters" with Python Actions Send_keys?

I am making a code in Python 3.7 for testing an application in Appium.
I am trying to send a text in an input field of an application. The text is in French with special characters (é, è, à, etc.).
My code managed to type character by character, one by one, but when it arrives to a special character with accent "é", it bugs! Here is error message:
Encountered internal error running command: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: KeyCharacterMap.getEvents is unable to synthesize KeyEvent sequence out of '233' key code. Consider applying a patch to UiAutomator2 server code or try to synthesize the necessary key event(s) for it manually
I read the doc and forum and I added this capability:
desired_caps['unicodeKeyboard'] ='true'
But it didn't change anything. I still have same issue.
Try sending keys like:
self.driver.find_element().send_keys(u'éèà')
Change true to True
desired_caps['unicodeKeyboard'] ='True'
And this might help you
http://appium.io/docs/en/writing-running-appium/other/unicode/

Vim error E745 'Using a List as a Number' when creating `Latex` snippet in `neosnippet`

I am using neosnippet to create a snippet for a latex template. The snippet is rather long, and I keep getting a strange error E745 Using a List as a Number when I try to expand the snippet.
Here is the error message that neovim is putting out.
[dein] Error occurred while executing hook: neosnippet.vim
[dein] Vim(let):E745: Using a List as a Number
Error detected while processing function <SNR>346 snippets_expand ...
Line 11
E15: invalid expression:
E15: invalid expression
The actual snippet itself is below--it is quite long. Now when I take this long snippet out of the snippet file, all other snippets work fine. So it seems somewhere I am using a character I am not supposed to use or something. Or perhaps something is not properly escaped, etc.
All of my other latex snippets work just fine, but there are also much shorter. Does anyone have any ideas about why this snippet is causing so much trouble?
Here is the latex snippet.
\documentclass{book}
\addtolength{\topmargin}{-.5in}
\addtolength{\headsep}{.5in}
\oddsidemargin=.5in
\evensidemargin=.5in
\textwidth=5.5in
\usepackage{
amsmath,% AMS basic math stuff
amsthm,% AMS theorem defining stuff
amsfonts,% defines the blackboard bold fonts for \Z, \R, etc
longtable,% used to create the tcproof environment below
verbatim,% allows for verbatim output, and also covering up stuff in comments
xspace,% adds an extra space an the end of some commands
multicol,% allows multicolumn output
tikz,% creates the tikzpicture drawing environment
charter,% changes the default font to charter
framed,% used to color in the TIscreen environment below
bm,
mathrsfs}
\usepackage{pifont}
\usepackage[colorlinks,unicode]{hyperref}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Tau}{\bm{\mathcal{T}}}
\newcommand{\Taup}{\bm{\mathcal{T}^{\prime}}}
\newcommand{\Bp}{\mathscr{B}^{\prime}}
\newcommand{\B}{\mathscr{B}}
\newcommand{\CCp}{\mathscr{C}^{\prime}}
\newcommand{\CC}{\mathscr{C}}
\newcommand{\Ltop}{\R_{\mathscr{L}}}
\newcommand{\Ktop}{\R_{\mathscr{K}}}
\DeclareMathOperator{\lcm}{lcm}
\newcommand{\cl}[1]{[#1]}
\newcommand{\st}{\mid}
\newcommand{\eq}{\stackrel{?}{=}}
\newcommand{\divq}{\stackrel{?}{|}}
\newcommand{\forwards}{\mbox{``$\Longrightarrow$''}\xspace}
\newcommand{\backwards}{\mbox{``$\Longleftarrow$''}\xspace}
\newcommand{\define}[1]{\textbf{#1}}
\newcommand{\threeven}{pretty\xspace}
\newcommand{\throd}{normal\xspace}
\newcommand{\throve}{ugly\xspace}
\DeclareMathSymbol{\nmid}{\mathrel}{AMSb}{"2D}
\newcommand{\notdiv}{\nmid}
\renewcommand{\tilde}{\widetilde}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\def\endclass#1{\par\noindent\hrulefill\fbox{\tiny This is where we
ended on #1}\hrulefill\vskip 5pt plus 1pt\par }
\pagestyle{headings}
\makeatletter
\edef\today{%
\the\year/\two#digits{\the\month}/\two#digits{\the\day}}
\renewcommand{\#evenhead}{\emph{Ordinary Differential Equations - Arnold}
(v. \today)
\hfill Krishna Bhogaonker \hfill \thepage}
\renewcommand{\#oddhead}{(version \today) \hfill \thepage}
\makeatother
\DeclareMathSymbol{\varnothing}{\mathord}{AMSb}{"3F}
\renewcommand{\emptyset}{\varnothing}
\colorlet{shadecolor}{gray!35}
\newenvironment{TIscreen}
{\begin{center}\tt
\renewcommand{\in}[1]{##1\\}
\newcommand{\out}[1]{\mbox{}\hfill##1\\}
\begin{minipage}{2in}\begin{snugshade}}
{\end{snugshade}\end{minipage}\end{center}}
\newenvironment{tcproof}[1]
{\smallskip\par\begin{longtable}{#{}p{.45\textwidth}p{.45\textwidth}#{}}
\multicolumn{2}{#{}l}{\emph{#1}}\\[\smallskipamount]
Assertion & Justification \endfirsthead
Assertion & Justification \endhead
\hline }
{\end{longtable}\qed\smallskip\par}
\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}[lemma]{Theorem}
\newtheorem{cor}[lemma]{Corollary}
\newtheorem*{scholium}{Scholium}
\theoremstyle{definition}
\newtheorem{definition}[lemma]{Definition}
\newtheorem{example}[lemma]{Example}
\newenvironment{comments}{}{}
\makeatletter
\define#key{hide}{scholium}[true]{\renewenvironment{scholium}{\comment}{\endcomment}}
\define#key{hide}{proof}[true]{\renewenvironment{proof}{\comment}{\endcomment}}
\define#key{hide}{lemma}[true]{\renewenvironment{lemma}{\comment}{\endcomment}}
\define#key{hide}{comments}[true]{\renewenvironment{comments}{\comment}{\endcomment}}
\define#key{hide}{cor}[true]{\renewenvironment{cor}{\comment}{\endcomment}}
\define#key{hide}{definition}[true]{\renewenvironment{definition}{\comment}{\endcomment}}
\define#key{hide}{example}[true]{\renewenvironment{example}{\comment}{\endcomment}}
\define#key{hide}{theorem}[true]{\renewenvironment{theorem}{\comment}{\endcomment}}
\newcommand{\HideEnvirons}[1]{\setkeys{hide}{#1}}
\define#key{show}{scholium}[true]{\define#key{hide}{scholium}{}}
\define#key{show}{proof}[true]{\define#key{hide}{proof}{}}
\define#key{show}{lemma}[true]{\define#key{hide}{lemma}{}}
\define#key{show}{comments}[true]{\define#key{hide}{comments}{}}
\define#key{show}{cor}[true]{\define#key{hide}{cor}{}}
\define#key{show}{definition}[true]{\define#key{hide}{definition}{}}
\define#key{show}{example}[true]{\define#key{hide}{example}{}}
\define#key{show}{theorem}[true]{\define#key{hide}{theorem}{}}
\newcommand{\ShowEnvirons}[1]
{\setkeys{show}{#1}\HideEnvirons{%
comments,
cor,
definition,
example,
proof,
theorem,
lemma,
scholium
}}
\makeatother
\begin{document}
\tableofcontents
\newpage
\chapter{Basic Concepts}
${0}
\end{document}
Okay, I talked to the developer and he indicated the problem had to do with the backquotes in this section of the document.
\newcommand{\forwards}{\mbox{````$\Longrightarrow$''}\xspace}
\newcommand{\backwards}{\mbox{````$\Longleftarrow$''}\xspace}
I updated the neosnippet plugin and also changed the latex code as well. Now things work fine.

Fortran error check on formatted read

In my code I am attempting to read in output files that may or may not have a formatted integer in the first line of the file. To aid backwards compatibility I am attempting to be able to read in both examples as shown below.
head -n 3 infile_new
22
8
98677.966601475651 -35846.869655806520 3523978.2959464169
or
head -n 3 infile_old
8
98677.966601475651 -35846.869655806520 3523978.2959464169
101205.49395364164 -36765.047712555031 3614241.1159234559
The format of the top line of infile_new is '(i5)' and so I can accommodate this in my code with a standard read statement of
read(iunit, '(I5)' ) n
This works fine, but if I attempt to read in infile_old using this, I as expected get an error. I have attempted to get around this by using the following
read(iunit, '(I5)' , iostat=ios, err=110) n
110 if(ios == 0) then
print*, 'error in file, setting n'
naBuffer = na
!rewind(iunit) #not sure whether to rewind or close/open to reset file position
close(iunit)
open (iunit, file=fname, status='unknown')
else
print*, "Something very wrong in particle_inout"
end if
The problem here is that when reading in either the old or new file the code ends up in the error loop. I've not been able to find much documentation on using the read statement in this way, but cannot determine what is going wrong.
My one theory was my use of ios==0 in the if statement, but figured since I shouldn't have an error when reading the new file it shouldn't matter. It would be great to know if anyone knows a way to catch such errors.
From what you've shown us, after the code executes the read statement it executes the statement labelled 110. Then, if there wasn't an error and iostat==0 the true branch of the if construct is executed.
So, if there is an error in the read the code jumps to that statement, if there isn't it walks to the same statement. The code doesn't magically know to not execute the code starting at label 110 if there isn't an error in the read statement. Personally I've never used both iostat and err in the same read statement and here I think it's tripping you up.
Try changing the read statement to
read(iunit, '(I5)' , iostat=ios) n
You'd then need to re-work your if construct a bit, since iostat==0 is not an error condition.
Incidentally, to read a line which is known to contain only one integer I wouldn't use an explicit format, I'd just use
read(iunit, * , iostat=ios) n
and let the run-time worry about how big the integer is and where to find it.

Resources