complex in trigonometric form and its multiplication

Status
Not open for further replies.

send

Newbie level 5
Joined
Jan 11, 2013
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,374

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "stdlib.h"
#include "math.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"
 
float trygon ( int a[j], int b[j])
{
    float r=sqr(pov(a[j],2)+pov (b[j],2));
    float m=a[j]/r;
    float n=b[j]/r;
    float c[]=={r,m,n}
    return c[];
}
 
multiplication ( int a[j], int b[j], int a[l], int b[l] )
{
int rea= a[j]*a[l]+b[j]*b[l];
int ima= a[j]*b[l]+b[j]*a[l];
return int d[]=={rea, ima};
}
 
int main ()
{
int a[5]={2,0,1,1,4}, 
b[5]={4,2,1,-1,2};
int j, l;
 
for (j=0; j<5; j++)
{
printf ("%f", trygon ( int a[j], int b[j]));
}
 
int P1=multiplication( int a[0], int b[0], int a[1], int b[1] )
int P2=multiplication( int a[0], int b[0], int a[2], int b[2] )
int P3=multiplication( int a[0], int b[0], int a[3], int b[3] )
int P4=multiplication( int a[0], int b[0], int a[4], int b[4] )
int P5=multiplication( int a[1], int b[1], int a[2], int b[2] )
int P6=multiplication( int a[1], int b[1], int a[3], int b[3] )
int P7=multiplication( int a[1], int b[1], int a[4], int b[4] )
int P8=multiplication( int a[2], int b[2], int a[3], int b[3] )
int P9=multiplication( int a[2], int b[2], int a[4], int b[4] )
int P10=multiplication( int a[3], int b[3], int a[4], int b[4] )
printf ("%i", P1, "%i", P2, "%i", P3, "%i", P4, "%i", P5, "%i", P6, "%i", P7, "%i", P8, "%i", P9, "%i", P10)
return 0;
}



- - - Updated - - -

int a[5]={2,0,1,1,4},
b[5]={4,2,1,-1,2}; It is two massives of real and imagine part of 5 complex digits/ So i need to transform it to the trygonometric form for that reason there is function trigonom. And also to multiply this complex (in usual form) among them. So this raw code need very correction as even declaration of function recall the compilation errors/ The bad isues that i have not found any exaples of trygonometric form of complexs numbers in the net/ Moreover even multiplication function need the using of massisves. So it is very uneasy task but I would be pleased to get help as C newbie.
 
Last edited by a moderator:


Would you tell me about the declaration of fuction. Why compiler do not meet it smoothly what is wrong. In argumenyts, in abody, maybe there is nessecity of memory allocation, or maybe the way of creation of massive is incorect and it returning out of function. The corection of this code and showing the error would be grant a lot for me as a programmer-beginner/
Or the wright way to show a result is using the printf for showing the ouutput of function-that is acquired values of variables as r, m, n, rea, ima.
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…