summaryrefslogtreecommitdiff
path: root/hw2/calcSigmoid.cpp
blob: e1ac3ed04e394081b78d85090d4dd127d97d5361 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// CSCI 1300 Fall 2022
// Author: Navan Chauhan
// Recitation: 307 – TA name
// Homework 2 - Problem 6

#include<iostream>
#include<cmath> // Required for using the exp function

using namespace std;

int main() {
    double x = 0;
    double sigmoid = 0;
    cout << "Enter a value for x:\n"; // User input
    cin >> x;
    sigmoid = 1/(1+(exp(-x)));
    cout << "The sigmoid for x=" << x << " is " << sigmoid; // prints our sigmoid function
    return 0;
}