Is there a calculation of some sort that loops itself when for example x =1 but stops looping and solves when x is for example 5.
Asked
Active
Viewed 48 times
-1
-
2Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question – Yuriy S Jan 10 '19 at 11:27
-
Are thinking about something like this ($\int{e^x\sin(x)dx}$): https://www.youtube.com/watch?v=Acp8PFx8180 – Ingix Jan 10 '19 at 11:34
-
3loop-spaces is probably not the right category here either. – Paul Jan 10 '19 at 11:35
-
@YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out. – brian vandemeulebroucke Jan 10 '19 at 11:41
-
@Paul I'm sorry for that, it's my first post on stack exchange – brian vandemeulebroucke Jan 10 '19 at 11:41
-
@Ingix not directly but I think that I can use that calculation for something else – brian vandemeulebroucke Jan 10 '19 at 11:42
-
Such problems are behind locks and bars, buried deep in the Pico Vault :-). Truly, it is unclear what you want. – Jyrki Lahtonen Jan 10 '19 at 11:43
-
@YuriyS : if x is 1 the calculation stays looping and it won't solve but when x = 13 it stops looping and it can be solved – brian vandemeulebroucke Jan 10 '19 at 11:46
-
1Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason – Yuriy S Jan 10 '19 at 11:49
-
What do you mean by "x is correct", what do you mean by "solves" and finally, what precisely do you mean by a loop? – Yuriy S Jan 10 '19 at 11:56
1 Answers
0
The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).
INPUT $x$
Label (A)
If $x=1$ GOTO (A)
If $x \neq 1$ GOTO (B)
Label (B)
OUTPUT $3$
END
coffeemath
- 7,403
-
-
-
@YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B), – coffeemath Jan 10 '19 at 12:03
-
1@coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers – Yuriy S Jan 10 '19 at 12:04