Skip to main content

Questions tagged [recursion]

{recursion} is the self-referral operation such that particular steps in a program depend on solutions to instances of the same program (as opposed to iteration).

5 votes
2 answers
223 views

I currently have the following code to recursively split and access a sequence according to a list of separators: %% -------------------------------- PREAMBLE -------------------------------- %% \...
Vincent's user avatar
  • 6,225
5 votes
1 answer
219 views

I'm writing a style file for my research group's use, and one thing that happens a lot is multiple modifiers acting on a math symbol. An extreme example of this might be, for instance, \hat{\bar{\...
Nick M's user avatar
  • 53
5 votes
2 answers
236 views

I am trying to change the delimiter of comma-separated values (e.g., "a,b,c" -> "a-b-c") in a manner that normalizes input by trimming whitespace and removing empty entries (e.g....
user001's user avatar
  • 8,256
0 votes
5 answers
160 views

I'm trying to write a latex command that will allow me to concatenate k times a certain string. Both k and the string will be provided as input. However, I'm having trouble starting. I want to make ...
Eric_'s user avatar
  • 103
2 votes
2 answers
122 views

I have madethis command \RepNum{#1}{#2}. This command is created to indicate the number of times the argument #1 is repeated in the list #2, separated by commas. \def\RepNum#1#2{% \begingroup \...
Serubi's user avatar
  • 177
3 votes
2 answers
144 views

I'm trying to write a macros for processing lists. Here's a simplified version of what I'm using to do that. \def\processlist#1{ \ifx#1\relax \let\next=\relax \else\ifx#1, \let\next=\relax \...
Harry's user avatar
  • 163
2 votes
3 answers
210 views

I'm trying to reproduce the image here for an arbitrary choice of γ. γ=1 should give a V-cycle, γ=2 should give a W-cycle, and so on... I've written a recursive code that I would love to keep since it'...
Astor's user avatar
  • 121
1 vote
1 answer
208 views

Thus far I have: \documentclass{article} \usepackage[legalpaper, landscape, margin=0.5in]{geometry} \usepackage{ifthen} \usepackage{xcolor} %\usepackage{luacode} \setlength{\parindent}{0pt} \...
WillAdams's user avatar
  • 6,931
9 votes
3 answers
301 views

What I am looking for is a single newcommand, let's call it \wedges, with a variable number of inputs that yields in a flexible way the following result: I have already written the code for the ...
Freestyla's user avatar
  • 117
6 votes
6 answers
669 views

Consider the following code \documentclass{article} \usepackage{xifthen} \def\question#1 #2 #3?{\ifx#1 #2 #3?\relax\else#1 #2 #3 or\expandafter\question\fi} \newcommand{\test}[1]{\question#1} \begin{...
VaduzStevin's user avatar
0 votes
1 answer
426 views

Suppose we want to draw recursion tree of T(n)=T(n/4)+T(n/2)+n^2 using Justtree package that introduced here (justtree.sty). I try as follows: \begin{justtree} { declare count={tree n}{...
tstt's user avatar
  • 187
3 votes
1 answer
552 views

I'd like to trace the recursive calls of some arbitrary function. This includes the stack ``unwinding'' as the activation records are popped off. For reference, here is an example of what I'm after. ...
TheSinisterStone's user avatar
6 votes
2 answers
280 views

I'm having a trouble understanding the expansion order of TeX macros: \newcount\x \def\dec#1{% \ifnum#1=0 .% \else #1% \x=#1 \advance\x by-1 \dec{\number\x}% #1% \fi% } \...
Jay Lee's user avatar
  • 524
2 votes
2 answers
479 views

The following simple example is for typeseting (a)(b)(c)(d) by recursion. An error massage ERROR: LaTeX Error: \begin{document} ended by \end{)}. is received when running the code. What's wrong with ...
lyl's user avatar
  • 2,837
4 votes
1 answer
219 views

I was originally following the idea from Garrick Peschke To import all .tex files inside a folder, but I want my Lua function to also search inside subfolders. Unfortunately I can't make the Lua ...
Paul's user avatar
  • 45

15 30 50 per page
1
2 3 4 5
8