Need HELP!!!!!

Reply

Join Date: Aug 2008
Posts: 3
Reputation: dummy programer is an unknown quantity at this point 
Solved Threads: 0
dummy programer dummy programer is offline Offline
Newbie Poster

Need HELP!!!!!

 
0
  #1
Aug 2nd, 2008
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};
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,997
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 172
Aia's Avatar
Aia Aia is offline Offline
Posting Virtuoso

Re: Need HELP!!!!!

 
0
  #2
Aug 2nd, 2008
Exactly, where are you having problems with?
Be more specific and post relevant portion of code you have tried already and it is not working.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 3
Reputation: dummy programer is an unknown quantity at this point 
Solved Threads: 0
dummy programer dummy programer is offline Offline
Newbie Poster

Re: Need HELP!!!!!

 
0
  #3
Aug 2nd, 2008
I'm completely lost....I don't understand how to write the first function then call on it???
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Need HELP!!!!!

 
0
  #4
Aug 2nd, 2008
...then ask your teacher to divide your homework grade by 2 and send the second half to the author of the best answer...
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 3
Reputation: dummy programer is an unknown quantity at this point 
Solved Threads: 0
dummy programer dummy programer is offline Offline
Newbie Poster

Re: Need HELP!!!!!

 
0
  #5
Aug 2nd, 2008
/*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. */
  1. double a[5][5]={ 1.0, 0.2, 0.6, 0.3,-0.2,
  2. 0.2, 3.0,-0.1, 0.2, 0.7,
  3. 0.6,-0.1, 2.0, 0.7, 0.1,
  4. 0.3, 0.2, 0.7, 5.5, 0.2,
  5. -0.2, 0.7, 0.1, 0.2, 4.5 };
  6. double x1[5], x0[5]={0.1, -0.5, 0.1, 1.0, 0.9};
  7. // ***Enter your statements
  8. int i, k;
  9. double dot;
  10. for(i=0; i<5; i++){
  11. for(k=0, dot=0.0; k<5; k++){
  12. dot +=a[i][k] * x0[k];
  13. x1[i]=dot;
  14. }
  15. }
  16.  
  17. return;
  18. }
  19. double max_norm(double *v, int n)
  20. {
  21. // ***Enter your statements
  22.  
  23.  
  24. return;
  25. }
Last edited by Tekmaven; Aug 2nd, 2008 at 7:59 pm. Reason: http://www.daniweb.com/forums/post661517.html#post661517
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC