The MASM Forum

General => The Colosseum => Topic started by: mabdelouahab on December 14, 2022, 07:24:33 PM

Title: Is this a sequence?
Post by: mabdelouahab on December 14, 2022, 07:24:33 PM
I wrote it in two forms:
Xn=(A+n)/( (B/n)-1) = (n*A+n2)/(B-n)
(https://lh6.googleusercontent.com/-dtOi4SdjRvWQMP7pe2hoLXJTW-zTtCK1QtlG6qN_xMu4G-3GeNRqn4qjRfpzMqYQQA=w2400)           (https://lh6.googleusercontent.com/K06BUP3B5FQLtA8N6526_5mstTX847ojx0kTKAxJdxO9bdpC5Qq25IKmVBQom0WcBA0=w2400)
how to get the sum of the terms of this sequence?
Title: Re: Is this a sequence?
Post by: daydreamer on December 14, 2022, 10:38:21 PM
.data
One real8 1.0
A real8?
B real8?
.code
Xorps xmm0,xmm0
Xorps xmm1,xmm1
Mov ecx,maxn
L1:
Xmm1=xmm1+((xmm0*a+xmm0*xmm0)/(b-xmm0)
Addsd xmm0,one
Sub ecx,1
Jne L1
Title: Re: Is this a sequence?
Post by: HSE on December 14, 2022, 11:23:09 PM
No idea.

Code: [Select]
fldz
Forlp n, 0, maxn
   fSlv = (A+n)/(B/n-1)
   fadd
Next n
fstp X
Title: Re: Is this a sequence?
Post by: mabdelouahab on December 14, 2022, 11:30:14 PM
 :biggrin:,  Mathematical method
Title: Re: Is this a sequence?
Post by: jack on December 15, 2022, 03:20:59 AM
you didn't specify a range for n, Maple gives the following
sum((A*n+n^2)/(B-n), n = 0 .. m) = -(m+1)*B-(m+1)*A-(1/2)*(m+1)^2+(1/2)*m+1/2-B*(B+A)*Psi(m+1-B)+B*(B+A)*Psi(-B)
Title: Re: Is this a sequence?
Post by: mabdelouahab on December 15, 2022, 04:57:35 AM
you didn't specify a range for n, Maple gives the following
sum((A*n+n^2)/(B-n), n = 0 .. m) = -(m+1)*B-(m+1)*A-(1/2)*(m+1)^2+(1/2)*m+1/2-B*(B+A)*Psi(m+1-B)+B*(B+A)*Psi(-B)
:thumbsup:
But how do I get Psi(x) in assembly language? I don't know if this algorithm does the job: The Digamma or Psi Function (https://people.math.sc.edu/Burkardt/c_src/asa103/asa103.html)
Title: Re: Is this a sequence?
Post by: jj2007 on December 15, 2022, 08:38:10 AM
Feasible, but what is the practical use?

(https://upload.wikimedia.org/wikipedia/commons/a/a3/Digamma_function_plot.png)
Title: Re: Is this a sequence?
Post by: jack on December 15, 2022, 09:50:54 AM
just a tiny bit more compact
-B*(B+A)*Psi(m+1-B)+B*(B+A)*Psi(-B)-((1/2)*m+A+B)*(m+1)
Title: Re: Is this a sequence?
Post by: jj2007 on December 15, 2022, 09:53:04 AM
It would be a tiny bit more useful if you explained what A, B, m and Psi are :cool:
Title: Re: Is this a sequence?
Post by: HSE on December 15, 2022, 11:49:00 AM
A little obvious thing is that n range can not include B
Title: Re: Is this a sequence?
Post by: daydreamer on December 15, 2022, 05:43:17 PM
A little obvious thing is that n range can not include B
Great :thumbsup:
 if b-n ==0 break
For n=nmax to nmin step -increment
(edited to correct loop after seen the curves)

@Jochen about practical use,maybe scientist try theory about black holes or something, zero being event horizon?
On Tv showed interesting hawking formula about black holes extremely far away in time dissolves into radiation
Not practical and nobody will probably be alive to discover if hawking was right or wrong

One practical use is to keep computer nerds occupied with enjoy write program from a new formula  :tongue:
Title: Re: Is this a sequence?
Post by: jj2007 on December 15, 2022, 09:17:42 PM
One practical use is to keep computer nerds occupied with enjoy write program from a new formula  :tongue:

That's also my favourite excuse :thumbsup:
Title: Re: Is this a sequence?
Post by: caballero on December 18, 2022, 02:25:34 AM
Xn = (A+n)/(B/n-1) = nA/(B-n) + n^2/(B-n). If we call Yn = nA/(B-n), Zn = n^2/(B-n).

By L'Hôpital's Rule, lim(n->infinite)Yn = -A, lim(n->infinite)Zn = -infinite. Since neither of the two limits is zero, none of the series cannot be convergent, neither Xn.

As for the sequence of partial sums Sum(n=1, N)(Xn), I have not found a formula for it. Maybe someone would have better luck.
Title: Re: Is this a sequence?
Post by: daydreamer on December 18, 2022, 03:46:56 AM
Xn = (A+n)/(B/n-1) = nA/(B-n) + n^2/(B-n). If we call Yn = nA/(B-n), Zn = n^2/(B-n).

By L'Hôpital's Rule, lim(n->infinite)Yn = -A, lim(n->infinite)Zn = -infinite. Since neither of the two limits is zero, none of the series cannot be convergent, neither Xn.

As for the sequence of partial sums Sum(n=1, N)(Xn), I have not found a formula for it. Maybe someone would have better luck.
lack of find a formula for sum together is use computing power in a loop anyway
Title: Re: Is this a sequence?
Post by: mikeburr on December 18, 2022, 11:43:08 AM
A+n/ [B/n -1] if n ->+ve infinity the sum is divergent  the top term tends to n the lower to -1 ie approx to -n
if n > -1 and  < 1 and A and B are much larger than n the top term -> A  and the lower to a multiple of B and thus possibly convergent
n -> - infinity sum converges to n
im interested in how you arrived at this formula .. & what is it for
regards mike b
Title: Re: Is this a sequence?
Post by: caballero on December 18, 2022, 09:05:42 PM
Quote from: L'Hôpital's Rule
lim (x->infinite)(f(x)/g(x)) = lim (x->infinite) (f'(x)/g'(x))
https://en.wikipedia.org/wiki/L'H%C3%B4pital's_rule

Quote
Sum (n=1,infinite)(A*an+B*bn) = A*Sum(an) + B*Sum(bn)
Quote
If Xn = Yn + Zn, if Yn and Zn are convergents, then Xn is convergent; if Yn or Zn ar not convergent, then Xn neither.

Quote
If Sum(an) is convergent (is a real scalar) => lim(n->infinite) (an) = 0
Thus
Quote
If lim(n->infinite) (an) != 0  => Sum(an) is not convergent

Quote
lim (n->infinite)(B/n) = 0 whenever B!= 0, if B=0 then it is undeterminated.


Xn = (A+n)/(B/n-1) = [A / (B/n - 1)] + [n/(B/n-1)]. Let say Yn = [A / (B/n - 1)], Zn = [n/(B/n-1)]
lim (n->infinite)(Yn) = A / (0-1) = -A
lim (n->infinite)(Zn) = infinite / (0-1) = -infinite


Other way, multiplying up and down by "n":
Yn = An/(B-n), Zn = n^2/(B-n).

[Yn], f(n)=An, g(n)=B-n. f'(n) = A, g'(n)=-1. Hence, by the L'Hôpital's Rule, lim Yn = A/-1 = -A
[Zn], f(n)=n^2, g(n)=B-n, f'(n)=2n, g'(n)=-1. Hence, by the L'Hôpital's Rule, lim Zn = lim 2n/-1 = -infinite

None of Yn and Zn are convergents, so Xn neither.
Title: Re: Is this a sequence?
Post by: mineiro on January 03, 2023, 07:58:51 AM
You can check Wolfram site, please, copy whole line and paste:
https://www.wolframalpha.com/input?i2d=true&i=Divide[A%2Bn%2CDivide[B%2Cn]-1]
https://www.wolframalpha.com/input?i2d=true&i=Divide%5Bn*A%2BPower%5Bn%2C2%5D%2CB-n%5D
Title: Re: Is this a sequence?
Post by: mabdelouahab on January 03, 2023, 06:27:13 PM
 :thumbsup:
Title: Re: Is this a sequence?
Post by: caballero on January 03, 2023, 08:41:19 PM
Interesting site  :thumbsup:. It seems that whatever you think about, anyone has already done it and uploaded to internet  :biggrin:.

This serie (https://www.wolframalpha.com/input?i2d=true&i=Sum%5BDivide%5BA%2Bn%2CDivide%5BB%2Cn%5D-1%5D%2C%7Bn%2C1%2Cinfinite%7D%5D&lang=es)

Title: Re: Is this a sequence?
Post by: mabdelouahab on January 04, 2023, 03:01:32 AM
Interesting site  :thumbsup:. It seems that whatever you think about, anyone has already done it and uploaded to internet  :biggrin:.
Could it be automated processing?
Title: Re: Is this a sequence?
Post by: caballero on January 04, 2023, 04:26:56 AM
> Could it be automated processing?
Don't understand. What you send clicking in the above link is the formula you want calculate. The page receives that and calculates it.