Thread: Error: Not supported by pp_c_expression

  1. #1
    Registered User
    Join Date
    Nov 2011
    Location
    Davis
    Posts
    1

    Error: Not supported by pp_c_expression

    I've got to compute some integrals using the trapezoidal rule. the two functions are exp(-x^2) and exp(-x). It seems simple enough, but I am getting the following errors:

    *'rdiv_expr' not supported by pp_c_expression# 'trapeze.c: In function 'trapeze':
    -called object is not a function
    -called object 'h' is not a function

    Code:
    #include <stdio.h>
    #include <math.h>
    #define a 0
    #define b 1
    
    double sum(double h, int i){
        
        /*calculates the steps taken by each iteration*/
        return (a+i*h); 
    }
    
    double trapeze(int n, double ans[]){
    
        /*the step length for the integral, a constant*/    
        double h=(b-a)/n; 
    
        ans[0]=(h/2)(exp((-a)*a)+exp((-b)*b))+h(sum(h,n-1));
        ans[1]=(h/2)(exp((-a))+exp((-b)))+h(sum(h,n-1));
    
    }
    
    main (void){
    
        double ans[2];
        int n;
    
        printf("Enter the number of intervals: \n");
        scanf("%d", &n);
    
        trapeze(n, ans);
        
    .........
    Thank you!

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Code:
    ...+h(sum(h,n-1))
    h is not a funciton, so you can't use the () immediately after it. Presumably you need something like a * in there. I find it helpful to put a space around my operators to make problems like this stand out more.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. floating point not supported error
    By theju112 in forum C Programming
    Replies: 53
    Last Post: 08-18-2011, 01:42 PM
  2. The project type is not supported by this installation
    By puk284 in forum C# Programming
    Replies: 8
    Last Post: 11-19-2008, 09:27 AM
  3. C++ library supported DLL
    By George2 in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2008, 03:35 AM
  4. assembly: AssemblyKeyFile not supported in VS2005?
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 07-22-2007, 01:07 PM
  5. .rc files not supported by VC++2005Express
    By bejiz in forum Windows Programming
    Replies: 2
    Last Post: 06-04-2006, 08:41 AM