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 6606353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:23:12+00:00 2026-05-25T19:23:12+00:00

So I have to write a code that determines whether a value pulled from

  • 0

So I have to write a code that determines whether a value pulled from a file falls within a specific range.

                double averageMaximumX = query.Average(t => double.Parse(t.XMax));
   double varianceMaximumX = query.Sum(t => Math.Pow(double.Parse(t.XMax) - averageMaximumX, 2));
                varianceMaximumX /= query.Count();
                double stdDevMaximumX = Math.Sqrt(varianceMaximumX);

                double averageMinimumX = query.Average(t => double.Parse(t.XMin));
   double varianceMinimumX = query.Sum(t => Math.Pow(double.Parse(t.XMin) - averageMinimumX, 2));
                varianceMinimumX /= query.Count();
                double stdDevMinimumX = Math.Sqrt(varianceMinimumX);

                double averageMaximumY = query.Average(t => double.Parse(t.YMax));
   double varianceMaximumY = query.Sum(t => Math.Pow(double.Parse(t.YMax) - averageMaximumY, 2));
                varianceMaximumY /= query.Count();
                double stdDevMaximumY = Math.Sqrt(varianceMaximumY);

                double averageMinimumY = query.Average(t => double.Parse(t.YMin));
   double varianceMinimumY = query.Sum(t => Math.Pow(double.Parse(t.YMin) - averageMinimumY, 2));
                varianceMinimumY /= query.Count();
                double stdDevMinimumY = Math.Sqrt(varianceMinimumY);

                double averageMaximumZ = query.Average(t => double.Parse(t.ZMax));
   double varianceMaximumZ = query.Sum(t => Math.Pow(double.Parse(t.ZMax) - averageMaximumZ, 2));
                varianceMaximumZ /= query.Count();
                double stdDevMaximumZ = Math.Sqrt(varianceMaximumZ);

                double averageMinimumZ = query.Average(t => double.Parse(t.ZMin));
   double varianceMinimumZ = query.Sum(t => Math.Pow(double.Parse(t.ZMin) - averageMinimumZ, 2));
                varianceMinimumZ /= query.Count();
                double stdDevMinimumZ = Math.Sqrt(varianceMinimumZ);


                var results = from item in query
                              select new
                              {
       XMaxResult = TryParseWithDefault(item.XMax, double.NaN) <= averageMaxX ? "pass" : "FAIL",
       XMinResult = TryParseWithDefault(item.XMin, double.NaN) >= averageMinX ? "pass" : "FAIL",
       YMaxResult = TryParseWithDefault(item.YMax, double.NaN) <= averageMaxY ? "pass" : "FAIL",
     YMinResult = TryParseWithDefault(item.YMin, double.NaN) >= averageMinY ? "pass" : "FAIL",
       ZMaxResult = TryParseWithDefault(item.ZMax, double.NaN) <= averageMaxZ ? "pass" : "FAIL",
        ZMinResult = TryParseWithDefault(item.ZMin, double.NaN) >= averageMinZ ? "pass" : "FAIL"

                              };
  • 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-05-25T19:23:13+00:00Added an answer on May 25, 2026 at 7:23 pm

    Add and subtract the standard deviation to the average.

    Example

    XMaxResult = (TryParseWithDefault(item.XMax, double.NaN) <= averageMaxX + stdDevMaximumX 
                 && TryParseWithDefault(item.XMax, double.NaN) >= averageMaxX - stdDevMaximumX)  
                 ? "pass" : "FAIL"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that reads from an ini file in Javascript, using activex
I have an application that allows users to write their own code in a
I have a mobile platform that I am trying to write some communications code
I have threaded code where each thread needs to write to the same file.
I have an intermittent problem with some code that writes to a Windows Event
What are your thoughts about them? Sometimes I have to write unmanaged code at
For a school assignment I have to write x86 assembly code, except I can't
I'm sure I'm going to have to write supporting javascript code to do this.
I have a quad core machine and would like to write some code to
I'm an avid vim user and have started to write some SQL code recently.

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.