Re: calculate de Jong function
- To: mathgroup at smc.vnet.net
- Subject: [mg56982] Re: [mg56969] calculate de Jong function
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 12 May 2005 02:32:15 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
x={x1,x2,x3,x4};
Use Dot
f1[x_?VectorQ] := x.x;
f1[x]
x1^2 + x2^2 + x3^2 + x4^2
or
f2[x_?VectorQ] := Tr[x^2];
f2[x]
x1^2 + x2^2 + x3^2 + x4^2
or
f3[x_?VectorQ] := Plus@@(x^2);
f3[x]
x1^2 + x2^2 + x3^2 + x4^2
or
f4[x_?VectorQ] := Inner[Times,x,x];
f4[x]
x1^2 + x2^2 + x3^2 + x4^2
Bob Hanlon
>
> From: Stefan Schuster <bi1169*delete_from_star_to_star*@fh-
To: mathgroup at smc.vnet.net
> Date: 2005/05/11 Wed AM 05:24:54 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg56982] [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
>
>