wolfram-mathematica

Please explain this code in Mathematica that creates a heat / intensity map

∥☆過路亽.° 提交于 2019-12-06 10:47:24
问题 Graphics@Flatten[Table[ (*colors, dont mind*) {ColorData["CMYKColors"][(a[[r, t]] - .000007)/(.0003 - 0.000007)], (*point size, dont mind*) PointSize[1/Sqrt[r]/10], (*Coordinates for your points "a" is your data matrix *) Point[ {(rr =Log[.025 + (.58 - .25)/64 r]) Cos@(tt = t 5 Degree), rr Sin@tt}] } &@ (*values for the iteration*) , {r, 7, 64}, {t, 1, 72}], 1] (*Rotation, dont mind*) /. gg : Graphics[___] :> Rotate[gg, Pi/2] 回答1: Okay, I'll bite. First, Mathematica allows functions to be

Keyboard shortcut to quit kernel in Mathematica 5 and 7?

你。 提交于 2019-12-06 10:42:59
Here is an explanation how to define a custom keyboard shortcut for quitting the kernel of the selected notebook by modifying the file KeyEventTranslations.tr . This file is located by default (under Windows) for Mathematica 5.2 in the folder C:\Program Files\Wolfram Research\Mathematica\5.2\SystemFiles\FrontEnd\TextResources\Windows and for Mathematica 7.0.1 in the folder C:\Program Files\Wolfram Research\Mathematica\7.0\SystemFiles\FrontEnd\TextResources\Windows In this file after EventTranslations[{ I have added a line: Item[KeyEvent["q", Modifiers -> {Control}],FrontEndExecute

Entering data with Input[] in mathematica

自作多情 提交于 2019-12-06 10:35:56
问题 How can i make in this code the text in Dialog Box of the Input command to be like this "Enter the 1 element","Enter the 2 element".... For[k = 1, k ≤ n, k++, br = Input["Enter the ",i,"element"]; AppendTo[x, br]; ] 回答1: Make sure your variables match. :-) You can use Row to build up the text. x = {}; n = 3; For[k = 1, k <= n, k++, br = Input[Row[{"Enter the ", k, " element"}]]; AppendTo[x, br]; ] (You could also use StringJoin["Enter the ", ToString[k], " element"] , but I like Row better.)

Mathematica 2D Heat Equation Animation

懵懂的女人 提交于 2019-12-06 10:22:43
I'm working on mapping a temperature gradient in two dimensions and having a lot of trouble. My current approach is to define an Interpolating Function and then try to graph it a lot of times, then animate that table of graphs. Here's what I have so far: RT = 388.726919 R = 1 FUNC == NDSolve[{D[T[x, y, t], t] == RT*(D[T[x, y, t], x, x] + D[T[x, y, t], y, y]), T[x, y, 0] == 0, T[0, y, t] == R*t, T[9, y, t] == R*t, T[x, 0, t] == R*t, T[x, 9, t] == R*t}, T, {x, 0, 9}, {y, 0, 9}, {t, 0, 6}] So the first two variables just control the rate of change. The equation I'm solving is the basic 2D heat

Caching of data in Mathematica

南笙酒味 提交于 2019-12-06 09:57:33
问题 there is a very time-consuming operation which generates a dataset in my package. I would like to save this dataset and let the package rebuild it only when I manually delete the cached file. Here is my approach as part of the package: myDataset = Module[{fname, data}, fname = "cached-data.mx"; If[FileExistsQ[fname], Get[fname], data = Evaluate[timeConsumingOperation[]]; Put[data, fname]; data] ]; timeConsumingOperation[]:=Module[{}, (* lot of work here *) {"data"} ]; However, instead of

Can relative size changes be made to PointSize[], Thickness[] in mathematica?

拟墨画扇 提交于 2019-12-06 08:21:14
Arising from this question regarding line thickness and point size setting [e.g. PointSize[Large} , PointSize[0.5] ), I was wondering if it is feasible to change PointSize[] , Thickness[] etc in a relative manner? I.e. why is it that PointSize[Larger] doesn't work? Or is possible to somehow query the existing pointsize and perhaps do something like PointSize[1.25*GetPointSize[]] (I haven't been able to figure this out if something like "GetPointSize[]" exists, neither with a quick look at the documentation, nor from a quick reverse-engineering look at PointSize[x]) You can do this using the

Where are typesetting shortcuts like :sub: defined?

点点圈 提交于 2019-12-06 07:12:18
问题 In particular, is there a way to add a shortcut like :nsub: to \[NotSubset] ? 回答1: For \[NotSubset] the default alias is ⋮!sub⋮ . Of course, as mentioned in HPMark's answer, if you're not happy with that you can either change the InputAliases for the current Notebook: oldOpts = InputAliases /. Options[EvaluationNotebook[], InputAliases] SetOptions[EvaluationNotebook[], InputAliases -> Append[oldOpts, "nsub" -> "\[NotSubset]"]] Or, probably a better approach is to use the Option Inspector to

$Assumption for multiple variables

℡╲_俬逩灬. 提交于 2019-12-06 06:35:08
问题 I want to restrict my variables to certain ranges for my entire notebook, is there a way I can do that in one go without entering a different $assumption line for every variable? Edit: I want to define the domain of variables for all calculations in my notebook (googling helped me frame my needs better!) 回答1: If all of your variables are going to be (for example) Real , then you can intercept the creation of new symbols and add that assumption to $Assumptions . E.g. $Assumptions = True;

ode integration in python versus mathematica results

眉间皱痕 提交于 2019-12-06 06:15:32
问题 Edit: So I found out that NDSolve for ODE is using Runge Kutta to solve the equations. How can I use the Runge Kutta method on my python code to solve the ODE I have below? From my post on text files with float entries, I was able to determine that python and mathematica immediately start diverging with a tolerance of 10 to the negative 6. End Edit For last few hours, I have been trying to figure out why my solutions in Mathematica and Python differ by 5000 something km . I am led to believe

Getting coordinates of manually drawn points

五迷三道 提交于 2019-12-06 06:09:47
问题 I have a graph as a result of executing ListPlot[] function. I can manually edit this graph by moving points to a different location and also adding new points using the Drawing Tools. How do I get the coordinates of new and changed points from the edited graphics? 回答1: This approach makes every data point a locator that can be moved. New locators can be added and old ones deleted as appropriate. The best fit and variance are updated after every change. Here's some data of some exponential