Jump to content

mathematical formula.........


 Share

Recommended Posts

I have a mathematical formula of which I would like to find the result of 2 variables

I must find the result => 52

My 2 varaibles are "x" and "y"

the formula is ==>>

$result = 0.95(2(((x+y)-2*y)-0.2)/2+((PI*y"power"3*0.7(2230-355.94ln(y))/32((x/y)+0.07/(x/y)-0.075))/0.016666)/360)-y)

:P

I don't know how to proceed ! !

THANK YOU in advance

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

What the hell is this formula? Do you know how difficult and time consuming it is to have to get a specific result when there is more than one variable?

I think you may be overthinking what he wants but maybe not. From your post it looks like you think he wants to solve for x and y. Which is quite difficult and to do effectivly requires differential equations which I have forgotten how to do over the years. However I think he has x and y and wants to solve for the result. Is this correct Jerem488?

If it is "power" is simply using '^'

ln does not appear to be directly supported however you do have the function "log. " Unless my math skills are failing me now, which they very well may be, you can get the same result of ln(x)= (Log(x)/Log(e)) where e= 2.71828182845905.

PI of course is 3.1459265

Good Luck

Link to comment
Share on other sites

I think you may be overthinking what he wants but maybe not. From your post it looks like you think he wants to solve for x and y. Which is quite difficult and to do effectivly requires differential equations which I have forgotten how to do over the years. However I think he has x and y and wants to solve for the result. Is this correct Jerem488?

If it is "power" is simply using '^'

ln does not appear to be directly supported however you do have the function "log. " Unless my math skills are failing me now, which they very well may be, you can get the same result of ln(x)= (Log(x)/Log(e)) where e= 2.71828182845905.

PI of course is 3.1459265

Good Luck

yes sorry, "power" is "^" ! :P

If you couldnt ans to this question, I will make differently. But in all the the cases i must resolve thi problem.

thank you

Edited by jerem488

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

In AutoIt, Log() is in fact Ln(). :P

Ah I guess if I had read "Return Value Success: Returns the parameter's natural logrithm." I would have seen that for myself. I just assumed it was base10 for some reason. Its been awhile since I've had to deal with mathematics in any form.

Jerem488 you have all the necessary information. I was wrong about the natural log as monceres pointed out but you can simply use log(x) instead its the same as ln(x). I gave you power and PI is just a number, you can make it a variable if you really want to.

Link to comment
Share on other sites

Did you really mean you wanted the result to be => 52 .....i.e greater than or equal to, or did you just mean equal to??

Also, the parentheses aren't balanced, and you need to put * where you want to multiply.

This gives some integer solutions....

$pi = 3.141592

Do

$x = Random(0,100,1)
$y = Random(0,100,1)

$result = 0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * log($y))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y

Until $result >= 52


MsgBox(0,"","x = " & $x & "   y = " & $y)

Change >= to = if you meant 'equal to 52'.......and leave it running for a few days whilst you read up on Turing's Halting Problem. :P

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
Link to comment
Share on other sites

Did you really mean you wanted the result to be => 52 .....i.e greater than or equal to, or did you just mean equal to??

Also, the parentheses aren't balanced, and you need to put * where you want to multiply.

This gives some integer solutions....

$pi = 3.141592

Do

$x = Random(0,100,1)
$y = Random(0,100,1)

$result = 0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * log($y))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y

Until $result >= 52


MsgBox(0,"","x = " & $x & "   y = " & $y)

Change >= to = if you meant 'equal to 52'.......and leave it running for a few days whilst you read up on Turing's Halting Problem. :P

NOOOOOOOOOOO ! ! ! ! STOP !

It's very exelent ! !!

VERY THANKS

I would not have thought that it was so easy.

Very thanks andybiochem. :(

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

So excuse me but can we to be more just ??

Because the random isn't the best choice for this...

And I want the result is imperatively 52 :(

I have test to put this :

$pi = 3.141592

Do

$x = Random(0,100,1)
$y = Random(0,100,1)

$result = 0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * log($y))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y

Until $result = 52


MsgBox(0,"","x = " & $x & "   y = " & $y)

But it's very long.......

Can we use the command "For" rather random ?? :P

Edited by jerem488

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

So excuse me but can we to be more just ??

Because the random isn't the best choice for this...

And I want the result is imperatively 52 :P

I have test to put this :

$pi = 3.141592

Do

$x = Random(0,100,1)
$y = Random(0,100,1)

$result = 0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * log($y))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y

Until $result = 52


MsgBox(0,"","x = " & $x & "   y = " & $y)oÝ÷ Ø­Ýý²÷«ÊZ'&§Áë¬zØ^r¦jwjºE¢º®¢ÚÚ¶«­©Ý¢k§²êÞþ«¨µæ²Ø^­è¬h{m¢ëE©Ý¢dëÉ«­¢+ØÀÌØíÁ¤ô̸ÄÐÄÔäÈ()½ÈÀÌØíàôÄѼÄÀÀ(%½ÈÀÌØíäôÄѼÄÀÀ($$ÀÌØíÉÍÕ±ÐôÀ¸äÔ¨ Ȩ   ÀÌØíà¬ÀÌØí䤴ȨÀÌØí䤴À¸È¤¼È¬  ÀÌØíÁ¤¨ÀÌØíåx̨À¸Ü¨ ÈÈÌÀ´ÌÔÔ¸äШ±½ ÀÌØí䤤¼ÌȨ  ÀÌØíà¼ÀÌØí䤬À¸Àܼ ÀÌØíà¼ÀÌØí䤴À¸ÀÜÔ¤¤¼À¸ÀÄØØØؤ¼ÌØÀ¤´ÀÌØíä($%¥ÀÌØíÉÍÕ±ôÔÈQ¡¸($$%5Í   ½à À°ÅÕ½ÐíIÍÕ±ÐÅÕ½Ðì°ÅÕ½Ðí`ôÅÕ½ÐìµÀìÀÌØíàµÀìÅÕ½ÐìdôÅÕ½ÐìµÀìÀÌØíä¤($$%á¥Ð($%¹%(%9áÐ)9áÐ
Link to comment
Share on other sites

Without a constraint on how x and y are related, there isn't "one" solution to the problem. For every x chosen, there is one or more y values that will satisfy the conditions. Do you want to solve y = f(x)? Do you want to plot the result? Is there another constraint regarding how x and y are related?

Bob

You can't see a rainbow without first experiencing the rain.

Link to comment
Share on other sites

try this:

$found = 0

$pi = 3.141592

For $x = 1 to 100 Step 0.1
    For $y = 1 to 100 Step 0.1
        $result = 0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * log($y))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y
        If $result = 52 Then 
            $found = 1
            ExitLoop 2
        EndIf
    Next
Next

If $found = 1 Then
    MsgBox(0,"","x = " & $x & "   y = " & $y)
Else
    MsgBox(0,"","No solution found")
EndIf

change the x and y limits, and also try changing the step values.

I'm not sure there's a soltuion to this.

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
Link to comment
Share on other sites

try this:

$found = 0

$pi = 3.141592

For $x = 1 to 100 Step 0.1
    For $y = 1 to 100 Step 0.1
        $result = 0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * log($y))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y
        If $result = 52 Then 
            $found = 1
            ExitLoop 2
        EndIf
    Next
Next

If $found = 1 Then
    MsgBox(0,"","x = " & $x & "   y = " & $y)
Else
    MsgBox(0,"","No solution found")
EndIf

change the x and y limits, and also try changing the step values.

I'm not sure there's a soltuion to this.

Result ==> no solution found

And if I don't specify the step ???

I have test without and the result is the same ==>> no solution found :P

Edited by jerem488

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

The reason no solution is found is there are not any rational numbers that solve the conditions. Once you pick an x value, you can solve for the y value numerically. Here are some "solved" values from excel:

x     y
1     1.483060636
2     1.050886771
3     0.838243534
4     0.711812033
5     0.625853159
10  0.411515292
15  0.313334766

This is done by picking an x value, i.e. "1" and a guess for y

Now your function is only one variable f(y) as x is set at your initial pick. A numerical method can be used to solve for y.

I tried Newton's method but it didn't converge well. I don't know what solver algorithm Excel uses.

Bob

You can't see a rainbow without first experiencing the rain.

Link to comment
Share on other sites

To point up what YellowLab is saying.

To see what is the "problem" here try to resolve this much simpler equation:

x^2 + y^2 = 1

That is done like this:

x^2 + y^2 = 1 | *(1/y^2) ; y <> 0 -(multiplying with 1/y^2)

(x/y)^2 + 1 = 1/y^2 | x/y = t -making substitution

t^2 + 1 = 1/y^2 that is to say that y^2 = 1/(1+t^2)

therefore x^2 = t^2/(1+t^2)

So, the solution(s):

x^2 = t^2/(1+t^2)

y^2 = 1/(1+t^2)

for every t ∈ Z ; ( Z = {, -2, -1, 0, 1, 2, })

How many solutions are there?

edit:

actually, for for every t ∈ R ; R - the set of all real numbers

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

It does help if I used the right methodology. This gives results slighlty different than excel:

#include <Array.au3>
Global Const $pi = 3.14159265358979

$step=0.001
$convergence = 0.000001
$result = 52
$func="0.95 * (2 * ((($x+$y)-2*$y)-0.2)/2+(($pi*$y^3*0.7 * (2230-355.94 * _log($y,10))/32 * (($x/$y)+0.07/($x/$y)-0.075))/0.016666)/360)-$y-$result"

Dim $arResult[101][2]
For $x = 1 to 100
    $y = $x/2
    Do 
        $f_0 = _Fofx($x,$y,$result)
        $ytemp=$y-$step/2
        $temp1 = _Fofx($x,$ytemp,$result)
        $ytemp=$y+$step/2
        $temp2 = _Fofx($x,$ytemp,$result)
        $fprime_0 = ($temp2 - $temp1) / $step
        $newy=$y-($f_0/$fprime_0)
        $diff=abs($newy-$y)
        $y=$newy
    Until $diff <= $convergence
    $arResult[$x][0]=$x
    $arResult[$x][1]=$y
Next
_ArrayDisplay($arResult)

Func _log($x, $base)
    Return Log($x) / Log($base)
EndFunc

Func _Fofx($x,$y, $result)
    Return Execute($func)
EndFunc

Good luck!

Bob

EDIT:

Updated the code to show Log base 10 rather than natural log. Don't know which is necessary. Also, refined the algorithm slightly in the calculation of the derivative at $x and added a little more precision to pi. Now the output matches Excel's solver values.

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...