# Defining discrete function on intervals from mean of continuous function

Posted 9 years ago
3814 Views
|
2 Replies
|
1 Total Likes
|
 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 functionz=x+I*yf=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,...,10for j from -10,...,10Is 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.
2 Replies
Sort By:
Posted 9 years ago
 Hello Jakub,Here is a suggestionpointAverage[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] // ColorizeImage[Re[pixels], ImageSize -> 200] // ColorizeImage[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] // ColorizeImage[Im[pixels], ImageSize -> 200] // Colorize
Posted 9 years ago
 Thanks a lot, that was what I needed