I have two functions for the x variable. I want to extract x values that make the functions equal.
(1)
a + b - a b + c x - b c x + d x - a d x- a e x + a b e x- b f x + a b f x- c d x + a d e x + b c f x - a b e f x
(2)
a + b - a b + c x - b c x + d x - a d x - a e x + a b e x - b f x +
a b f x - c d x^2 + a d e x^2 + b c f x^2 - a b e f x^2
where $x\in[0,1]$ equal to each other (i.e. (1)=(2) )
Is it possible to make a program according to the structure of the functions in order to be equal according to the values of x?
A program that extracts x values in the form of a table that makes the functions equal. where $x\in[0,1]$
I need a program that prints 20 $x_i$ values in the form of a table with equal functions
variables = exp // Variables // Sort;
exp = -Subscript[x, 3] Subscript[x, 4] Subscript[x, 5] Subscript[x, 6]
Subscript[x, 7] +
Subscript[x, 1] Subscript[x, 3] Subscript[x, 4] Subscript[x, 5]
Subscript[x, 6] Subscript[x, 7] +
Subscript[x, 2] Subscript[x, 3] Subscript[x, 4] Subscript[x, 5]
Subscript[x, 6] Subscript[x, 7] -
Subscript[x, 1] Subscript[x, 2] Subscript[x, 3] Subscript[x, 4]
Subscript[x, 5] Subscript[x, 6] Subscript[x, 7];
exper = -\!\(\*SubsuperscriptBox[\(x\), \(3\), \(2\)]\) Subscript[x, 4]
Subscript[x, 5] Subscript[x, 6] Subscript[x, 7] + Subscript[x, 1]
\!\(\*SubsuperscriptBox[\(x\), \(3\), \(2\)]\) Subscript[x, 4]
Subscript[x, 5] Subscript[x, 6] Subscript[x, 7] + Subscript[x, 2]
\!\(\*SubsuperscriptBox[\(x\), \(3\), \(2\)]\) Subscript[x, 4]
Subscript[x, 5] Subscript[x, 6] Subscript[x, 7] -
Subscript[x, 1] Subscript[x, 2]
\!\(\*SubsuperscriptBox[\(x\), \(3\), \(2\)]\) Subscript[x, 4]
Subscript[x, 5] Subscript[x, 6] Subscript[x, 7]
;
Module[{expValue, experValue, varValues},
With[{nbrOfResults = 20},
Table[Catch[
Do[If[0.8 <= (expValue =
Round[exp /.
Thread[variables -> (varValues =
Round[RandomReal[{0, 1}, Length[variables]], .1])],
0.01]) < 1,
Throw[{NumberForm[#, {3, 1}] & /@ varValues,
NumberForm[expValue, {4, 5}],
NumberForm[
exper /. Thread[variables -> varValues], {4, 5}]} //
Flatten]], 10000]], {nbrOfResults}] //
SortBy[#, #[[-2]] &] &] //
Prepend[#, {variables, "exp", "exper"} // Flatten] & //
Grid[#, Frame -> All] &]
This program prints values of functions if they are larger than 0.5
I want to print values of variables if the functions are equal
Solve
andNSolve
. $\endgroup$ – Henrik Schumacher Jul 31 '17 at 8:52