| | |
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 arrays binarysearch calculate centimeter char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking highest homework i/o inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. lowest match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h windowsapi






