2
$\begingroup$

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

Here is what I see:

enter image description here


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

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – rhermans Apr 28 '17 at 14:34
  • $\begingroup$ 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. $\endgroup$ – rhermans Apr 28 '17 at 14:36
  • $\begingroup$ What version of Mathematica are you using? The same code works for me without issues. What happens if you evaluate $CloudConnected? $\endgroup$ – user6014 Apr 28 '17 at 14:51
  • $\begingroup$ When I evaluate $CloudConnected, it just returns the same thing to me. $\endgroup$ – Joey Apr 28 '17 at 15:04
  • 2
    $\begingroup$ @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. $\endgroup$ – Kuba Apr 28 '17 at 20:28
1
$\begingroup$

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[3] to be understood as Sin[3]. This is where Patterns come to rescue."

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Kuba Apr 30 '17 at 8:45
  • $\begingroup$ @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. $\endgroup$ – Ailton Andrade de Oliveira Apr 30 '17 at 12:26

Your Answer

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

Not the answer you're looking for?Browse other questions tagged or ask your own question.