Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8674401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:42:08+00:00 2026-06-12T19:42:08+00:00

I have set of data point (x_i,y_i) from a text file. How can I

  • 0

I have set of data point (x_i,y_i) from a text file. How can I write a C-program that reads those data, send the data to Sage, computes the Pearson correlation and send the result back to C. I have no idea how can I use C to give input to some Linux-program and read its output to a variable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:42:09+00:00Added an answer on June 12, 2026 at 7:42 pm

    OK, let me get it straight: you are working on a C program, and within that program you need to calculate Pearson’s correlation coefficient. You’d like to pass these calculations to Sage rather than code them yourself.

    Now, I don’t know Sage, but I guess it is possible to run it from command line. Assuming that you can prepare an input file or files for Sage, and run the calculations in Sage producing an output, I would then use the system from stdlib.h (man 3 system) to call the command line. Here is the outline of the steps in your C program:

    1. prepare temporary files for Sage’s input and output
    2. construct the command line of Sage
    3. use system() to run the command line
    4. parse the temporary file name where Sage stored it’s output.

    That said, I would not do it using Sage. Pearson correlation coefficient is easy enough to implement in C, and if you do it, your program will not depend on the whole Sage installation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of data that contains garbled text fields because of encoding
I have a set of X,Y data points (about 10k) that are easy to
I have a data set with over 50,000 geocoded points (lat-long). Each point has
I have a huge data set and I have to compute for every point
I have data that always looks something like this: alt text http://michaelfogleman.com/static/images/chart.png I need
I have some surface data that is generated by an external program as XYZ
I have a 3-tuple data set (X,Y,Z points) that I want to plot using
I have time-based data that ranges from 1 to 500. Time is plotted on
At work have a set of floating point values that I sort and compute
I have a set of data points in 3D space which apparently all fall

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.