Liste des Groupes | Revenir à s math |
Am 20.01.2025 um 22:28 schrieb Chris M. Thomasson:Sorry for missing something here. The division of complex numbers?On 1/20/2025 1:09 PM, Python wrote:Mückenheim? :-PAgain what's *your* point? Your posts makes absolutely no sense in the context of this thread!>
Just a way to multiply two 2-ary vectors as if they were complex numbers. Now, here is a little C99 program I just typed in the newsreader. It should compile.
_____________________________
#include <stdio.h>
>
>
struct vec2
{
float x;
float y;
};
>
>
struct vec2
ct_cmul(
struct vec2 p0,
struct vec2 p1
){
struct vec2 result = {
p0.x * p1.x - p0.y * p1.y,
p0.x * p1.y + p0.y * p1.x
};
>
return result;
}
>
>
int main()
{
struct vec2 z = { 0, 1 };
struct vec2 zmul = ct_cmul(z, z);
>
printf("z = (%f, %f)\n", z.x, z.y);
printf("zmul = (%f, %f)\n", zmul.x, zmul.y);
>
return 0;
}
_____________________________
>
>
Let me run it on a C99 compiler... Ok, it works:
>
z = (0.000000, 1.000000)
zmul = (-1.000000, 0.000000)
>
I thought it might help out the OP.
Note though:
See?!This is quite off-topic to point out that multiplication of complex numbers in C/C++ can be done.
>
The discussion is not about that it can be done, even crank Hachel would admit this. It is *why* it makes sense to define multiplication *that way*.
You C code doesn't answer the latter "question".
Les messages affichés proviennent d'usenet.