Message Boards Message Boards

0
|
4185 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Defining discrete function on intervals from mean of continuous function

Posted 10 years ago
Hello,
I'm learning with Mathematica and I need an advice. I'd like to 'pixelize' a function. What I mean is, that I have continuous complex function
z=x+I*y
f=f[z]
and I'd like to create new one defined by means of f in discrete intervals, that means something like this:
g[w]=Integrate[f[##], {Re[##], i, i + 1}, {Im[##], j, j + 1}]
for x from (i,i+1>
for y from (j,j+1>
for i from 1,...,10
for j from -10,...,10
Is it possible to define such function for the whole domain or at least part of it, f.e.
(1,11>x(-10,11>
???
Thanks for any help given. There can be some mistakes in code above, I'm not familiar with Mathematica syntax yet, so I wanted to at least describe my problem. I'm also sorry for my English, I hope it makes sense.
POSTED BY: Jakub Lelek
2 Replies
Hello Jakub,
Here is a suggestion
pointAverage[function_, i_, j_] :=Integrate[function[x, y], {x, i, i + 1}, {y, j, j + 1}]

which takes a function defined wth two arguments and a grid point i,j.  For example:
 cfunc[x_, y_] := x Sin[Pi x] + y Cos[Pi y] I
 
 pointAverage[cfunc, 1, 2]
 
 pixels = Table[pointAverage[cfunc, i, j], {i, 1, 10}, {j, -10, 10}];
 
 pixels[[1;;3]]
 
 Image[Im[pixels], ImageSize -> 200] // Colorize
Image[Re[pixels], ImageSize -> 200] // Colorize
Image[Arg[pixels], ImageSize -> 200] // Colorize

(*or another example*)

cfuncOther[x_, y_] := Exp[x + I y] (x + I y)

pointAverage[cfuncOther, 2, 2]

pixels = Table[pointAverage[cfuncOther, i, j], {i, 1, 10}, {j, -10, 10}] (*may take a while*)

Image[Arg[pixels], ImageSize -> 200] // Colorize
Image[Im[pixels], ImageSize -> 200] // Colorize
POSTED BY: W. Craig Carter
Posted 10 years ago
Thanks a lot, that was what I needed
POSTED BY: Jakub Lelek
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract