4
$\begingroup$

The domain of the function f[x] is R,

And f[x] is an odd function f[-x] == -f[x]

Also satisfying that f[1-x]+f[1+x]==2.

When x belongs to the closed interval [0,1], f[x]=2x- x^2,

2x-x^2 only define on the interval 0<=x<=1. We extend it by the two conditions f[x]=-f[-x] and f[x]=2-f[2-x] to all the Reals domain.

by cvgmt

How to use software to find the analytical expression of the function on the interval [-1,0] based on the known conditions above?

Furthermore, arbitrarily specify an interval, such as [10,20], and find the corresponding analytical formula on the interval?

$\endgroup$
3
  • $\begingroup$ Is this a follow up to your closed question? I Think user cvgmt answered your question in his last comment! $\endgroup$ Commented Jan 19 at 10:18
  • $\begingroup$ It's not the same problem, the closed problem is how to draw the function graph. This problem is to find the function expression corresponding to a certain interval $\endgroup$
    – csn899
    Commented Jan 19 at 10:22
  • $\begingroup$ I would expect that Simplify with user defined transformation rules should do that. This does not work however... $\endgroup$
    – yarchik
    Commented Jan 20 at 14:07

4 Answers 4

8
$\begingroup$
  • f[-x] == -f[x] means that the graph is point reflection respect to {0,0}.

  • f[1-x]+f[1+x]==2 means that the graph is point reflection respect to {1,1} since for two points {x1,y1}={1-x,f[1-x]} and {x2,y2}={1+x,f[1+x]}, (x1+x2)/2=((1-x)+(1+x))/2=1 and (y1+y2)/2=(f[1-x]+f[1+x])/2=1.

  • I do not believe that Mathematica can do this automatic.Here we directly construct such expression by Mod.( The idea is that we move or rotation 180 Degree along direction {1,1}-{0,0}).

Clear["Global`*"];
g[x_] := 2 x - x^2;
G[x_] := 
  Piecewise[{{g[Mod[x, 2, 0]] + x - Mod[x, 2, 0], 
     0 <= Mod[x, 2, 0] <= 1}, {-g[-Mod[x, 2, -1]] + x - 
      Mod[x, 2, -1], -1 <= Mod[x, 2, -1] <= 0}}];
Plot[G[x], {x, -6, 6}, AspectRatio -> Automatic, 
 GridLines -> Automatic, Mesh -> {Range[-6, 6]}, 
 MeshShading -> {Red, Cyan}]

enter image description here

Try to do the more general cases

for two arbitrary point reflection.(Here we according to {x1, y1} = {2, 3};{x2, y2} = {5, 8}; instead of {x1,y1}={0,0};{x2,y2}={1,1};

Clear["Global`*"];
g[x_] := 2  x - x^2;
r[a_, b_][f_] := (2  b + #) &@*Minus@*f@*((2  a - #) &);
{x1, y1} = {2, 3};
{x2, y2} = {5, 8};
(*{x1,y1}={0,0};
{x2,y2}={1,1};*)
fun[x_, n_Integer] := 
  Module[{maps}, 
   maps = Which[n == 0, Identity, n > 0 && n ∈ Integers, 
     PadRight[{r[x2, y2], r[x1, y1]}, n, "Periodic"], 
     n < 0 && n ∈ Integers, 
     PadRight[{r[x1, y1], r[x2, y2]}, -n, "Periodic"]];
   Apply[Composition][maps][g][x] // Simplify];
Show[Table[
  Plot[fun[x, k] // Evaluate, {x, x1 + k  (x2 - x1), 
    x2 + k  (x2 - x1)}], {k, -5, 5}], 
 Graphics[{AbsolutePointSize[5], Red, Point@{x1, y1}, Purple, 
   Point@{x2, y2}}], PlotRange -> All]
Grid[Table[{x1 + k  (x2 - x1) < x < x2 + k  (x2 - x1), 
   fun[x, k]}, {k, -5, 5}], Frame -> All]

enter image description here

enter image description here

$\endgroup$
1
  • $\begingroup$ This universal code is very powerful. By inputting a known analytical formula for a certain interval and the coordinates of two symmetric points, the function graph is drawn and the corresponding analytical formula for the interval is generated $\endgroup$
    – csn899
    Commented Jan 21 at 11:54
4
$\begingroup$

Using @cvgmt definition of G we can find analytic definition in each interval (n,n+1) for integer n. But the function is not analytic on any larger interval so for (10,20) you can not have analytic definition, only definition in a piecewise form.

g[x_] := 2 x - x^2;
G[x_] := Piecewise[{{g[Mod[x, 2, 0]] + x - Mod[x, 2, 0], 
     0 <= Mod[x, 2, 0] <= 1}, {-g[-Mod[x, 2, -1]] + x - 
      Mod[x, 2, -1], -1 <= Mod[x, 2, -1] <= 0}}];

Table[{n < x < n + 1, 
   Expand@FullSimplify[G[x], Assumptions -> n < x < n + 1]},
   {n, -5, 5}] // Column

{
 {{-5 < x < -4, 20 + 10 x + x^2}},
 {{-4 < x < -3, -12 - 6 x - x^2}},
 {{-3 < x < -2, 6 + 6 x + x^2}},
 {{-2 < x < -1, -2 - 2 x - x^2}},
 {{-1 < x < 0, 2 x + x^2}},
 {{0 < x < 1, 2 x - x^2}},
 {{1 < x < 2, 2 - 2 x + x^2}},
 {{2 < x < 3, -6 + 6 x - x^2}},
 {{3 < x < 4, 12 - 6 x + x^2}},
 {{4 < x < 5, -20 + 10 x - x^2}},
 {{5 < x < 6, 30 - 10 x + x^2}}
}
$\endgroup$
3
$\begingroup$

Which gives the implicit function definition in the real domain

f[x_] := Which[ 0 <= x <= 1, 2 x - x^2, x > 1, 2 - f [2 - x],x < 0, -f [-x]]

Plot[f[x],{x,-Pi,  E}]

enter image description here

addendum

Similar to cvgmt 's answer a more explicit compact definition might be f[x]=x(2-Abs[x]) , -1<x<1 using Mod

g[x_] :=  Block[{xmod = Mod[x, 2, -1 ], fx = Floor[x] },
If[EvenQ[fx], fx -= 1];  
Mean[{fx, fx + 2}] + xmod (2  - Abs[xmod]) ] 

Show[Table[
ParametricPlot[{x + u, g[x + u]}, {x, -1, 1},PlotStyle -> andomColor[]], {u, Range[-4, 4, 2]}],PlotRange -> All, AxesOrigin -> {0,0}]

enter image description here

$\endgroup$
2
$\begingroup$

Here's another way, using DSolve to construct the piecewise solution. Works for any interval.

reflectedF = 2 x - x^2 // Piecewise[{{#, x > 0}}, -# /. x -> -x] &;
solF = DSolveValue[{f'[x] == D[reflectedF /. x -> Mod[x, 2, -1], x], 
     f[0] == 0}, f[x], {x, -5, 8}] // PiecewiseExpand;

Plot[solF, {x, -5, 8}]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.