home.social

#functions — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #functions, aggregated by home.social.

fetched live
  1. Alright, future engineers!
    **Inverse Functions:** A function that undoes another function, effectively reversing its operation.
    Ex: If `f(x)=2x+1`, its inverse `f^-1(x)=(x-1)/2`.
    Pro-Tip: To find it, swap `x` and `y`, then solve for the new `y`!
    #Algebra #Functions #STEM #StudyNotes

  2. Alright, future engineers!
    **Inverse Functions:** A function that undoes another function, effectively reversing its operation.
    Ex: If `f(x)=2x+1`, its inverse `f^-1(x)=(x-1)/2`.
    Pro-Tip: To find it, swap `x` and `y`, then solve for the new `y`!
    #Algebra #Functions #STEM #StudyNotes

  3. Alright, future engineers!
    **Domain of a Function:** All valid input values (x) for which the function produces a real output.
    Ex: `f(x) = 1/(x-3)` -> `x != 3`.
    Pro-Tip: Always check for denominators (never zero) & even roots (argument >= 0)!
    #Algebra #Functions #STEM #StudyNotes

  4. Alright, future engineers!
    **Domain of a Function:** All valid input values (x) for which the function produces a real output.
    Ex: `f(x) = 1/(x-3)` -> `x != 3`.
    Pro-Tip: Always check for denominators (never zero) & even roots (argument >= 0)!
    #Algebra #Functions #STEM #StudyNotes

  5. I also learned a different way to calculate multiple entries using a single formula and printing the outcomes in a human readable way! Creating functions and then running them using a simple int main block is pretty cool...Once, I start making small programs this will be useful information to have! This programming thing might actually be really fun...

    The function structure (that can be customized fairly easily) is below:

    #include <stdio.h>

    //This is the function that will be called and ran in the int main.
    void calculateSum(int x, int y) {
    int sum = x * y;
    printf("Number Sage says, the sum of %d * %d is: %d\n", x, y, sum);
    }

    int main() {
    calculateSum(69, 5);
    calculateSum(184, 5);
    calculateSum(80, 5);
    return 0;
    }

    The expected output:

    Number Sage says, the sum of 69 * 5 is: 345
    Number Sage says, the sum of 184 * 5 is: 920
    Number Sage says, the sum of 80 * 5 is: 400

    #C #Programming #Functions

  6. Alright, future engineers!
    **Inverse Function:** A function that undoes another. If `f(a)=b`, then `f⁻¹(b)=a`.
    Ex: If `f(x)=2x`, then `f⁻¹(x)=x/2`.
    Pro-Tip: To find it, swap x & y, then solve for y!
    #Algebra #Functions #STEM #StudyNotes

  7. Alright, future engineers!
    **Inverse Function:** A function that undoes another. If `f(a)=b`, then `f⁻¹(b)=a`.
    Ex: If `f(x)=2x`, then `f⁻¹(x)=x/2`.
    Pro-Tip: To find it, swap x & y, then solve for y!
    #Algebra #Functions #STEM #StudyNotes

  8. Alright, future engineers!
    **Domain:** All valid input (x) values for a function.
    Ex: For `f(x)=1/(x-2)`, the domain is `x != 2`.
    Pro-Tip: Watch for division by zero or negative square roots – they define restrictions!
    #Functions #Algebra #STEM #StudyNotes

  9. Alright, future engineers!
    **Domain:** All valid input (x) values for a function.
    Ex: For `f(x)=1/(x-2)`, the domain is `x != 2`.
    Pro-Tip: Watch for division by zero or negative square roots – they define restrictions!
    #Functions #Algebra #STEM #StudyNotes

  10. Alright, future engineers!
    **Logarithm:** The exponent a base is raised to to get a number.
    Ex: `log_b(x) = y` means `b^y = x`. So, `log_2(8) = 3` since `2^3 = 8`.
    Pro-Tip: Logs and exponentials are inverse operations. They undo each other!
    #Algebra #Functions #STEM #StudyNotes

  11. Alright, future engineers!
    **Logarithm:** The exponent a base is raised to to get a number.
    Ex: `log_b(x) = y` means `b^y = x`. So, `log_2(8) = 3` since `2^3 = 8`.
    Pro-Tip: Logs and exponentials are inverse operations. They undo each other!
    #Algebra #Functions #STEM #StudyNotes

  12. In the #shell #functions I should have written years ago category...

    function fedilinktousername {
        grep -oE 'https?://[^/]+/@[^/ ]+' |sed -E 's|https?://|@|; s|/@|@|; s/(@[^@]*)(@[^@]*)/\2\1/'
    }
    
    function fediusernametolink {
        grep -oE '(@[^@ ]+){2}' |sed -E 's|(@[^@ ]+)@([^@ ]+)|https://\2/\1|'
    }
    
    rld@Intrepid:~$ clipo
    https://polymaths.social/@rl_dane/statuses/01KVJCAG6Y4C1KTGBDBECH2778
    rld@Intrepid:~$ clipo |fedilinktousername 
    @[email protected]
    rld@Intrepid:~$ clipo |fedilinktousername |fediusernametolink 
    https://polymaths.social/@rl_dane
    rld@Intrepid:~$ 
    

    #UnixShell #ShellScripting #Unix #bash #ksh

  13. In the #shell #functions I should have written years ago category...

    function fedilinktousername {
        grep -oE 'https?://[^/]+/@[^/ ]+' |sed -E 's|https?://|@|; s|/@|@|; s/(@[^@]*)(@[^@]*)/\2\1/'
    }
    
    function fediusernametolink {
        grep -oE '(@[^@ ]+){2}' |sed -E 's|(@[^@ ]+)@([^@ ]+)|https://\2/\1|'
    }
    
    rld@Intrepid:~$ clipo
    https://polymaths.social/@rl_dane/statuses/01KVJCAG6Y4C1KTGBDBECH2778
    rld@Intrepid:~$ clipo |fedilinktousername 
    @[email protected]
    rld@Intrepid:~$ clipo |fedilinktousername |fediusernametolink 
    https://polymaths.social/@rl_dane
    rld@Intrepid:~$ 
    

    #UnixShell #ShellScripting #Unix #bash #ksh

  14. Where do I find the code of standardized functions?

    For instance, I wanted to see how printf is written. I looked into the stdio.h file, but there, I could only find the function declaration, no definition.