a math formula - RESOLVED -

a math formula - RESOLVED -

Postby Silvio.Falconi » Tue Oct 15, 2024 8:08 am

I need to make a formula to calculate a final value having an initial value for example 1 € and a fixed profit from 1 to 999
for example

If nFixedProfit is 10, nInitialBet becomes 1.50.
If nFixedProfit is from 10 to 13 nInitialBet becomes 1.50.
If nFixedProfit is 14 nInitialBet becomes 2.00
If nFixedProfit is from 15 to 18 nInitialBet becomes 2.00
If nFixedProfit is 19 nInitialBet becomes 2.50
If nFixedProfit is 20, nInitialBet becomes 2.50.
If nFixedUse is from 20 to 23 nInitialBet becomes 2.50
If nFixedUse is 24, nInitialBet becomes 3.00.
If nFixedUse is from 25 to 27 nInitialBet becomes 3.00
If nFixedUse is 28, nInitialBet becomes 3.50

and so on

If nFixedUse is 50, nInitialBet becomes 5.50.

there is probably a formula that I don't know

I created this one but it works up to a certain point

nUtileFisso := 20
nPuntataIniziale := 100

nPuntataIniziale := floor(nPuntataIniziale+(nUtileFisso/100)+ (nUtileFisso - 10) / 10)


that gives me back 2.00 but must do 2,50

I allready ask to OPenAI and he not resolved it

How I can resolve it ?
Last edited by Silvio.Falconi on Fri Oct 18, 2024 2:00 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: a math formula

Postby Jimmy » Wed Oct 16, 2024 3:50 am

hi Silvio,
i have ask ChatGPT and got this Answer :
To create a formula that accurately calculates nInitialBet based on nFixedProfit or nFixedUse, we need to account for the specific ranges and values you provided. Your current formula doesn’t seem to handle the step changes correctly. Let’s refine it.
Given the pattern in your data, it looks like nInitialBet increases by 0.50 for every 4 units increase in nFixedProfit or nFixedUse after the initial value of 10. Here’s a more generalized formula:
Code: Select all  Expand view
nInitialBet=1.50+⌊4nFixedProfit−10​⌋×0.50

This formula should work for the ranges you provided. Let’s break it down:

Subtract 10 from nFixedProfit to start the calculation from the base value.
Divide the result by 4 and take the floor of this value to determine how many steps of 0.50 increments are needed.
Multiply the number of steps by 0.50 and add it to the base value of 1.50.

In Excel, you can implement this formula as follows:
Code: Select all  Expand view
=1.50 + FLOOR((nFixedProfit - 10) / 4, 1) * 0.50


This should give you the correct nInitialBet for the values you specified. If you need to handle both nFixedProfit and nFixedUse, you can use a nested IF statement to check which variable is being used:
=IF(nFixedProfit <= 28, 1.50 + FLOOR((nFixedProfit - 10) / 4, 1) * 0.50,
IF(nFixedUse <= 50, 1.50 + FLOOR((nFixedUse - 10) / 4, 1) * 0.50, "Out of range"))

This formula checks nFixedProfit first and applies the calculation. If nFixedProfit is out of range, it checks nFixedUse and applies the same calculation.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: a math formula

Postby Silvio.Falconi » Wed Oct 16, 2024 10:41 am

Jimmy wrote:hi Silvio,]


I tried all yesterday with Openai to resolve my problem but I not resolved

Image



I needed to know how to make the progression with the bets but it is not clear to us how to change the bets
I have this initial data

local nLimiteSpesa:= 100 // is the spending limit
local nUtilePercent:= 50 // the percentage of profit
local nUtileFisso:= 50 // the fixed profit
local nPuntataIniziale := 1.00 // initial bet
local nTotaleEnumeri:= 1 // total numbers to play
local nSorteGioco:= 1 // is the type of game luck (ambata, ambo, terno, etc.)
local nRuote:= 1
local nColpiGioco:= 10 // the number of iteration
local nColpiRecupero:= 0 //iterations for recovery

We have found the right formulas to calculate the expense, the winnings, the profit and the profit in percentage
as you can see on the picture



we need to know how to change the value of the bet based on the progression, ( first two column in the xbrowse)
in another application we saw that with the bet of 1 euro it changes at the seventh iteration from 1 to 1.50, then at the ninth as you can see below


Code: Select all  Expand view

1,00    1,00
1,00    1,00
1,00    1,00
1,00    1,00
1,00    1,00
1,00    1,00
1,50    1,50
1,50    1,50
2,00    2,00
2,00    2,00
2,50    2,50
3,00    3,00
3,50    3,50
4,00    4,00
4,50    4,50
5,50    5,50
6,50    6,50
7,50    7,50
8,50    8,50
10,00   10,00
 



we would like to know the mathematical formula to change the bet according to the percentage of profit entered in our case 50%


the percentage of profit goes from 5 to 500
for example if we put 500 as a percentage we have this result

Code: Select all  Expand view

1,00    1,00
1,50    1,50
3,50    3,50
8,50    8,50
20,50   20,50
48,50   48,50
116,00  116,00
276,50  276,50
659,50  659,50
1.573,00    1.573,00
3.752,00    3.752,00
8.949,00    8.949,00
21.345,00   21.345,00
50.911,50   50.911,50
121.432,50  121.432,50
289.637,00  289.637,00
690.833,50  690.833,50
1.647.755,00    1.647.755,00
3.930.175,00    3.930.175,00
9.374.134,00    9.374.134,00
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: a math formula

Postby Silvio.Falconi » Wed Oct 16, 2024 11:14 am

we tried to make a simulation for the 1.00 bet untile 20 iterations

but it is only a simulation it cannot be used because if I change the bet it no longer works

Code: Select all  Expand view
IF nIter =7
      nPuntata+= .50
   elseif nIter = 9    .OR. nIter=11 .OR. nIter=12 .OR. nIter=13 ;
        .OR. nIter=14 .OR. nIter=15
      nPuntata+=.50
    elseif nIter = 16 .OR. nIter=17 .OR. nIter=18 .OR. nIter=19
      nPuntata+=1
   elseif nIter = 20
      nPuntata+=1.50
      endif


result

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: a math formula

Postby Detlef » Wed Oct 16, 2024 7:09 pm

Silvio.Falconi wrote:I need to make a formula to calculate a final value having an initial value for example 1 € and a fixed profit from 1 to 999
for example

If nFixedProfit is 10, nInitialBet becomes 1.50.
If nFixedProfit is from 10 to 13 nInitialBet becomes 1.50.
If nFixedProfit is 14 nInitialBet becomes 2.00
If nFixedProfit is from 15 to 18 nInitialBet becomes 2.00
If nFixedProfit is 19 nInitialBet becomes 2.50
If nFixedProfit is 20, nInitialBet becomes 2.50.
If nFixedUse is from 20 to 23 nInitialBet becomes 2.50 <--- is this purpose that suddenly change to nFixedUse? Before it was nFixedProfit
If nFixedUse is 24, nInitialBet becomes 3.00.
If nFixedUse is from 25 to 27 nInitialBet becomes 3.00
If nFixedUse is 28, nInitialBet becomes 3.50
...
and so on


Silvio, I'd like to help but I don't exactly know the use of nFixedProfit and nFixedUse.
And why there are 0.5 steps by 4 and by 5.

Regards, Detlef
User avatar
Detlef
 
Posts: 209
Joined: Mon Feb 07, 2022 9:54 pm

Re: a math formula

Postby Silvio.Falconi » Thu Oct 17, 2024 7:23 am

Detlef wrote:
Silvio.Falconi wrote:I need to make a formula to calculate a final value having an initial value for example 1 € and a fixed profit from 1 to 999
for example

If nFixedProfit is 10, nInitialBet becomes 1.50.
If nFixedProfit is from 10 to 13 nInitialBet becomes 1.50.
If nFixedProfit is 14 nInitialBet becomes 2.00
If nFixedProfit is from 15 to 18 nInitialBet becomes 2.00
If nFixedProfit is 19 nInitialBet becomes 2.50
If nFixedProfit is 20, nInitialBet becomes 2.50.
If nFixedUse is from 20 to 23 nInitialBet becomes 2.50 <--- is this purpose that suddenly change to nFixedUse? Before it was nFixedProfit
If nFixedUse is 24, nInitialBet becomes 3.00.
If nFixedUse is from 25 to 27 nInitialBet becomes 3.00
If nFixedUse is 28, nInitialBet becomes 3.50
...
and so on


Silvio, I'd like to help but I don't exactly know the use of nFixedProfit and nFixedUse.
And why there are 0.5 steps by 4 and by 5.

Regards, Detlef



I'll explain to you in practice that lottery players play following specific rules, imagine that you want to play the lottery and have a budget of €100, you decide to make at least 10 plays starting from an initial bet of €1, I have an expense of €1, I bet on the type 1 game (i.e. extracted)

if the chosen number comes out on a wheel I can win 11.23 the bet minus 8% taxes which is equivalent to €10.33, I have a profit of 9.33 (win minus expense) and I have a profit percentage of 933,

if it doesn't come out I have to play again.

in the table that I have seen in other Italian applications after 6 games of €1 something probably happens that I don't understand and you have to change the bet to €1.50

probably because we put 50% of the profit that we set ourselves and in the sixth game and we didn't win we spent €6,

then if you look at this table the bet changes at the ninth, why?

Image

There is probably a mathematical formula that calculates if there is a margin of 50% of the profit, I don't understand what operation it does, I also saw it on a website, it changes at the seventh iteration and then at the ninth but it's not always like this, I tried to change the bet and the increase occurs in different iterations so it makes a very precise calculation and does a check that I don't understand how.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: a math formula

Postby Silvio.Falconi » Thu Oct 17, 2024 10:23 am

Perhaps I understood how make it

I make a check on Profit and Expense Percentage

now I have this result

Image

only that it makes a small mistake that is it adds a row even if the percentage is less than 50, look at the seventh row the percentage is 47

I tried to do a further check but in the FOR/NEXT loop it doesn't enter into an IF

IF (nPercentualeUtile < nUtilePercent)
cancel the line
else
aadd(...)
endif

I also tried to put a debug message before the if it doesn't execute it, I don't understand why
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: a math formula

Postby Silvio.Falconi » Fri Oct 18, 2024 7:19 am

Perhaps I resolved only I have problem to round decimal

Image

Please see the last columns

from row number 8 must be 72,88,59,67,68,64
72.22, 87.82, 58.92, 66.65, 67.51, 64.36
if use round() become 72, 87,58 ,66,67,65

the round function is wrong
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: a math formula

Postby Silvio.Falconi » Fri Oct 18, 2024 1:59 pm

RESOLVED

Image


How can I make a small flashing oBmp icon appear next to the words "you are over budget"?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 61 guests