| | |
Need HELP!!!!!
![]() |
•
•
Join Date: Aug 2008
Posts: 3
Reputation:
Solved Threads: 0
I NEED HELP WITH THIS PROBLEM!!!! ANYONE!!!!
/*3. Write the function: double max_norm(double *v, int n) to compute
the maximum norm of vector v[] with n elements. The max norm of a vector is
computed by taking the maximum absolute value of its elements.
In prob3() compute x1[]=a[][]*x0[], call max_norm() to compute the max_norm
x1[]. In order to normalize (or convert it to a unit vector), divide each
element of x1[] by the norm. Print the normalized x1[] using %12.4e. Then
copy x1[] as x0[] (to perform updating) and repeat the process nine more times
. */
double a[5][5]={ 1.0, 0.2, 0.6, 0.3,-0.2,
0.2, 3.0,-0.1, 0.2, 0.7,
0.6,-0.1, 2.0, 0.7, 0.1,
0.3, 0.2, 0.7, 5.5, 0.2,
-0.2, 0.7, 0.1, 0.2, 4.5 };
double x1[5], x0[5]={0.1, -0.5, 0.1, 1.0, 0.9};
/*3. Write the function: double max_norm(double *v, int n) to compute
the maximum norm of vector v[] with n elements. The max norm of a vector is
computed by taking the maximum absolute value of its elements.
In prob3() compute x1[]=a[][]*x0[], call max_norm() to compute the max_norm
x1[]. In order to normalize (or convert it to a unit vector), divide each
element of x1[] by the norm. Print the normalized x1[] using %12.4e. Then
copy x1[] as x0[] (to perform updating) and repeat the process nine more times
. */
double a[5][5]={ 1.0, 0.2, 0.6, 0.3,-0.2,
0.2, 3.0,-0.1, 0.2, 0.7,
0.6,-0.1, 2.0, 0.7, 0.1,
0.3, 0.2, 0.7, 5.5, 0.2,
-0.2, 0.7, 0.1, 0.2, 4.5 };
double x1[5], x0[5]={0.1, -0.5, 0.1, 1.0, 0.9};
•
•
Join Date: Aug 2008
Posts: 3
Reputation:
Solved Threads: 0
/*3. Write the function: double max_norm(double *v, int n) to compute
the maximum norm of vector v[] with n elements. The max norm of a vector is
computed by taking the maximum absolute value of its elements.
In prob3() compute x1[]=a[][]*x0[], call max_norm() to compute the max_norm
x1[]. In order to normalize (or convert it to a unit vector), divide each
element of x1[] by the norm. Print the normalized x1[] using %12.4e. Then
copy x1[] as x0[] (to perform updating) and repeat the process nine more times. */
the maximum norm of vector v[] with n elements. The max norm of a vector is
computed by taking the maximum absolute value of its elements.
In prob3() compute x1[]=a[][]*x0[], call max_norm() to compute the max_norm
x1[]. In order to normalize (or convert it to a unit vector), divide each
element of x1[] by the norm. Print the normalized x1[] using %12.4e. Then
copy x1[] as x0[] (to perform updating) and repeat the process nine more times. */
C Syntax (Toggle Plain Text)
double a[5][5]={ 1.0, 0.2, 0.6, 0.3,-0.2, 0.2, 3.0,-0.1, 0.2, 0.7, 0.6,-0.1, 2.0, 0.7, 0.1, 0.3, 0.2, 0.7, 5.5, 0.2, -0.2, 0.7, 0.1, 0.2, 4.5 }; double x1[5], x0[5]={0.1, -0.5, 0.1, 1.0, 0.9}; // ***Enter your statements int i, k; double dot; for(i=0; i<5; i++){ for(k=0, dot=0.0; k<5; k++){ dot +=a[i][k] * x0[k]; x1[i]=dot; } } return; } double max_norm(double *v, int n) { // ***Enter your statements return; }
Last edited by Tekmaven; Aug 2nd, 2008 at 7:59 pm. Reason: http://www.daniweb.com/forums/post661517.html#post661517
![]() |
Other Threads in the C Forum
- Previous Thread: Help Me!!!
- Next Thread: anyone knows chip programming with c
| Thread Tools | Search this Thread |
* adobe ansi api array binarysearch centimeter changingto char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax database directory feet fflush fgets file floatingpointvalidation fork frequency function givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest histogram homework i/o inches infiniteloop input interest intmain() iso keyboard kilometer km linked linkedlist linux linuxsegmentationfault list locate looping lowest match meter microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc program programming pyramidusingturboccodes read recv recvblocked repetition reversing scanf scheduling segmentationfault send single socketprograming socketprogramming stack standard string suggestions systemcall unix urboc user voidmain() wab whythiscodecausesegmentationfault win32api windows.h windowsapi






