2
$\begingroup$

I have entered the example: www.wolfram.com/mathematica/new-in-10/pdes-and-finite-elements/solve-a-wave-equation-in-2d.html

into 12.0, and gotten an error message in the uifWave assignment. It says, "incomplete expression; more input is needed". I have hand entered the statement from the web since I don't know how to get a copy from the screen--but I believe that I have done it accurately.

Has anyone made this example work? If so, I must have made some error--and would appreciate learning how to copy the text from the screen properly. Otherwise, could someone clarify how to make the example work?

$\endgroup$
7
$\begingroup$

Click on each input of code and a window will open that contains copy and paste-able code. After copy and paste of each code block into a workbook, select all workbook cells and convert them to Raw InputForm (Cell | Convert To | Raw InputForm) which can then be copy and pasted to this site. The code is then

$Version

(* "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)" *)

Ω = RegionDifference[RegionUnion[
     Disk[], Rectangle[{0, 0}, 
      {2, 2}]], Disk[{1/4, 1/4}, 
     1/5]]; 

uifWave = Quiet[NDSolveValue[
     {D[u[t, x, y], t, t] - 
        Inactive[Laplacian][
         u[t, x, y], {x, y}] == 0, 
      u[0, x, y] == 
       E^(-5*((x - 3/2)^2 + 
          (y - 3/2)^2)), 
      Derivative[1, 0, 0][u][0, x, 
        y] == 0, DirichletCondition[
       u[t, x, y] == 0, True]}, u, 
     {t, 0, 2*Pi}, Element[{x, y}, 
      Ω]]]; 

framesWEQ = Table[Plot3D[
     uifWave[t, x, y], 
     Element[{x, y}, uifWave[
       "ElementMesh"]], 
     PlotRange -> {-1, 1}, 
     Boxed -> False, Axes -> False, 
     Mesh -> None], {t, 0, 2*Pi, 
     2*(Pi/50)}]; 

Manipulate[framesWEQ[[i]], 
  {{i, 16, "time"}, 1, 
   Length[framesWEQ], 1}, 
  SaveDefinitions -> True]

enter image description here

$\endgroup$
  • $\begingroup$ OK. It looks like the example was displayed in TraditionalForm, and when I manually copied it, that format omitted the Inactive directive in its presentation. I will try the method mentioned to copy and transform the web presentation to Mathematica input form. $\endgroup$ – user2238171 Jul 17 at 17:04

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.