# Why doesn't CloudDeploy work in my desktop

I have difficulty in making CloudDeploy in my desktop. Does anyone know why ? Thanks

Here is what I see: Here is the code if someone would like to test

CloudDeploy[
Manipulate[
f[x] = Sin[x];
Plot[f[k x], {x, 0, 10}], {k, 1, 10}]

]


Mathematica 11.0

• Here its considered helpful to show your own efforts and share your code in a well formatted form instead of images or links to external files, so we can quickly Copy&Paste your code, test it, and see the problem you are facing. Please help us to help you and edit your question accordingly. This question in Meta could be useful. – rhermans Apr 28 '17 at 14:34
• Make the most of Mma.SE and take the tour now. Help us to help you, write an excellent question. Edit if improvable, show due diligence, give brief context, code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. – rhermans Apr 28 '17 at 14:36
• What version of Mathematica are you using? The same code works for me without issues. What happens if you evaluate $CloudConnected? – ktm Apr 28 '17 at 14:51 • When I evaluate$CloudConnected, it just returns the same thing to me. – Joey Apr 28 '17 at 15:04
• @Joey try a fresh start: support.wolfram.com/kb/12464 and if this does not help try contacting WRI Support. Your code should work but noone else can reproduce the problem. – Kuba Apr 28 '17 at 20:28

## 1 Answer

Try to change the function definition.

CloudDeploy[
Manipulate[
f[x_] := Sin[x];
Plot[f[k x], {x, 0, 10}], {k, 1, 10}]
]


Note that I am changing f[x]=Sin[x] to f[x_]:=Sin[x]. The key points here are:

• x to x_ (the use of a Pattern, the main change here)
• = to := (the use of SetDelayed, optional but I would suggest as a good habit for Mathematica newcomers).

I welcome more experienced users to clarify here, but I like to think Mathematica as a kind of term rewriting system. When I say f[x]=Sin[x] all that is said to Mathematica is "if you find literally f[x] change it to Sin[x] (it is creating a kind of DownValues - a good question regarding related concepts is here). Normally, a newcomer do not want this. You would expect to create something that would allow f to be understood as Sin. This is where Patterns come to rescue."

• That's all true but how does this answer the problem about CloudDeploy? I can use OP's code and deploy it, sure it won't work correctly but that is not the point here. – Kuba Apr 30 '17 at 8:45
• @Kuba, I think the main problem is a corrupted session (I +1'ed your comment suggesting a fresh start). I was only able to reproduce the problem by clearing CloudDeploy. However, the syntax used could fail if a Symbol x was already present in the session. Because of this I decided to point to more robust ways of defining functions and related concepts. – Ailton Andrade de Oliveira Apr 30 '17 at 12:26