0
$\begingroup$

I am working on a mathmatical formula in which given a number, when you substitute the incognita of the formula for that number, you get another number. It looks sketchy, but the chart will demonstrate better: 1,3,5-3; 7,9-5; 11,13-7; 15,17-9; 19,21-11; The mathmatical formula for it is: (X-1)/2; if the modulus of the result of that operation and 2 is an even number, the result of the equation is (X+1)/2; if it is an odd number, the result of the formula will be (X+3)/2. Look: ((3-1)/2)%2 results in an odd number; therefore the result of the formula will be (3+3)/2, which results in 3. In each row of the chart, if you substitute X by a number in the chart, the result will be the number after the trace ("-"), with exception of 1. My concern is about conditional statements in Mathmatics. Well... in programming you have the so called loops and conditional statements, like if 3>6, do that; if z is superior to 3 and is different from 1, do that, and so on and so forth. My idea is to transform a set of conditional statements, or logical statements, like the one aforementioned, in a Mathmatical formula. So my problem is: 1- How can I express in a mathmatical formula: If the modulus of X is an odd number, make (X+3)/2; else (X+1)/2 2- If X is 1, return 3. If you are curious why I am asking that weird stuff, the answer is because I am trying to make a general math formula for the knigth shortest path problem. An example of logical statement in mathmatics is "choose the bigger number between x and y", that translated into mathmatical terms becomes 1/2*(x+y+absolute value of x-y). Thanks.

$\endgroup$
4
  • $\begingroup$ Guys, I have found of the answer for the condition whether the modolus of X and 2 is an even or odd numbers: (X+(3-(((X+1)/2)%2)*2))/2. Now I need to return 3 instead of (D+(3-(((D+1)/2)%2)*2))/2 in case X is equal to 1. Any ideas? $\endgroup$
    – XianLiu
    Sep 21, 2020 at 2:09
  • $\begingroup$ This seems predicated on a misconception: definitions involving logical constructionsare explicitly allowed in mathematics - not everything has to be expressed as a pure equation. So e.g. $$f(x)=\begin{cases} {x\over 2} & \mbox{ if $x$ is divisible by $2$}\\ 3x-1 & \mbox{otherwise}\end{cases}$$ is a totally fine mathematical definition of the Collatz function. $\endgroup$ Sep 21, 2020 at 2:55
  • $\begingroup$ Now if you want to dive "under the hood," the question of what it means to mathematically define a function (or other object) is treated rigorously in mathematical logic, and more specifically in model theory. Very roughly, when we define a function we have some "ambient universe" we're working in (possibly much larger than the domain of the function itself) and the desired function $f$, or rather its graph $\{(x_1,...,x_n,y): y=f(x_1,...,x_n)\}$, is defined using the basic structure of that universe + Boolean connectives + quantifiers - the relevant term being first-order logic. $\endgroup$ Sep 21, 2020 at 3:00
  • 1
    $\begingroup$ But barring a particular reason for wanting an "equational" description of this function, I would recommend against putting it in that form: it will only be less comprehensible than a clearly-written definition by cases. $\endgroup$ Sep 21, 2020 at 3:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.