Simple math problem.. I think.. If I was good at math :)

I am going nuts over this (possibly) simple equation that I need for a fun Processing project.

I need to have the "calculation" or "equation" for X

Y is the number of times we go (X=X+X), and the end result should always be 1

 

EXAMPLE:

IF Y is 2 then X = 0.25, because

0.25+0.25=0.5 (Y1)

0.5+0.5=1 (Y2)

HOW on earth does one calculate X? (if Y is for example 214.7787009)?

I imagine it'd be something like X=1/SQR Fish Y Something Hotdog?!?

 

There's SO much respect to the person cracking this! :) (Or I'll delete the post and pretend this never happened, if the answer is really simple :)

Thanks :) (and respect)

 

How about this…

X=(1/Y)/2

with your example of Y=2,

X=(1/2)/2, or X=0.25

So, with Y=214

X=(1/214)/2

X=0.00233645

Based on TH heavy lifting,

X = 1 / (2Y)

X = 1 / (2 * 214.7787009)

x = 1 / (429.5574018)

x = 002327978

After all that, I agree with PaulJD. :slight_smile:

Sorry, but you are not

Sorry, but you are not getting the exponential growth factor in this :slight_smile:

Code from Processing:

float Y = 214.7787009; // The input is Y, that is our variable
float X = 1/(2*Y); // X is what we should be able to calculate (but not with that equation I am afraid)
float ThisShouldTurnOne = X; // For programming reasons I am not re-using X, but a copy… That should turn (approx) 1, if all was well

for (int test = 0; test <Y; test = test +1){
ThisShouldTurnOne = ThisShouldTurnOne + ThisShouldTurnOne;
println (ThisShouldTurnOne);
}

// That goes bonanza, exponential growth is a hard ball - this example ends in overflow, which is a bit more than 1 :wink:

X must be EXTREMELY small - It’s OK to only work it out with say Y=10, or instead of the result being 1, it could be a million. Just fixed (I can devide it down :slight_smile:

***********

Results from your first tries, TH, BM & JD:

0.0046559554
0.009311911
0.018623821
0.037247643
0.074495286
0.14899057
0.29798114
0.5959623
1.1919246
2.3838491
4.7676983
9.535397
19.070793
38.141586
76.28317
152.56635
305.1327
610.2654
1220.5308
2441.0615
4882.123
9764.246
19528.492
39056.984
78113.97
156227.94
312455.88
624911.75
1249823.5
2499647.0
4999294.0
9998588.0
1.9997176E7
3.9994352E7
7.9988704E7
1.59977408E8
3.19954816E8
6.3990963E8
1.27981926E9
2.55963853E9
5.1192771E9
1.02385541E10
2.04771082E10
4.0954216E10
8.1908433E10
1.63816866E11
3.27633732E11
6.5526746E11
1.31053493E12
2.62106985E12
5.2421397E12
1.04842794E13
2.09685588E13
4.1937118E13
8.3874235E13
1.67748471E14
3.35496941E14
6.7099388E14
1.34198776E15
2.68397553E15
5.3679511E15
1.07359021E16
2.14718042E16
4.2943608E16
8.5887217E16
1.71774434E17
3.43548868E17
6.8709774E17
1.37419547E18
2.74839094E18
5.4967819E18
1.0993564E19
2.1987128E19
4.3974255E19
8.794851E19
1.7589702E20
3.5179404E20
7.035881E20
1.4071762E21
2.8143523E21
5.6287046E21
1.1257409E22
2.2514819E22
4.5029637E22
9.005927E22
1.8011855E23
3.602371E23
7.204742E23
1.4409484E24
2.8818968E24
5.7637936E24
1.1527587E25
2.3055174E25
4.611035E25
9.22207E25
1.844414E26
3.688828E26
7.377656E26
1.4755312E27
2.9510623E27
5.9021246E27
1.1804249E28
2.3608498E28
4.7216997E28
9.443399E28
1.8886799E29
3.7773597E29
7.5547195E29
1.5109439E30
3.0218878E30
6.0437756E30
1.2087551E31
2.4175102E31
4.8350205E31
9.670041E31
1.9340082E32
3.8680164E32
7.736033E32
1.5472066E33
3.094413E33
6.188826E33
1.2377652E34
2.4755305E34
4.951061E34
9.902122E34
1.9804244E35
3.9608488E35
7.9216975E35
1.5843395E36
3.168679E36
6.337358E36
1.2674716E37
2.5349432E37
5.0698864E37
1.0139773E38
2.0279546E38
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity
Infinity

GOT IT!!!

X = pow (2,-Y)

I dont know how to write that in smart-I-studied-language - but this is what the function pow does:

http://processing.org/reference/pow_.html

And it works!

THANKS (it was helpful :slight_smile:

Magic numbers…

1.5777218E-30
3.1554436E-30
6.3108872E-30
1.26217745E-29
2.5243549E-29
5.0487098E-29
1.00974196E-28
2.0194839E-28
4.0389678E-28
8.0779357E-28
1.6155871E-27
3.2311743E-27
6.4623485E-27
1.2924697E-26
2.5849394E-26
5.1698788E-26
1.03397577E-25
2.0679515E-25
4.135903E-25
8.271806E-25
1.6543612E-24
3.3087225E-24
6.617445E-24
1.323489E-23
2.646978E-23
5.293956E-23
1.0587912E-22
2.1175824E-22
4.2351647E-22
8.4703295E-22
1.6940659E-21
3.3881318E-21
6.7762636E-21
1.3552527E-20
2.7105054E-20
5.421011E-20
1.0842022E-19
2.1684043E-19
4.3368087E-19
8.6736174E-19
1.7347235E-18
3.469447E-18
6.938894E-18
1.3877788E-17
2.7755576E-17
5.551115E-17
1.110223E-16
2.220446E-16
4.440892E-16
8.881784E-16
1.7763568E-15
3.5527137E-15
7.1054274E-15
1.4210855E-14
2.842171E-14
5.684342E-14
1.1368684E-13
2.2737368E-13
4.5474735E-13
9.094947E-13
1.8189894E-12
3.6379788E-12
7.2759576E-12
1.4551915E-11
2.910383E-11
5.820766E-11
1.1641532E-10
2.3283064E-10
4.656613E-10
9.313226E-10
1.8626451E-9
3.7252903E-9
7.4505806E-9
1.4901161E-8
2.9802322E-8
5.9604645E-8
1.1920929E-7
2.3841858E-7
4.7683716E-7
9.536743E-7
1.9073486E-6
3.8146973E-6
7.6293945E-6
1.5258789E-5
3.0517578E-5
6.1035156E-5
1.2207031E-4
2.4414062E-4
4.8828125E-4
9.765625E-4
0.001953125
0.00390625
0.0078125
0.015625
0.03125
0.0625
0.125
0.25
0.5
1.0

I may be late to the party but…

Y is the number of times we go (X=X+X), and the end result should always be 1

…which I interpreted as 2^Y*X=1  (2^Y means 2 to the power Y)

so: X=1/(2^Y) which is exactly what pow(2,-Y) means

Antonio, lovebird! How was

Antonio, lovebird! How was Paris? :smiley:

I should have asked you right away!

How close do you think this is to anything Einstein said? Seriously, I am doing gravitational stuff, and it appears to look as if I’m backwards engineering him :slight_smile:

Would I be correct in
Would I be correct in guessing you are using this to identify which samples to examine from a universe of samples?
to achieve a certain reliability or satisfaction?

I knew it will happen again.

I knew it will happen again. Just commented here https://www.robotshop.com/letsmakerobots/node/34018#comment-91690 about “I am the smartest guy in the room” but have to face that I am not the one :slight_smile: Seems Markus is beating all of us also when birdmun and TH did a great job trying to explain higher maths :slight_smile:

For me it’s just another unknown miracle how people can calculate such things.  Ok, I am not the worst in math as I instantly saw the funny thing in Markus’s example picture but if it’s going to be complicated then I am trying to seek for other solutions.

What do you want to achieve with that formula Frits?

Heh!

Paris was ok, Amsterdam was better :D, I’m still recovering from driving 7000km…

I didn’t even get the chance to upload my Campus Party pictures

What gravitational stuff are you working on?

To be fair, I have a

To be fair, I have a mathematician degree (B.Sc.) :stuck_out_tongue:

If you want to take a look, Lumi, this is what I am doing beside robotics. Working on the Collatz conjecture.

I don’t understand if you

I don’t understand if you are joking with me, explaining me stuff, or talking about something else.

But I am very happy to learn - once again - that LMR is a pool of mostly very talented persons.

I know that you are a

I know that you are a mathematician Markus :slight_smile: (but had to google B.Sc.just now)

What I don’t like is something endless to the top…I like defined areas/ranges/numbers with an END.

So I want to know what Frits is planning with this calculation.

//Edit: This article in the link is from you…got you because of the very unique username :slight_smile:

:)"What gravitational stuff

:slight_smile:

"What gravitational stuff are you working on?"

I’m trying to set up some virtual invironment to match parts of observable / known universe - with the intent of testing that towards different theories my mind have (against my will: oh no, no more crazy ■■■■ to think about, just want a life). It’s theories of gravity not pulling but pushing… Not stuff that makes much sense, or is at a state where it can be presented in a comment here :wink: - I just cannot let go of some ideas sometimes, guess it’s whats makes me a nerd! :smiley:

"So I want to know what

"So I want to know what Frits is planning with this calculation."

I just needed to be able to insert predicted gravity in time&space in an virtual invironment, while learning Processing, and having frantic spasms and tics. (Don’t ask me, nothing makes sense, I work and play by intuition :slight_smile:

The number 1 is gravity 1 at “the edge” of a given object. Y is the distence to the object. X’s are amount of gravity, relative to 1 at the surface. My mind flew from space, and was now affected by X, as an object came closer. I knew the distance to the object, Y - but how much gravity should I feel, I was wondering :smiley: The answer was X!

Oh - and "endless at the

Oh - and “endless at the top”: All in universe is affecting all. That is why. But my ■■■■ is only affecting Mars with very… very small numbers. Very!

Sorry I can not follow you,

Sorry I can not follow you, Antonio.

First of all, in math x=x+x makes no sense, because x=x+x <=> x=2x <=> 1=2 (contradiction).

If I understand Frits (admittedly horrible) description, it is the simple equation 2xy=1. Solving for x, we get x=1/(2y).

I see no any reason to use y as an exponent. This would lead to a logarithm equation. Your equation is only true for the special case y=2, because 2+2=22=4 and 2^2=4. But for example 23=6 and 2^3=8.

 

 

 

Amsterday…green city

Amsterday…green city :slight_smile:

7000km, that’s a long way.

Yes, please upload the pictures/videos that we can take a look.

I guess Frits will build a black hole machine to stretch the time indefinitely …right Frits :slight_smile:

Let me clarify…

From what I understood Frits wanted a piece of code to compute a function F(Y) such that the following function returns 1:

function testF(int y) {

float x = F(y);

for (int i = 0;i<y;i++) {

x=x+x; //which is x=x2

}

return x;

}

Notice that the loop doubles x y times so this function can be rewritten as:

function testF(int y) {

float x = F(y);

x = xpow(2,y);

return x;

}

Since we want this function to return 1 we could write the equivalent ecuation as F(y)*2^y=1 or F(y)=1/2^y

Does it make sense now?

Also, x=x+x is a perfectly valid ecuation, the only solution for x is 0 :)