Logo by Sockratease
News: Visit the Fractalforums.com User Gallery
 
*
Welcome, Guest. Please login or register. December 02, 2008, 02:32:44 AM


Login with username, password and session length



Pages: [1] 2
  Print  
Author Topic: Iterated Function Systems  (Read 276 times)
Description: Iterated Function Systems - contraction problem
0 Members and 1 Guest are viewing this topic.
Crucifixio
Fractal Freshman
**
Posts: 5


View Profile
« on: August 29, 2008, 01:21:11 AM »

Hello everybody,
This this my first time I'm writing on this forum, I've got problem which I can't manage myself, namly I'm writing program about Iterated Function System in which user can set parameters for transformation (contraction) - create his own fractals, generate them and calculate Minkowski dimension. The problem I'm fighting with is how to check affine transformation for contraction (arbitrary) - I don't know which metric to use.
My contraction transformation looks like
|a   b|    |e|
|c   d| + |f |
plus one parameter for probability.

BTW. If there any solution to automatic set probablity to contraction function to work ??
Any help would be very helpfull.
Logged
Trifox
Administrator
Fractal Molossus
*****
Posts: 573


Frascinating!


View Profile WWW
« Reply #1 on: August 29, 2008, 09:52:22 AM »

hello there, you can use the determinant of the matrix to check if it is contractous or not, if i understood you right ...  dink
Logged

---

divide and conquer - iterate and rule
fractalmovies.com
David Makin
Global Moderator
Strange Attractor
*****
Posts: 237


View Profile WWW
« Reply #2 on: August 29, 2008, 10:36:11 AM »

If you mean "How do I calculate the probababilities from the scales ?" then the answer is given by:

log(p0)/log(s0)=log(p1)/log(s1)=log(p2)/log(s2)=....=log(pn)/log(sn)=constant
and
p0+p1+p2+p3+...+pn = 1

The above lead to:
P0+P0^(log(S1)/log(S0))+P0^(log(S2)/log(S0))+....+P0^(log(Sn)/log(S0))=1.0

where p1 to pn are the probabilities and s1 to sn are the scales. This only works provided that all scales are contractive and non-zero - and obviously all transforms are purely affine.
Also "constant" in the above gives the fractal dimension.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"fractaldave" on Yahoo UK Launchcast
Crucifixio
Fractal Freshman
**
Posts: 5


View Profile
« Reply #3 on: August 29, 2008, 12:26:41 PM »

Trifox - simple matrix determinant check will tell me that this transformation is contraction ?? If Det > 0 than it's contraction.
Logged
Crucifixio
Fractal Freshman
**
Posts: 5


View Profile
« Reply #4 on: August 29, 2008, 12:29:49 PM »

David Makin,
In your formula scales s0...sn are which parameters of transformation matrix ??
Logged
Trifox
Administrator
Fractal Molossus
*****
Posts: 573


Frascinating!


View Profile WWW
« Reply #5 on: August 29, 2008, 01:24:52 PM »

the determinant gives you the scale change of the transformation

1= no change

0 = object is scaled to zero

-1 = object is mirrored around center

0.5 = object is scaled halve

remember that you only take the 2x2 part of the 2x3 matrix, the translation part has no affect on the scale Cheesy
|a   b|    |e|
|c   d| + |f |



Logged

---

divide and conquer - iterate and rule
fractalmovies.com
David Makin
Global Moderator
Strange Attractor
*****
Posts: 237


View Profile WWW
« Reply #6 on: August 29, 2008, 06:02:30 PM »

The s0 to sn are the scales, normally the values of the 2*2 determinant for 2D fractals or the 3*3 determinant for 3D fractals.
As Trifox stated you get contraction when abs(determinant) is >0 and <1.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"fractaldave" on Yahoo UK Launchcast
David Makin
Global Moderator
Strange Attractor
*****
Posts: 237


View Profile WWW
« Reply #7 on: August 29, 2008, 06:08:56 PM »

I should add:

1. Use the absolute scales.

2. that you can solve:

P0+P0^(log(S1)/log(S0))+P0^(log(S2)/log(S0))+....+P0^(log(Sn)/log(S0))=1.0

using a binary search if you take s0 as the largest scale.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"fractaldave" on Yahoo UK Launchcast
Crucifixio
Fractal Freshman
**
Posts: 5


View Profile
« Reply #8 on: August 29, 2008, 08:18:21 PM »

Thanks very much guys, when I finish I will post my program on to this forum.
Logged
Trifox
Administrator
Fractal Molossus
*****
Posts: 573


Frascinating!


View Profile WWW
« Reply #9 on: August 29, 2008, 09:38:51 PM »

Thanks very much guys, when I finish I will post my program on to this forum.

i do hope so !

 Afro Afro Afro
Logged

---

divide and conquer - iterate and rule
fractalmovies.com
Crucifixio
Fractal Freshman
**
Posts: 5


View Profile
« Reply #10 on: August 30, 2008, 12:26:56 PM »

One more question log function is log10 or logn
Logged
David Makin
Global Moderator
Strange Attractor
*****
Posts: 237


View Profile WWW
« Reply #11 on: August 31, 2008, 08:17:15 PM »

Because the calculation involves log(a)/log(b) it doesn't matter what the log base is as long as you use the same base for log(a) as log(b) Smiley
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"fractaldave" on Yahoo UK Launchcast
Ross Hilbert
FractAlien
***
Posts: 19


View Profile
« Reply #12 on: September 04, 2008, 08:34:13 PM »

Here is what I use. Start from the bottom and work up.
Hope this helps.
Ross


'
' Define Affine object.
'
Object Affine { A : B : C : D : E : F }
'
' Normalize the count values in weights[].
' On return, the values will all be between 0 and 1
' and the sum of all values will equal 1.
'
void Math.NormalizeWeights(weights[], count) {
  sum = 0
 
  for (idx = 0, idx < count, idx += 1) {
    sum += weights[idx]
  }
  for (idx = 0, idx < count, idx += 1) {
    weights[idx] /= sum
  }
}
'
' Return the determinate of an affine transformation matrix.
'
Complex Affine.Determinate(Affine a) = a.A*a.D - a.B*a.C
'
' Affine.TransformPoint applies an affine transformation
' matrix to a point z and returns the resulting point.
'
' A B E     z.X     A*z.X + B*z.Y + E
' C D F  *  z.Y  =  C*z.X + D*z.Y + F
' 0 0 1     1       1
'
Complex Affine.TransformPoint(Affine a, z) {
  return Complex( \
    a.A*z.x + a.B*z.y + a.E, \
    a.C*z.x + a.D*z.y + a.F  \
  )
}
'
' Generate a random contraction map.
'
' To be a contraction map, the affine transformation
' coefficients must satisfy the following conditions:
'
'   a^2 + c^2 < 1
'   b^2 + d^2 < 1
'   a^2 + b^2 + c^2 + d^2 < 1 + (a*d - c*b)^2
'
Affine Affine.RandomContractionMap(center, radius) {
  while (True) {
    a = Random.NumberInRange(-1, 1)
    w = Sqrt(1 - a^2)
    c = Random.NumberInRange(-w, w)
   
    b = Random.NumberInRange(-1, 1)
    w = Sqrt(1 - b^2)
    d = Random.NumberInRange(-w, w)
 
    if (a^2 + b^2 + c^2 + d^2 < 1 + (a*d - c*b)^2) {
      break
    }
  }
  e = center.x + Random.NumberInRange(-radius, radius)
  f = center.y + Random.NumberInRange(-radius, radius)
 
  return Affine(a, b, c, d, e, f)
}
'
' Initialize weights w[] using the weighted average of
' the absolute value of the determinates of the affine
' transformations in s[].
'
' For a discussion of the following algorithm, see:
'   "Chaos and Fractals"
' by Peitgen, Jurgens, Saupe, Section 6.3 pages 327-329.
'
void Affine.InitializeWeights(Affine s[], w[], count) {
  for (idx = 0, idx < count, idx += 1) {
    w[idx] = Max(0.01, Abs(Affine.Determinate(s[idx])))
  }
  Math.NormalizeWeights(w[], count)
}
'
' N is the number of Affine transformations.
' s[N] are the Affine transformations.
' w[N] are the weights.
'
Complex w[N]
Affine s[N]

for (idx = 0, idx < N, idx += 1) {
  s[idx] = Affine.RandomContractionMap(0, 1)
}
Affine.InitializeWeights(s[], w[], N)

« Last Edit: September 05, 2008, 12:46:02 PM by Ross Hilbert » Logged
David Makin
Global Moderator
Strange Attractor
*****
Posts: 237


View Profile WWW
« Reply #13 on: September 04, 2008, 09:07:20 PM »

Hi,

Just to say that using the "log(Pi)/log(Si)=constant" method provides more accurate results than the method from "Chaos and Fractals" (I verified this by using both methods for the probablilities on many fractals and found that when the scales are not uniform this method was noticeably better at filling the gaps evenly).

The proof of the method can be found in:
"A Multifractal Analysis of IFSP Invariant Measures With Application to Fractal Image Generation"
by J.M.Gutiérrez, A.Iglesias and M.A. Rodríguez.

The document was formerly available on the web as fractals96.pdf
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"fractaldave" on Yahoo UK Launchcast
Ross Hilbert
FractAlien
***
Posts: 19


View Profile
« Reply #14 on: September 04, 2008, 10:56:49 PM »

Thanks David,

I found the document you referenced and I'll give it a read.
Looks good, thanks again!

Ross
Logged
Pages: [1] 2
  Print  

 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Iterated Function Systems (Wikipedia) IFS - Iterated Function Systems julesruis 0 241 Last post October 03, 2006, 11:40:26 PM
by julesruis
from image to function General Discussion A.Real 13 353 Last post November 07, 2006, 07:26:14 AM
by lycium
Newest 3D IFS render - Torus mutation function 3d fractal generation doncasteel8587 0 208 Last post November 06, 2006, 12:44:43 PM
by doncasteel8587
3D Fractal Flame Animation - Torus function Best Fractal Animation doncasteel8587 0 212 Last post November 19, 2006, 05:06:27 PM
by doncasteel8587
My entries: 3 L-systems Static Image eNZedBlue 4 217 Last post December 01, 2006, 08:03:05 AM
by lycium

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 1.226 seconds with 27 queries. (Pretty URLs adds 0.069s, 2q)