Can halting function be created without referring/assembling/generation of the solver in the input? - halting-problem

The question is: can the halting problem be solved if the solver is not being assembled/emulated/generated/recreated/put your choice here/used in any form inside the analyzed function?
There is a very similar question:
Is it possible to make a halting function if you don't call it on itself?
but the answer for it is generally that "we don't call function rather we pass function", however, if we exclude such situations either, will it become solvable?

Related

PDE Mathematica

I'm newbie with Mathematica, so probably my problem is very easy to be solved.
I want to solve a PDE:
The first problem is that the program is not substituting the values inside w[x,y] and its second derivatives, to use them as boundary conditions.
It tells me that Tag Equal in ((w1^(2,0))[x,y]==0)[x,y] is Protected
The other problem is that it gives me also another type of error:
"{NDsolve[{(w1^(0,4))[x,y]+(w1^(2,2))[x,y]+(w1^(4,0))[x,y]==0,{w1[0,y]==0,w1[5,y]==0,((w1^(2,0))[x,y]==0)[0,y]==0,((w1^(2,0))[x,y]==0)[5,y]==0},{w1[x,0]==3,w1[x,5]==3,((w1^(0,2))[x,y]==0)[x,0]==0,((w1^(0,2))[x,y]==0)[x,10]==0}},w1[x,y],{x,0,10},{y,0,5}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing."
Thank you in advance.
I made some changes.
First of all I fixed the boundary conditions because they had a problem.
Moreover I changed also the equation.
Now it still gives me the error:
"{NDsolve[{(w^(0,4))[x,y]+(w^(2,2))[x,y]+(w^(4,0))[x,y]==2,{w[0,y]==0,w[5,y]==0,chix[0,y]==0,chix[5,y]==0},{w[x,0]==0,w[x,10]==0,chiy[x,0]==0,chiy[x,10]==0}},w,{x,0,5},{y,0,10}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing."
If we succeed in fixing this problem, Mathematica should give us a non zero solution.
Thank you very much!
Rewriting it, it doesn't provide any solution. And it also gives no errors. It looks like it is not even substitutiing the boundary conditions. I decided to change them, solving in this way another kind of problem. It still doesn't work. I think that it is very strange, since if the boundary conditions were wrong it should have provided either an indeterminate condition or an impossible one. Any idea?
Thank you very much for your help!

How to know which function is used

I have problem how to know which function is used, cause here is multiple implementation. How rails know which function is correct. How you solve this problem in Ruby, is there way to tell IDE which function will be used
You can use Ruby's Method#source_location
http://ruby-doc.org/core-2.5.1/Method.html#method-i-source_location
You can use it with binding.pry as Stefan suggested or just print the result of #source_location before actually calling specific method (so you can be sure that the scope is the same).

How can I call a function random inside other function in prolog?

I'm trying to call the random function inside another function. For example I want to do this assert(fact(random()). But it does not work. How can I insert a random number this way? Thanks.
In prolog there is no concept of functions like you are trying to do in your code. You should do:
random(N), assert(fact(N))
I recommend reading at least first two chapters Learn Prolog Now! to better understand search and unification.

Prolog beginner help get current time

I am modifying the Eliza program http://cs.nyu.edu/courses/fall11/CSCI-GA.2110-003/documents/eliza.pl
trying to get it to print the system time when user asks - What Time is it?
After hours of reading through manual I got my get_date_time_value() function to work.
As in
get_date_time_value(Key, Value) :-
get_time(Stamp),
stamp_date_time(Stamp, DateTime, local),
date_time_value(Key, DateTime, Value).
However I am at a loss as to how do I call this function from my rule which is defined as
rules([[time,0],[
[1,[_],0,
[please,do,not,get_date_time_value(time,x),.],
['I',dont,know,the,time,.]]]]).
Yes this is a homework assignment and this might sound silly to experts ,but I am really new to Prolog programming even though I have quite some experience in object oriented and functional programming.
No matter what parameters I pass to the get_date_time_value(time,X) function I am always getting an error.
I spent all night on a hit an trial approach ,but nothing I do works.
Any pointers will be great!!
Thanks
From the structure I guess it should look something like this:
rules([[time,0],[
[1,[_],0,
[it,is,HourLiteral,oclock,.],
['I',dont,know,the,time,.]]]]) :- get_date_time_value(hour, HourNumber), number_codes(HourNumber, HourString), atom_string(HourLiteral, HourString) .
I do not know if it works. I did not test it.
You do not give any idea of what you mean by your rule. Maybe you are trying to have the current time in the list where the term get_date_time_value(time,x) appears: but, is that term a call to a function? Prolog does not support that: just look at the clause you give for the get_date_time_value/2 predicate (not function) and what you see there is a sequence of calls to predicates. So your rule probably must given in a clause that holds only if the call to your get_date_time_value/2 predicate also holds, and the clause head and the call share variable(s) to pass information between them.

Return from a subroutine

I want to write a subroutine for working out what to do and then returning.
Before you jump on the "A subroutine that returns is a function LOL!" bandwagon, I want the return to be executed as it were in the function body calling the subroutine, as though I've got a preprocessor to do the substitution, because otherwise this codebase is going to get unwieldy really fast, and returning the return value of a function seems kludgy.
Will vb (sorry I can't be more specific about what version- I'm writing formulas for an embedded system, our API docs are "it runs vb") let me do that or fall in a heap?
I want the return to be executed as it were in the function body calling the subroutine, as though I've got a preprocessor to do the substitution, because otherwise this codebase is going to get unwieldy really fast, and returning the return value of a function seems kludgy.
It's not. Tail-calls are a common practice that work just fine.
They are much preferable than having a function that cannot ever be called unless you want to return its value.
It sounds like you are asking whether C/C++ style macros can be implemented in VB, the answer is no. You could possibly fake it though by generating vbscript, and substituting the right things in.
Lambdas and delegates in VB.Net are not really the same thing as what you are asking for - if my interpretation is correct.

Resources