Mathematica Asked on January 31, 2021
There is an operation "⊕" that satisfies
what is 2009 ⊕ 1949?
I think it is feasible to solve with Mathematica, but my code doesn’t give a useful result, am i missing something?
Clear["`*"];
f[2009, 1949] //. {f[x_, y_] :> f[x, f[y, z]] - z + 5, f[x_, x_] :> 5,
f[x_, f[y_, y_]] :> y + 5}
This is the kind of thing that you can only find out by exploring substitutions. Doing a bit of trial in the 2nd condition I found a couple of relations that can solve the problem by substituting z for y, and then substituting both y and z for x.
x ⊕(y⊕z) == (x⊕y) + z - 5 /.
z -> y //. CirclePlus[x_, x_] :> 5
(* x⊕5 == -5 + y + x⊕y *)
x ⊕(y⊕z) == (x⊕y) + z - 5 /. {y ->
x, z -> x} //. CirclePlus[x_, x_] :> 5
(* x⊕5 == x *)
From the first relation we can easily get that x⊕y==5 - y + x⊕5
; from the second sit is clear that this expression can be further simplified into x⊕y==5 - y + x
.
Finally using this as a single rule applied to 2009 and 1949
2009⊕1949 /. {x_⊕y_ :> x + 5 - y}
(*65*)
This is the result that Ulrich Neumann has mentioned in the comments, and ⊕
is the operator that Roman has suggested in the comments as well.
Answered by Ferca on January 31, 2021
There are several possible methods to try. Here is one that I came up with in a few minutes without knowing the answer. It depends on using a range of substitutions which may give the answer and it is possible that it may be improved.
First, I decided to use f
instead of CirclePlus
and V
instead of $5$ for clarity and no loss of generality. The two
properties of the operation are given to us. I used the the
first as a replacement rule because it is so obvious and
simple. I used the second as a template and substituted the
three variables with a range of substitutions. My code:
Select[ Flatten[ Table[
f[i, f[j, k] == f[i, j] + k - V /. f[x_, x_] :> V,
{i, {x}}, {j, {x,y}}, {k, {x,y,z,V}}], 2],
FreeQ[#, f[_, f[_, _]]]&]
returns the result
{f[x, V] == x, f[x, V] == -V + y + f[x, y]}
and combining the two equalities it is immediate that $f(x,y) = x - y + V.$.
Answered by Somos on January 31, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP