Recursive function Definition and 29 Threads
-
T
MHB Recursive Function for Virus Spread: Finding the General Solution
Could anyone please help me I am especially stuck on the second part of the question. Thanks very much I really appreciate it.- Tekilou
- Thread
- Function Recursive function
- Replies: 3
- Forum: Topology and Analysis
-
Python RecursionError at a place where I have defined no recursive function
Here is the code that I wrote: import numpy as np global m, n, p, q, arr1, arr2def input(): # Input for first matrix: print("Enter the number of rows of the first matrix: ", end="") globals()['m'] = int(input()) print("Enter the number of columns of the first matrix: ", end="")...- Wrichik Basu
- Thread
- Function Recursive function
- Replies: 17
- Forum: Programming and Computer Science
-
Integral of a Recursive Function
Homework Statement Find the following: $$ \int_0^\inf \frac{x^{a+1}e^{-x/\delta}}{\delta^{a+1}\Gamma(a+1)} dx; \, a > 1 , \delta >0 , 0 \leq x \leq \inf$$ Homework Equations - The Attempt at a Solution The numerator in the integral is constant, so it can be taken outside the integral. I then...- CivilSigma
- Thread
- Function Integral Recursive function
- Replies: 3
- Forum: Calculus and Beyond Homework Help
-
I Recursive square root inside square root problem
I have been debating this issue for days: I can't find a recursive function of this equation: ##\large{\sqrt{2+\pi \sqrt{3+\pi\sqrt{4+\pi\sqrt{5+\dotsb}}}}}## Starting value 2 always added with pi has been trying to find a solution this for days now, is what I have achieved so far: This...- Gionata
- Thread
- Recursive function Root Sequences and series Square Square root
- Replies: 27
- Forum: General Math
-
F
Using a recursive algorithm to find the value of a game
Homework Statement Imagine you are playing a game with me, of drawing balls from a box. There are two blue balls and two red balls. They are picked with equal probability, and are drawn without replacement. If you draw a blue ball, I give you $1. If you draw a red ball, you pay me $1.25. What...- fignewtons
- Thread
- Algorithm Game Probability Recursion Recursive function Value
- Replies: 8
- Forum: Calculus and Beyond Homework Help
-
[C] Use recursive function to get the min value of an array
Homework Statement Using these two prototypes, double minValue( const double a[], unsigned els); double minIndex(const double a[], unsigned els); I am supposed to find the smallest value of an array using the minValue function as well as it's index by using the separate minIndex function and...- bornofflame
- Thread
- Array Function Programming c Recursion Recursive function Value
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
S
Writing a recursive function by using optional parameters
One way that I often write recursive functions in my work is by having an optional parameter that is used for all calls after the first. For example, here's how I might implement the classic "Find the largest palindrome in a given string" interview-type problem: using System; public static...- SlurrerOfSpeech
- Thread
- Function Parameters Recursive function Writing
- Replies: 2
- Forum: Programming and Computer Science
-
G
C: Recursive function into iterative
Homework Statement Write an iterative function char* conversion(unsigned int num, int base), that converts an integer num into any base (base <=10). Homework EquationsThe Attempt at a Solution How to transform the following recursive function conversion() into iterative: #include <stdio.h>...- gruba
- Thread
- Function Iterative Programming c Recursive function
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
B
Evaluating a recursive function
Hello everyone, Here is the problem: Let ##\displaystyle f_0() = \frac{1}{1-x}##, and ##f_n(x) = f_0(f_{n-1}(x))##, where ##n \in \mathbb{N}##. Evaluate ##f_{2014}(2014)##. I first sought after a pattern, and then tried to make a conjecture. Here is what I found: ##\displaystyle f_1(x) =...- Bashyboy
- Thread
- Function Recursive function
- Replies: 4
- Forum: Precalculus Mathematics Homework Help
-
G
Asymptotic time complexity of Recursive function
Homework Statement I've been asked to develop a recursive function and then analyze the asymptotic time complexity. f(N) = 0, if N < N1 f(N1) = C1 f(N)= A1 + M1*f(M2*N/D1 - S1) Op M3*f(M4*N/D2 - S2), if N > N1 Homework Equations We're to assume that: s1 = s2 = 0 m2 =...- GeorgeCostanz
- Thread
- Complexity Function Recursive function Time
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
W
Convergence time of a recursive function
I have a recursive function that will eventually converge to either a fixed value or a limit cycle. Depending on the inputs, it will converge to different values (or cycles) at different rates. How could I go about measuring the rate of convergence for different inputs, regardless of what type... -
S
Recursive Function Homework: Printing N Asterisks
Homework Statement Hey, this isn't really homework, but my professor stated that any loop can be represented by a recursive function. Here is an example I made: Following is a loop inside of a recursive function. I have it set up such that it takes n asterisks and prints them on a single...- sandy.bridge
- Thread
- Function Recursive function
- Replies: 16
- Forum: Engineering and Comp Sci Homework Help
-
S
Simple Recursive Function- returning nan
Simple Recursive Function-- returning "nan" Homework Statement I have a program that is supposed to simulate a growth population. The details are not of much importance. It is a rather simple program, however, I am having problems with the program returning the final value that it has stored...- sandy.bridge
- Thread
- Function Recursive function
- Replies: 8
- Forum: Engineering and Comp Sci Homework Help
-
L
Pure Recursive Function for f(n) = 6[SUP]n[/SUP] + 6n
"Pure Recursive Function" for f(n) = 6n + 6n Howdy! First of all I was going to explain a 'Pure Recursive Function' as how my professor defined it: A pure recursive function is stated by only using previous values of the function.. Like: F(n) = f(n-1) + f(n-2) Which means you can't have a...- lpau001
- Thread
- Function Pure Recursive function
- Replies: 3
- Forum: Calculus and Beyond Homework Help
-
J
Writing a recursive function to compute the Jacobi symbol
Write a recursive function to compute the Jacobi symbol J(a, n), is defined for relatively prime integers a and n, a> o, \mbox{ and } n > 0 by the formula J(a, n) = 1 \mbox{ if a = 1, } = J(a/2, n)*(-1)^\frac{n^2-1}{8} \mbox{ if a is even, } =J(n \% a, a)*(-1)^\frac{(a-1)*(n-1)}{4} \mbox{...- John O' Meara
- Thread
- Function Jacobi Recursive function Symbol Writing
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
P
Error writing recursive function for Bonnet's recursion formula in C
Bonnet’s recursion formula for Legendre polynomials is P(n,x)=1 for n=0 P(n,x)=x for n=1 and P(n,x)= (2n-1)/n*x*P(n-1,x)-(n-1)/n*P(n-2,x) I tried to write recursive function in C to calculate the value of polynomial for a given n and x float legpol(int n, float x) {...- PrakashPhy
- Thread
- Error Formula Function Recursion Recursive function Writing
- Replies: 7
- Forum: Programming and Computer Science
-
F
Translating (Transforming) a recursive function
Hi, I am having trouble understanding how this works. I am giving the following: y[k+2] - y[k+1] + 0.24y[k] = f[k+2] - 2f[k+1]; y[-2] = 1, y[-1] = 2; f[k] = 0 for k < 0; f[k] = k for k >= 0; I would like to have a program compute the next values in the sequence, so, I need y[-2] = 1 to...- fred4321
- Thread
- Function Recursive function
- Replies: 2
- Forum: General Math
-
S
Need help proving a recursive function works
Homework Statement Prove the correctness of the following recursive algorithm to multiply two natural numbers, for all integer constants c ≥ 2. function multiply(y, z) comment Return the product yz. 1. if z = 0 then return(0) else 2. return(multiply(cy,[ z/c]) + y · (z mod c))...- SpiffyEh
- Thread
- Function Recursive function Works
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
H
Recursive function, diff under the integral sign
Hey i stumbled over a problem which i can't solve: f is a continuous function on [a,b] and F_n is recursive given through: F_1(x)=\int_a^x f(t) \ dt and F_{n+1}=\int_a^x F_n(t) \ dt I have to proof that F_n looks like this: F_n(x)=\frac{1}{(n-1)!}\int_a^x (x-t)^{n-1} f(t) \ dt...- heinerL
- Thread
- Function Integral Recursive function Sign
- Replies: 9
- Forum: General Math
-
A
Recursive function equals xmod3 for all x in N
I have a suspicion that if f(0)=0, and f(x)=min(N\Uf(x-2^i)) where i runs from 0 to i=floor(ln(x)/ln(2)), then f(x)=xmod3 for all natural numbers, x. Can anyone help me prove this inductively?- ama03630
- Thread
- Function Recursive function
- Replies: 2
- Forum: General Math
-
W
Solve Recursive Function: A_{n+1}= (8/9)A_n
Homework Statement Solve the recursive function: A_{n+1} = (8/9)A_{n} + (24/9)*(20/9)^n We want a closed formula for A_n Homework Equations I'm just doing this to work out the surface area of the Menger Sponge. I know the formula's probably out there, but I get this...- wimma
- Thread
- Function Recursive function
- Replies: 1
- Forum: Calculus and Beyond Homework Help
-
E
Mathematica Recursive Function in Mathematica
Hello, I want to write a recursive function in Mathematica, how can I do that? Regards- EngWiPy
- Thread
- Function Mathematica Recursive function
- Replies: 10
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
W
Create a recursive function in prolog
can anyone help me out with this please i want to create a recursive function in prolog to do the following thing sum lists(X; Y;Z) holds for lists X = [x1; : : : xn], Y = [y1; : : : yn] and Z of numbers if and only if Z = [z1; : : : zn] and zi = xi+yi (1 i n).- Wez
- Thread
- Function Recursive function
- Replies: 6
- Forum: Programming and Computer Science
-
N
C/C++ Even summation with recursive function in c++
Hi, I'm a beginner in C++. I wan't to write this program: Write a program that asks the user to enter n numbers –where n entered by the user- and calculates the sum of even numbers only. main function asks the user to enter n and then calls the recursive function Sum to read the values...- NewDesigner
- Thread
- C++ even Function Recursive function Summation
- Replies: 1
- Forum: Programming and Computer Science
-
S
You are subscribed to this thread Proving conjecture for recursive function
Hi, Homework Statement Just having some troubles with a proof i have been asked to do, (sorry for not knowing the math code) basically, f(1)=0, f(2)=1/3 and f(n)= ((n-1)/(n+1))*f(n-2) and I've come up with the conjecture that f(n) = 0 when n is odd, and = 1/(n+1) when n is even...- superdog
- Thread
- Conjecture Function Recursive function Thread
- Replies: 4
- Forum: Calculus and Beyond Homework Help
-
R
Simplifying a recursive function
I am trying to find a formula for f(x) = a*f(x-1) + b*f(x-2) for x≥1, assuming f(-1) and f(0) are known. In other words, I need some expression for f(x) just in terms of a, b, f(-1), and f(0). I tried plugging in stuff and factoring on paper for the first few iterations, but it quickly got out...- randommacuser
- Thread
- Function Recursive function
- Replies: 10
- Forum: Calculus and Beyond Homework Help
-
G
What the hell is going on with this recursive function
I am trying to follow the book on the proof that the factorial is a primitive recursive function and it is confusing as hell. It says 0!=1 y'!=y!y' (y' means the next one so 0=0 0'=1 0''=2 etc. ) We can simply define a two-argument function with a dummy argument, and then get rid of...- gravenewworld
- Thread
- Function Recursive function
- Replies: 17
- Forum: Set Theory, Logic, Probability, Statistics
-
N
Recursive function in a physics equation
Hoping someone can point out an example of a recursive function in a physics equation. If this is not a valid step that would be great to hear about too. Also if anyone has even tried to introduce such an equation in the past or how it might be represented. [I'm not the best student of maths]...- noize11
- Thread
- Function Physics Recursive function
- Replies: 6
- Forum: Other Physics Topics
-
D
Writing a Recursive Function for Placing n Queens on an n x n Chessboard
I have an assignment to write a recursive function that will safely place n Queens on an n x n chessboard. This wasn't all that difficult to figure out. For extra credit I'm supposed to write another function(s) (recursive?) that figures out all the possible solutions. This is, so far...- discoverer02
- Thread
- Function Recursive function
- Replies: 4
- Forum: Computing and Technology