Re: calculate de Jong function
- To: mathgroup at smc.vnet.net
- Subject: [mg57015] Re: [mg56969] calculate de Jong function
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 12 May 2005 02:33:42 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Stefen,
Is this what you want?
deJong[vector_] := Plus @@ (vector^2)
Mapping it onto a list of vectors of varying length...
deJong /@ {{1, 1, 1}, {1, 2, 3, 4}, {a, b}}
{3, 30, a^2 + b^2}
The marvels of Mathematica functional programming!
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Stefan Schuster
To: mathgroup at smc.vnet.net
[mailto:bi1169*delete_from_star_to_star* at fh-weihenstephan.de]
Subject: [mg57015] [mg56969] calculate de Jong function
Hello,
I don't know how I should implement the first de jong function:
f(x)=Sum((x_i)^2)
where x is a Vector with n dimensions and x_i is the value of the i-th
Dimension.
i.e. all Values of the Vector are squared and added.
My problem is that I don't know how many Dimensions there are, so I
can't define the borders of the SUM function.
thanks in advance for help
Stefan
- Follow-Ups:
- InterpolatingFunctionAnatomy.m
- From: Chrisantha <ctf20@sussex.ac.uk>
- InterpolatingFunctionAnatomy.m