example_interview.ipynb 1.36 MB
 Theresa Pollinger committed Mar 08, 2018 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hello, freifrau! I am TheInterview, your partial differential equations and simulations expert. Let's set up a simulation together.\n", "\n", "To get explanations, enter \"explain \". \n", "To see a recap of what we know so far, enter \"recap \". \n", "Otherwise, you can always try and use LaTeX-type input.\n",  17  "Have a look at the currently loaded MMT theories under http://localhost:45791\n",  Theresa Pollinger committed Mar 08, 2018 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112  "\n", "\n", "\n", "How many dimensions does your model have?\n", "I am just assuming it's 1, since that is all we can currently handle.\n", "\n", "\n", "What is the domain you would like to simulate for? Ω : type ❘ = [?;?], e.g. Ω = [0.0;1.0]\n", "By the way, you can always try and use LaTeX-type input.\n" ] } ], "source": [ "anything" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "we will just assume that the variable is called x for now.\n", "\n", "\n", "Which variable(s) are you looking for? / What are the unknowns in your model? u : Ω → ??, e.g., u : Ω → ℝ ?\n" ] } ], "source": [ "Ω = [0.0;1.0]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ok, u : Ω → ℝ\n", "u : Ω → ℝ\n", "\n", "\n", "Would you like to name additional parameters like constants or functions (that are independent of your unknowns)? c : ℝ = ? or f : Ω → ℝ = ?\n" ] } ], "source": [ "u : Ω → ℝ" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ok, f = [ x : Ω] x\n", "Would you like to declare more parameters? [y/n]? \n" ] } ], "source": [ "f = x" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ok, α = [ x : Ω] -5.0\n", "Would you like to declare more parameters? [y/n]? \n" ] } ], "source": [ "\\alpha = -5.0" ] }, { "cell_type": "code",  113  "execution_count": 6,  Theresa Pollinger committed Mar 08, 2018 114 115 116 117 118 119 120 121 122 123 124 125 126 127  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "y" ] }, { "cell_type": "code",  128  "execution_count": 7,  Theresa Pollinger committed Mar 08, 2018 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196  "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "I did not catch that. Could you please rephrase?\n", "Details: MMT server error: unbound token: ·.
\n", "
\n", "
\n", "
info.kwarc.mmt.api.SourceError of level 2
\n", "
unbound token: ·
\n", "
source error (object-parser) at http://mathhub.info/MitM/smglom/calculus#15.0.15:15.0.15\n", "\n", "
\n", "
\n", "
\n", " info.kwarc.mmt.api.parser.NotationBasedParser.makeError(NotationBasedParser.scala:93)\n", "
\n", "
\n", " info.kwarc.mmt.api.parser.NotationBasedParser.makeTerm(NotationBasedParser.scala:321)\n", "
\n", "
\n", " info.kwarc.mmt.api.parser.NotationBasedParser.$anonfun$makeTerm$5(NotationBasedParser.scala:345)\n", " \n", " \n", " scala.collection.immutable.List.map(List.scala:287)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.makeTerm(NotationBasedParser.scala:345)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.doFoundContent$1(NotationBasedParser.scala:437)\n", "
\n", "
\n", " info.kwarc.mmt.api.parser.NotationBasedParser.$anonfun$makeTermFromMatchedList$14(NotationBasedParser.scala:496)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.$anonfun$makeTermFromMatchedList$14$adapted(NotationBasedParser.scala:493)\n", " \n", " \n", " scala.collection.immutable.List.foreach(List.scala:389)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.makeTermFromMatchedList(NotationBasedParser.scala:493)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.makeTerm(NotationBasedParser.scala:329)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.makeTerm(NotationBasedParser.scala:335)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.$anonfun$apply$10(NotationBasedParser.scala:214)\n", "
\n", "
\n", " info.kwarc.mmt.api.frontend.Logger.logGroup(Log.scala:34)\n", "
\n", "
\n", " info.kwarc.mmt.api.frontend.Logger.logGroup$(Log.scala:31)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.logGroup(NotationBasedParser.scala:69)\n", " \n", " \n", " info.kwarc.mmt.api.parser.NotationBasedParser.apply(NotationBasedParser.scala:214)\n", " \n", " \n",  197  " info.kwarc.mmt.api.parser.KeywordBasedParser.puCont(StructureParser.scala:141)\n",  Theresa Pollinger committed Mar 08, 2018 198 199  " \n", " \n",  200  " info.kwarc.mmt.api.parser.KeywordBasedParser.readParsedObject(StructureParser.scala:287)\n",  Theresa Pollinger committed Mar 08, 2018 201 202  " \n", " \n",  203  " info.kwarc.mmt.api.parser.KeywordBasedParser.doComponent(StructureParser.scala:292)\n",  Theresa Pollinger committed Mar 08, 2018 204 205  " \n", " \n",  206  " info.kwarc.mmt.api.parser.KeywordBasedParser.readConstant(StructureParser.scala:879)\n",  Theresa Pollinger committed Mar 08, 2018 207 208  " \n", " \n",  209  " info.kwarc.mmt.api.parser.KeywordBasedParser.readInModuleAux(StructureParser.scala:630)\n",  Theresa Pollinger committed Mar 08, 2018 210 211  " \n", " \n",  212  " info.kwarc.mmt.api.parser.KeywordBasedParser.readInModule(StructureParser.scala:457)\n",  Theresa Pollinger committed Mar 08, 2018 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290  " \n", " \n", " info.kwarc.mmt.interviews.InterviewServer.parseDecl(InterviewServer.scala:102)\n", " \n", " \n", " info.kwarc.mmt.interviews.InterviewServer.apply(InterviewServer.scala:50)\n", " \n", " \n", " info.kwarc.mmt.api.web.Server.resolveExtension(Server.scala:95)\n", " \n", " \n", " info.kwarc.mmt.api.web.Server.resolve(Server.scala:76)\n", " \n", " \n", " info.kwarc.mmt.api.web.Server.handleRequest(Server.scala:53)\n", " \n", " \n", " info.kwarc.mmt.api.web.TiscafServerImplementation$RequestHandler$$anon1.act(TiscafServerImplementation.scala:49)\n", " \n", " \n", " tiscaf.HSimpleLet.aact(HLet.scala:166)\n", " \n", " \n", " tiscaf.HSimpleLet.aact(HLet.scala:165)\n", " \n", " \n", " info.kwarc.mmt.api.web.TiscafServerImplementationRequestHandler$$anon$1.aact(TiscafServerImplementation.scala:47)\n", " \n", " \n", " tiscaf.HAcceptor.talk(HAcceptor.scala:246)\n", " \n", " \n", " tiscaf.HSimplePeer.doTalkItself$1(HPeer.scala:101)\n", "
\n", "
\n", " tiscaf.HSimplePeer.$anonfun$readChannel$1(HPeer.scala:114)\n", " \n", " \n", " scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)\n", " \n", " \n", " scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)\n", " \n", " \n", " scala.util.Success.$anonfun$map$1(Try.scala:251)\n", "
\n", "
\n", " scala.util.Success.map(Try.scala:209)\n", "
\n", "
\n", " scala.concurrent.Future.$anonfun$map$1(Future.scala:287)\n", " \n", " \n", " scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)\n", "
\n", "
\n", " scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)\n", " \n", " \n", " scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)\n", " \n", " \n", " tiscaf.sync.SyncQuExecutionContext$$anon$1.run(SyncQuExecutionContext.scala:69)\n", "
\n", "
\n", "
\n", "
\n", "
\n", "\n" ] } ], "source": [ "k = x \\cdot x" ] }, { "cell_type": "code",  291  "execution_count": 8,  Theresa Pollinger committed Mar 08, 2018 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "f = x\n", "α = -5.0\n", "\n", "\n", "Let's talk about your partial differential equation(s). What do they look like? Δu = 0.0, or laplace_operator Ω ℝ u = f ?\n" ] } ], "source": [ "n" ] }, { "cell_type": "code",  312  "execution_count": 9,  Theresa Pollinger committed Mar 08, 2018 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ok, \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "These are all the PDEs needed.\n", "Let's discuss your boundary conditions. What do they look like? u(x) = f(x) or u(1.0) = \\alpha ?\n" ] } ], "source": [ "Δu = \\alpha" ] }, { "cell_type": "code",  376  "execution_count": 10,  Theresa Pollinger committed Mar 08, 2018 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ok \n", "\n", "\n", "These are all the boundary conditions needed.\n", "\n", "\n", "Do you know something about the operator Δ? Is it e.g. linear, or not elliptic ? \n" ] } ], "source": [ "u = f" ] }, { "cell_type": "code",  399  "execution_count": 11,  Theresa Pollinger committed Mar 08, 2018 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "do you know anything else?\n" ] } ], "source": [ "y" ] }, { "cell_type": "code",  416  "execution_count": 12,  Theresa Pollinger committed Mar 08, 2018 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OK!\n", "do you know anything else?\n" ] } ], "source": [ "linear" ] }, { "cell_type": "code",  434  "execution_count": 13,  Theresa Pollinger committed Mar 08, 2018 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OK!\n", "do you know anything else?\n" ] } ], "source": [ "elliptic" ] }, { "cell_type": "code",  452  "execution_count": 14,  Theresa Pollinger committed Mar 08, 2018 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Would you like to try and solve the PDE using the Finite Difference Method in ExaStencils? [y/n]? \n" ] } ], "source": [ "n" ] }, { "cell_type": "code",  471  "execution_count": 15,  Theresa Pollinger committed Mar 08, 2018 472 473 474 475 476 477 478 479 480 481 482 483 484 485  "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Generated ExaStencils input.\n" ] } ], "source": [ "y" ] },  486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578  { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", " \n", " \n", " my plot\n", " \n", "\n", " \n", "\n", "\n", " \n", " \n", " \n", "
\n", "
\n", "
\n", " \n", "