Suppose we want an interactive plot for the code:
Clear["Global`*"]
b = 3 (* b is an integer from 2 to 10 *)
x1 = 0
x2 = 1
y1 = 0
y2 = 1 (* x1,x2,y1,y2 are real numbers which represent the subspace
[x1,x2] x [y1,y2] of R^2*)
(*The functions below are "preliminary functions" of the true
function I wish to graph (note k is a real number)*)
s = Max[{Floor[Log[b, RealAbs[x1]]],
Floor[Log[b,
RealAbs[x2]]]}]
g1[xr_, r_] :=
g1[xr, r] =
Round[(10^(s + 1)/b) Sin[r xr] + (10^(s + 1)/b)]
(* Below is the true function I wish to graph *)
f[x_, k_] :=
f[x, k] =
N[y2 - ((y2 - y1)/(10^(s + 1))) Sum[
g1[Sum[RealDigits[x, b, k, -r][[1]][[z]], {z, r + 1 - s, k}],
r + 1 - s]/b^r, {r, s, 8}]]
p1= 10000 (* We want this to be the integer approaching infinity *)
p = (x2-x1)/p1 (*The increment of the x-values between x1+p
and x2 which we're graphing *)
ListPlot[Table[{x, f[x, 20]}, {x, x1 + p, x2, p}]] (*Graph of f we want
to convert to an interactive plot*)
Similar to the answer to this question, we want b
,x1
,x2
,y1
,y2
,k
, p1
and q
to be sliders. We define points $(q_1,q_2)$, where $x_1\le q_1\le x_2$ and $y_1\le q_2\le y_2 $ such that slider $z\in\mathbb{R}$ zoom in point $(q_1,q_2)$ of ListPlot
of $f$
I looked into the documentation for manipulation
but couldn't find any options for zooming. Despite this, I used the the answer stated here.
Attempt:
Using this answer, I tried the following but I got an undefined output:
Clear["Global`*"]
(* Preliminary Functions *)
(* b, x1, x2, y1, y2, z, p1, q are now variables of a function*)
s[b_, x1_, x2_] :=
s[b, x1, x2] =
Max[{Floor[Log[b, RealAbs[x1]]], Floor[Log[b, RealAbs[x2]]]}]
g1[b_, x1_, x2_, xr_, r_] :=
g1[b, x1, x2, xr, r] =
Round[(10^(s[b, x1, x2] + 1)/b) Sin[r xr] + (10^(s[b, x1, x2] + 1)/
b)]
(*Below is the true function I wish to graph*)
f[b_, x1_, x2_, y1_, y2_, x_, k_] :=
f[b, x1, x2, y1, y2, x, k] =
N[y2 - ((y2 - y1)/(10^(s[b,x1,x2]+ 1))) Sum[
g1[b, x1, x2,
Sum[RealDigits[x, b, k, -r][[1]][[z]], {z,
r + 1 - s[b, x1, x2], k}], r + 1 - s[b, x1, x2]]/b^r, {r,
s[b, x1, x2], 8}]]
(* Below is the interactive graph *)
Manipulate[t = -Log[z];
ListPlot[Table[{q[[1]] + q[[2]] x - t - t x,
f[b, x1, x2, y1, y2, q[[1]] + q[[2]] x + t + t x, k]}, {x,
x1 + (x2 - x1)/p1, x2, (x2 - x1)/p1}]], {b, 2, 10, 1}, {x1, -5,
5}, {x2, -5, 5}, {y1, -5, 5}, {y2, -5, 5}, {k, 1, 20, 1}, {p1, 1,
50000}, {{z, 0.50, "zoom"}, 0,
0.999}, {q, {x1, x2}, {y1, y2}}]
Perhaps this was meant for complex-valued functions. How do we fix this (or find a better code)?
Edit: I made a typo in my code but I still get an undefined output.
**Second Edit: See my answer. I wish to convert the interactive plot into a hyperlink."
f
while there is a typo inf
definition with usage functions
hereN[y2 - ((y2 - y1)/(10^(s + 1)))
. It should bes[b, x1, x2]
. $\endgroup${p1, 1, 50000}
. I think, that you can do it up to 1000 only. $\endgroup$