User Profile

Collapse

Profile Sidebar

Collapse
arperidot
arperidot
Last Activity: Mar 10 '10, 02:28 AM
Joined: Feb 10 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • arperidot
    started a topic how to print a multiple characters?
    in C

    how to print a multiple characters?

    i have a really question that's been bugging me for a little too long now. so i want to print this, where 'grade' is a char

    Code:
     if(average >= 100) { grade = 'A+' ; }
            else if(average >= 90 && average < 100) { grade = 'A' ; }
            else if(average >= 80 && average < 90) { grade = 'B' ; }
            else if(average >= 60 && average < 80) { grade = 'C' ; }
    ...
    See more | Go to post

  • arperidot
    replied to C/C++ Matrix/Vector Calculation
    in C
    thanks alot!!!! that along with rearranging my loop produced the desired output. this is what the final matric_mult looked like:

    Code:
    void matrix_mult(double a[3][3], double *b, double *c, int rows)
    {
    int k, s, r;
    double dot_p, res_vec[5];
    double w[3], z[3] = { 1./sqrt(3.), -1/sqrt(3.), 1./sqrt(3.) };
            for(s=0; s<3; s++)
            {
                    for(k=0, dot_p=0; k<3; k++)
    ...
    See more | Go to post

    Leave a comment:


  • arperidot
    replied to C/C++ Matrix/Vector Calculation
    in C
    thanks for the quick reply.
    after doing that, it gives a different value but it is still wrong. any other suggestions??
    See more | Go to post

    Leave a comment:


  • arperidot
    started a topic C/C++ Matrix/Vector Calculation
    in C

    C/C++ Matrix/Vector Calculation

    Hey, I have a program which is done but it gives me the wrong output. It would be greatly appreciated if somebody could help me get the correct output. The question asks:

    Develop a program which computes the current value of the vector {x} based on the following forward iteration: {x}(n+1) = [K] {x}(n)+ {z}, n = 0,1,2,3,4.

    In other words, the next vector {x} is equal to the product of [K] and the current vector {x} + constant...
    See more | Go to post

  • arperidot
    started a topic how to add+multiply matrices
    in C

    how to add+multiply matrices

    Develop a program which computes the current value of the vector {x}
    based on the following forward iteration:

    {x}(n+1) = [K] {x}(n)+ {z}, n = 0,1,2,3,4.

    In other words, the next vector {x} is equal to the product of [K] and
    the current vector {x} + constant vector {z}.

    Perform the matrix multiplication by using the function:

    void matrix_mult(dou ble a[3][3], double *b, double *c, int...
    See more | Go to post

  • arperidot
    started a topic matrix multiplication and addition
    in C

    matrix multiplication and addition

    The question asks to write a program that computes the following:

    {x}(n+1) = [K] {x}(n)+ {z}, n = 0,1,2,3,4.

    In other words, the next vector {x} is equal to the product of [K] and
    the current vector {x} + constant vector {z}.

    [K] is a constant 3x3 matrix defined by:
    double k[3][3] = { { 1.2, -3.0, 1.1},
    {-4.1, 6.2, -2.2},
    { 3.4, -2.5, -3.3} };...
    See more | Go to post

  • arperidot
    replied to help with function that calls another function
    in C
    thanks alot guys! that helped alot.
    turns out my gunc() wasn't properly defined so i ended up computing g(x) directly on f(x)

    double func(double x, int n, double K)
    { double factorial, y;
    factorial = mfact(n);
    y = (1+K*pow(cos(n* x),n))/factorial;
    return y; }
    See more | Go to post

    Leave a comment:


  • arperidot
    replied to help with function that calls another function
    in C
    or actually g = 1+K*pow(cos(n*x ),n);
    See more | Go to post

    Leave a comment:


  • arperidot
    replied to help with function that calls another function
    in C
    thanks for the quick reply
    so i realized that i was supposed to use pow() for line 73
    g = 1+K*pow(cos,n)* (n*x);
    and changed m to n but i still get this error so i cant execute the program

    error: expected declaration specifiers or '...' before 'main'
    >>referencing to line 7
    See more | Go to post

    Leave a comment:


  • arperidot
    started a topic help with function that calls another function
    in C

    help with function that calls another function

    Write a program which calculates the integral of the function

    f(x)=g(x)/n! , where g(x)=1+K*cos^n( n*x)

    on the interval from a to b (a<b). In the main program, scanf a
    non-negative integer value of n and double values of K, a, and b.
    Call the function Integ() to evaluate the integral.

    Your main program should be followed by four functions:

    double Integ(int n, double...
    See more | Go to post

  • arperidot
    started a topic Help with sine taylor series
    in C

    Help with sine taylor series

    hey guys, the question asks to
    Scan the angle in degrees using x=PI*x_deg/180 and calculate Y=sin^2(x).
    Calculate sin^2(x) approximately by using n terms (n>0) the Taylor series
    sin(x)=Sum[(-1)^k x^(2k+1)/(2k+1)!] (k goes from 0 to n-1)
    Scan an integer value of n. Evaluate (2k+1)! by an embedded for-loo statement. Use two do/while statements to continue the calculations for different n and different x_deg.
    Calculate...
    See more | Go to post
    Last edited by Banfa; Feb 10 '10, 09:21 AM. Reason: Added code tags
No activity results to display
Show More
Working...