Page 2 of 2
Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 6:42 pm
by miskox
Little John wrote: Fri Mar 01, 2024 8:46 am
1) This equation also can be written like this:
Or could be written as this:
No. That's still just one of infinitely many solutions.
No. I think if
then there is no solution (for Y=653184000 / 499 / X)
Saso
Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 8:17 pm
by DarkDragon
miskox wrote: Fri Mar 01, 2024 6:42 pm
No. That's still just one of infinitely many solutions.
No. I think if
then there is no solution (for Y=653184000 / 499 / X)
It's still infinitely many, even if not at X = 0.
Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 8:43 pm
by Little John
DarkDragon wrote: Fri Mar 01, 2024 8:17 pm
It's still infinitely many, even if not at X = 0.
Yep, exactly!
Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 9:15 pm
by VB6_to_PBx
; these 2 Equations give 100% exact real-world correlation results
Code: Select all
; these 2 Equations give 100% exact real-world correlation results
; X = (A / (B * Y))
; Y = (A / (B * X))
; i always know in advance what A and B values are
; the Problem is both X and Y must be solved at the same time
; or both X and Y values need to be known in advance before the calculations
; Value constraints are these :
; A = value Range = 259200 minimum to 1140480000 maximum
; B = value Range = 2.0 minimum to 1100 maximum
; X = value Range = 50.0 minimum to 150.0 maximum
; Y = value Range = 1.0 minimum to 25000 maximum
Global.d A, B, X, Y
; When
A = 653184000.0
B = 499.0
X = 129.60257147959285
Y = 10100
X = (A / (B * Y))
Debug A
Debug B
Debug X
Debug Y
Debug "---------------------------"
; When
A = 808704000.0
B = 1006
X = 100.48508946322067
Y = 8000
X = (A / (B * Y))
Debug A
Debug B
Debug X
Debug Y
Debug "---------------------------"
Y = (A / (B * X))
Debug Y
impossible to Solve X and Y in advance of calculations ???

Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 9:57 pm
by TassyJim
; these 2 Equations give 100% exact real-world correlation results
; X = (A / (B * Y))
; Y = (A / (B * X))
X = A/(B*Y)
Y = A/(B*X)
rearranging both equations
X = A/B / Y
Y = A/B / X
Substitute X in the second equation
Y = A/B / (A/B / Y)
Y = A/B / A/B * Y
Y = (A/B / A/B) * Y
Y = 1 * Y
Y = Y
I still don't know Why!
Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 10:02 pm
by DarkDragon
Look, your equation describes a line in 2d space. Almost every point on that line is a solution. You need another constraint such as another line that crosses this line (but not the same line and not in parallel) to get to a single point.
Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 10:44 pm
by STARGĂ…TE
VB6_to_PBx wrote: Fri Mar 01, 2024 9:15 pm
impossible to Solve X and Y in advance of calculations ???
Yes, it's not possible.
If you don't know neither X nor Y, it is Impossible to solve X and Y at the same time because there is no unique case.
You can always pick randomly X (in your range) and calculate Y or pick randomly Y and calculate X.
There is no X,Y that would represent a special solution.
If you have 100 cookies, and ask, how many people X can eat how many cookies Y from this set, then this is the same situation:
One solution is 4 people, each can eat 25 cookies.
But also 10 people is right, when each eat 10 cookies.
Or 20 people, each can eat 5 cookies.
Or even one person, eating all 100 cookies.
There is no distinct solution which is more "real" than the others.
Without more information it is simply not possible, and no AI can help.
Except for a racist AI that thinks some numbers are superior to other numbers.

Re: Solve 1 Equation with 2 Unknowns
Posted: Fri Mar 01, 2024 11:47 pm
by netmaestro
The real solution for me is the one that lets me eat 25 cookies.

Re: Solve 1 Equation with 2 Unknowns
Posted: Sat Mar 02, 2024 8:48 am
by Michael Vogel
I tend to eat 33 cookies and will have a look if one will remain at the end
I was wondering why the following code does not scale correctly when using PB5.73 (works fine with PB6.04)...
Code: Select all
; Define
#X=500
#Y=500
#Xa=-100
#Xb=100
#Ya=-100000
#Yb=100000
#epsilon=0.0000001
#dots=10
Global scalex.d
Global scaley.d
; EndDefine
Procedure.d xo(x.d)
ProcedureReturn x*scalex
EndProcedure
Procedure.d yo(y.d)
ProcedureReturn y*scaley
EndProcedure
Procedure.d x(x.d)
ProcedureReturn (x-#Xa)*scalex
EndProcedure
Procedure.d y(y.d)
ProcedureReturn (y-#Ya)*scaley
EndProcedure
Procedure.d function(x.d)
If x=0
ProcedureReturn 0; Infinitive
Else
ProcedureReturn 653184000/499/x
EndIf
EndProcedure
Procedure.d axis(minx.d,maxx.d,miny.d,maxy.d,stepx.d=1,stepy.d=1,width.d=1)
Protected.s s
Protected.d x,y
MovePathCursor(x(minx),y(0))
While minx<=maxx
x=PathCursorX()
y=PathCursorY()
s=Str(minx)
MovePathCursor(x-VectorTextWidth(s)/2,y)
FlipCoordinatesY(0,#PB_Coordinate_User)
DrawVectorText(s)
FlipCoordinatesY(0,#PB_Coordinate_User)
MovePathCursor(x,y)
minx+stepx
AddPathLine(x(minx),y(0))
AddPathLine(0,5,#PB_Path_Relative)
MovePathCursor(0,-5,#PB_Path_Relative)
Wend
StrokePath(width)
MovePathCursor(x(0),y(miny))
While miny<=maxy
If miny
x=PathCursorX()
y=PathCursorY()
s=Str(miny)
MovePathCursor(x-12-VectorTextWidth(s)/2,y+VectorTextHeight(s)/2)
FlipCoordinatesY(0,#PB_Coordinate_User)
DrawVectorText(s)
FlipCoordinatesY(0,#PB_Coordinate_User)
MovePathCursor(x,y)
EndIf
miny+stepy
AddPathLine(x(0),y(miny))
AddPathLine(5,0,#PB_Path_Relative)
MovePathCursor(-5,0,#PB_Path_Relative)
Wend
StrokePath(width)
EndProcedure
Procedure.d draw(minx.d,maxx.d,steps=100,color=#Red,width=3)
Protected.d stepx
Protected.d dot
stepx=(maxx-minx)/steps
MovePathCursor(x(minx),y(function(minx)))
While minx<=maxx
minx+stepx
AddPathLine(x(minx),y(function(minx)))
x=PathCursorX()
y=PathCursorY()
VectorSourceColor($FF000000|color)
StrokePath(width)
dot=Round(minx/#dots,#PB_Round_Down)*#dots
If minx>dot-#epsilon And minx<dot+#epsilon
AddPathCircle(x,y,5)
VectorSourceColor($FF000000)
FillPath()
AddPathCircle(x,y,2)
VectorSourceColor($FFFFFFFF)
FillPath()
EndIf
MovePathCursor(x,y)
Wend
EndProcedure
Procedure main()
LoadFont(0,"Segoe UI",10)
OpenWindow(0,0,0,#X,#Y,"Function Plotter",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CanvasGadget(0,0,0,#X,#Y)
StartVectorDrawing(CanvasVectorOutput(0))
scalex=#X/(#Xb-#Xa)
scaley=#Y/(#Yb-#Ya)
; ScaleCoordinates(scalex,scaley)
; TranslateCoordinates(-#Xa,-#Ya)
; FlipCoordinatesY(y(0))
FlipCoordinatesY(#Y/2)
VectorFont(FontID(0),15)
axis(#Xa,#Xb,#Ya,#Yb,#dots,10000)
draw(#Xa,#Xb,1000)
StopVectorDrawing()
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndProcedure
main()