## Plotting – Solving the 2D reaction diffusion with the Explicit Euler method

I'm trying to solve the following 2D diffusion equation (I wrote it in Word to make it look nice)

(Note: I solve that for a 100×100 mesh point)

I tried to solve the above equation with the following code:

``````s1 = NDSolve[{D[u[t, x, y]t]==
D[u[t, x, y], x, x]+ D[u[t, x, y], y, y]+ 3 * Tanh[u[t, x, y]],
u[0, x, y] == Sin[([Pi] x) / 5]sin[(2 [Pi] y) / 5],
u[t, -5, y] == 0, u[t, 5, y] == 0, u[t, x, -5] == 0,
u[t, x, 5] == 0}, u, {t, 0, 6}, {x, -5, 5}, {y, -5, 5},
Method -> {"FixedStep", Method -> "ExplicitEuler"},
MaxStepFraction -> 10000, WorkingPrecision -> MachinePrecision
``````

This leads to the consistent error of:

``````NDSolve :: eerr
Warning: scaled local spatial error estimate of 26.30473550335526` at
t = 6.` in the direction of the independent variable x is much larger
as the prescribed fault tolerance. Grid spacing with 15 points can
too big to achieve the desired accuracy or accuracy. ON
Singularity may have formed or a smaller pitch may be
with the options of the MaxStepSize or MinPoints method.
``````

I also tried to specify a startup step size in my NDSolve, but that did not help. What are the best methods for numerically solving PDEs in Mathematica? So far, it seems pretty picky to me.

I also want to visualize the above equation so that it is displayed for a professional presentation (preferably as a movie).

This is the code I found for the following problem:

``````a = table[
Plot3D[u[t, x, y] /. s1, {x, -5, 5}, {y, -5, 5}, mesh -> 100,
PlotRange -> All,
ColorFunction -> function[{x, y, z}, Hue[.3 (1 - z)]]], {t, 0, 6}]
``````

But if I export it as .gif or Mov'It does not go well. In general, how do you interpret 2D parabola, elliptic, and hyperbolic equations in Mathematica to be specific to a presentation?

I apologize for the number of questions I have asked in this post, but really want to give a good presentation!

## Algorithms – Nesting Name for Nested Loop Variable and Mat File Name for Plotting (Matlab)

I have the following:
1 different matte files, which users refer to as Ref1.mat, haapy.mat, 123.mat, and so on
2 – Each Mat file contains variable names and numbers such as R3 = 0.45, G3 = 4, B = 3.2, H = 24, L = 32, S = 0.32, and so on
I used a nested loop to load the Mat file. 1- filename 2-variable-name 3-variable-number

My questions:

1- my loop does not load all variable data from all files, d. H. If I have 21 Mat files and each file has 9 variable data, that means 21×9 = 189 dates. Apparently, my code only loads 21 variable data instead of 189. Help estimate?
2- I am trying to record all data in the mats files as subplots for comparisons, i. H. R, G, B as a graphic, R Vs. G, sprinkle H Vs. S, H Vs. L. I have tried different plots, surf syntax, to include them in the loop so that each assigned variable data is plotted from each mat file, but not a success. Help appreciated?
3- Finally, I try to give the name of the mats file at each point shown in each diagram.

Please take a look at the attached image as an example of how I want to show the individual points to their named file

clear
Pathname = Uigetdir;
AxesH = Axes (& # 39; NextPlot & # 39 ;, & # 39; Add & # 39;);
file_all = dir (fullfile (pathname, & # 39; * mat & # 39;));
matfile = file_all ([file_all.isdir] == 0);

``````allData = cell (size (file_all));

N = length (file_all);
``````

File name = cell (N, 1);

matfile = file_all ([file_all.isdir] == 0);
% clear file_all pathname

for ii = 1: length (file_all)

``````for i = 1: N

for iii = 1: length (Matfile)
``````

% aFileData = load (files (ii) .name);
% allData {ii} = aFileData.r3;
aFileData = load (file_all (ii) .name);
% Names of the stored variables:
variableNames = field names (aFileData);
% use the first name and "dynamic field name", d. H. (…):
allData {ii} = aFileData (variable name {1});

% for i = 1: N
Filenames {i} = file_all (i) .name;
data = load (file_all (i) .name);

``````                                        % start with an empty array
% for iii = 1: length (matfile)
% If true

% iFile = 1: length (matfile)
% File = fullfile (sprintf (matfile, iFile));
``````

% Order (R3, G3, B3 & # 39; -o & # 39;)
% set (R (3), & # 39; facecolor & # 39 ;, g & # 39;)
% set (G (3), & # 39; facecolor & # 39 ;, & # 39; y & # 39;)
% set (B (3), & # 39; facecolor & # 39 ;, & # 39; y & # 39;
% set (H (4), & # 39; facecolor & # 39 ;, & # 39; r)
% n = num2str (R, # file #);
% for k = 5: 9
% Re = strcat (# 0,, num2str (k), # 0 #);
The End
The End
The End

## Plotting – Vertical areas of the bar charts in 12

Version 12 includes a new one `Layout-> Column` Option for ListPlot, where multiple charts are aligned to share a single horizontal axis. It seemed very useful at first. However, data compared in this way can have very different vertical scales.

It seems that the new function always sets the PlotRange of all records to the same value:

``````d1 = table[{x, .1 Sin[x]}, {x, 0, 3 Pi, Pi / 9}];

d2 = table[{x, Cos[x]}, {x, 0, 4 Pi, Pi / 7}];

ListLinePlot[{d1, d2}, PlotLayout -> "Column",
InterpolationOrder -> 2, GridLines -> Automatic,
PlotRange -> Automatic]
``````

I've tried what makes sense to set the areas separately:

``````ListLinePlot[{d1, d2}, PlotLayout -> "Column",
InterpolationOrder -> 2, GridLines -> Automatic,
PlotRange -> {{Automatic, Automatic}, {Automatic, Automatic}}]

ListLinePlot[{d1, d2}, PlotLayout -> "Column",
InterpolationOrder -> 2, GridLines -> Automatic,
PlotRange -> {{Automatic, {-.1, .1}}, {Automatic, {-1, 1}}}]
``````

But none of these works. The first gives the same result and the second throws an error. Does anyone have a look into it?

## Plotting – FrameTicks in DateListPlot do not support "All" in Mathematica 12

In mathematica 12

``````DateListPlot[{1, 1, 2, 3, 5, 8, 11}, {2000, 8}, FrameTicks -> All]
``````

gives

And the error message is

A ticks specification worth FrameTicks should be None.
Automatic, a function or a list of ticks.

But "All" works in Mathematica 11. Is it a mistake?

If only `automatic` is supported. How can I add ticks to other pages of the frame?

## python – threading and plotting in real time

I have a script with the following threads with locks:

``````threadCriticalControl = threading.Lock ()

while (true):

continue
otherwise:

safeguard.daemon = true
safeguard.start ()

altimeter.daemon = true
altimeter.start ()
``````

where the `data safeguard` is a writing function in a txt file and the `HöhenmesserPloter` the plot function, which takes a new value from each loop of the `while`, the first function works, but within the second one has one `plt.show ()` which theoretically blocks the execution, but what works `exception` Threads and even with the `plt.show (block = false)` still persists, then is it possible to plot with threading in real time?

## Plotting – Some fat curves in the live portrait

How can we emphasize curves with different colors in the phase portrait representation?

I am trying to solve the ODES system but could not produce any output.

``````f1[n_, H_] : = 3 * n * H * ([Beta]* H ^ ([Alpha] - 1) - 1);
f2[n_, H_] : = -3 / 2 * H ^ 2 + 1/2 * [Tau]* n ^ (5/3) * E ^ ((2 * A * n) /
3) * (([Beta]* H ^ ([Alpha] - 1) - 1) * (A * n + 5/2) + 3/2) +
1/2 *[Beta]* n * H ^ ([Alpha] - 1) * (m - 2 * B * n) + 1/2 * B * n ^ 2;

A = 0.01; B = 10; m = 100; [Tau] = 14; [Beta] = 0.02; [Alpha] = 2;
sp = StreamPlot[{3*n*H*([{3*n*H*([{3*n*H*([{3*n*H*([Beta]* H ^ ([Alpha] -1) -1), -3 / 2 · H ^ 2 +
1/2 *[Tau]* n ^ (5/3) * E ^ ((2 * A * n) /
3) * (([Beta]* H ^ ([Alpha] - 1) - 1) * (A * n + 5/2) + 3/2) +
1/2 *[Beta]* n * H ^ ([Alpha] - 1) * (m - 2 * B * n) + 1/2 * B * n ^ 2}, {n, 0,
120}, {H, -65, 65}, Frame -> True, ImageSize -> 250, Axis -> True,
FrameLabel -> {Row[{Style["n(t)", {10, Italic}]}],
style["H(t)", {10, Italic}],
line[{Style["[{Style["[{Stil["[{Style["[Tau] = 14 ", {10, Italics}]}]}]Equation 1 = n & # 39;
Equation 2 = H & # 39;
3) * (([Beta]* H
1/2 *[Beta]* n

solution[n0_?NumericQ] : = First @ NDSolve[{Eq1, n[0] == n0, equation 2, H.[0] == n0}, {n, H}, {t, -5, 5}];

show[spParametricPlot[Rate[{N[spParametricPlot[Evaluate[{N[spParametricPlot[Bewerten[{n[spParametricPlot[Evaluate[{n
PlotRange -> All, MaxRecursion -> 8, AxesLabel -> {"n", "H"}, PlotStyle -> Red]]
``````

## Plotting – problem with the fit

I'm trying to find a matching match function for the following record:

``````xyzValues ​​= Import["nC_Q4.csv", "Data"][[8 ;;, {6, 9, 38}]]{{0, 0, 2,0004}, {0, 100, 0}, {0, 40, 0}, {0, 140, 0}, {0, 60, 0}, {0,
80, 0}, {0, 120, 0}, {0, 20, 0}, {0, 160, 0}, {0, 180, 0}, {0, 240,
0}, {0, 220, 0}, {0, 200, 0}, {0, 260, 0}, {0, 280, 0}, {0, 300,
0}, {0, 320, 0}, {0, 340, 0}, {0, 360, 0}, {0, 400, 0}, {0, 380,
0}, {0, 440, 0}, {0, 420, 0}, {0, 460, 0}, {5, 0, 1.1607}, {5, 20,
0}, {5, 40, 0}, {5, 60, 0}, {5, 80, 0}, {5, 100, 0}, {0, 480,
0}, {0, 500, 0}, {5, 120, 0}, {5, 140, 0}, {5, 160, 0}, {5, 180,
0}, {5, 200, 0}, {5, 240, 0}, {5, 220, 0}, {5, 260, 0}, {5, 280,
0}, {5, 300, 0}, {5, 320, 0}, {5, 340, 0}, {5, 360, 0}, {5, 380,
0}, {5, 400, 0}, {5, 420, 0}, {10, 20, 0}, {5, 440, 0}, {10, 0,
0.480288}, {5, 460, 0}, {10, 60, 0}, {5, 480, 0}, {5, 500, 0}, {10
40, 0}, {10, 80, 0}, {10, 100, 0}, {10, 120, 0}, {10, 140, 0}, {10
160, 0}, {10, 180, 0}, {10, 200, 0}, {10, 220, 0}, {10, 240,
0}, {10, 260, 0}, {10, 280, 0}, {10, 300, 0}, {10, 320, 0}, {10,
340, 0}, {10, 360, 0}, {10, 380, 0}, {10, 400, 0}, {10, 420,
0}, {10, 460, 0}, {10, 480, 0}, {10, 440, 0}, {15, 0, 0.5003}, {10
500, 0}, {15, 20, 0}, {15, 40, 0}, {15, 60, 0}, {15, 100, 0}, {15,
80, 0}, {15, 120, 0}, {15, 140, 0}, {15, 160, 0}, {15, 180, 0}, {15,
200, 0}, {15, 220, 0}, {15, 240, 0}, {15, 260, 0}, {15, 280,
0}, {15, 300, 0}, {15, 320, 0}, {15, 340, 0}, {15, 360, 0}, {15
380, 0}, {15, 400, 0}, {15, 420, 0}, {15, 460, 0}, {15, 440,
0}, {15, 480, 0}, {15, 500, 0}, {20, 0, 0.520104}, {20, 20, 0}, {20
40, 0}, {20, 60, 0}, {20, 80, 0}, {20, 100, 0}, {20, 120, 0}, {20,
140, 0}, {20, 160, 0}, {20, 180, 0}, {20, 200, 0}, {20, 220,
0}, {20, 240, 0}, {20, 260, 0}, {20, 280, 0}, {20, 300, 0}, {20,
320, 0}, {20, 340, 0}, {20, 360, 0}, {20, 380, 0}, {20, 400,
0}, {20, 420, 0}, {20, 440, 0}, {20, 460, 0}, {20, 480, 0}, {20,
500, 0}, {25, 0, 0.998039}, {25, 20, 0}, {25, 40, 0}, {25, 80,
0}, {25, 60, 0}, {25, 100, 0}, {25, 120, 0}, {25, 140, 0}, {25, 160,
0}, {25, 180, 0}, {25, 200, 0}, {25, 220, 0}, {25, 240, 0}, {25
260, 0}, {25, 280, 0}, {25, 300, 0}, {25, 320, 0}, {25, 340,
0}, {25, 360, 0}, {25, 380, 0}, {25, 400, 0}, {25, 420, 0}, {25
440, 0}, {25, 480, 0}, {25, 460, 0}, {25, 500, 0}, {30, 0,
2.36047}, {30, 20, 0}, {30, 40, 0}, {30, 60, 0}, {30, 80, 0}, {30
100, 0}, {30, 120, 0}, {30, 140, 0}, {30, 160, 0}, {30, 180,
0}, {30, 200, 0}, {30, 220, 0}, {30, 240, 0}, {30, 260, 0}, {30
280, 0}, {30, 300, 0}, {30, 320, 0}, {30, 340, 0}, {30, 360,
0}, {30, 380, 0}, {30, 400, 0}, {30, 420, 0}, {30, 440, 0}, {30
460, 0}, {30, 480, 0}, {30, 500, 0}, {35, 0, 14, 943}, {35, 20,
0}, {35, 40, 0}, {35, 60, 0}, {35, 80, 0}, {35, 100, 0}, {35, 120,
0}, {35, 140, 0}, {35, 160, 0}, {35, 180, 0}, {35, 200, 0}, {35,
220, 0}, {35, 240, 0}, {35, 260, 0}, {35, 280, 0}, {35, 300,
0}, {35, 320, 0}, {35, 340, 0}, {35, 360, 0}, {35, 380, 0}, {35,
400, 0}, {35, 420, 0}, {35, 440, 0}, {35, 460, 0}, {35, 480,
0}, {35, 500, 0}, {40, 0, 28.6972}, {40, 20, 0}, {40, 40, 0}, {40,
60, 0}, {40, 80, 0}, {40, 100, 0}, {40, 120, 0}, {40, 140, 0}, {40,
160, 0}, {40, 180, 0}, {40, 200, 0}, {40, 220, 0}, {40, 240,
0}, {40, 260, 0}, {40, 280, 0}, {40, 320, 0}, {40, 300, 0}, {40,
340, 0}, {40, 360, 0}, {40, 380, 0}, {40, 400, 0}, {40, 420,
0}, {40, 440, 0}, {40, 460, 0}, {40, 480, 0}, {40, 500, 0}, {45, 0,
34.7878}, {45, 20, 0}, {45, 40, 0}, {45, 60, 0}, {45, 80, 0}, {45,
100, 0}, {45, 120, 0}, {45, 140, 0}, {45, 160, 0}, {45, 180,
0}, {45, 200, 0}, {45, 220, 0}, {45, 240, 0}, {45, 260, 0}, {45,
280, 0}, {45, 300, 0}, {45, 320, 0}, {45, 340, 0}, {45, 360,
0}, {45, 380, 0}, {45, 400, 0}, {45, 420, 0}, {45, 440, 0}, {45,
460, 0}, {45, 480, 0}, {45, 500, 0}, {50, 0, 39.7718}, {50, 20,
0}, {50, 40, 0}, {50, 60, 0}, {50, 80, 0}, {50, 100, 0}, {50, 120,
0}, {50, 140, 0}, {50, 160, 0}, {50, 180, 0}, {50, 200, 0}, {50,
220, 0}, {50, 260, 0}, {50, 240, 0}, {50, 280, 0}, {50, 300,
0}, {50, 320, 0}, {50, 340, 0}, {50, 360, 0}, {50, 380, 0}, {50,
400, 0}, {50, 420, 0}, {50, 440, 0}, {50, 460, 0}, {50, 480,
0}, {50, 500, 0}, {55, 0, 47.2884}, {55, 20, 0}, {55, 40, 0}, {55,
60, 0}, {55, 80, 0}, {55, 100, 0}, {55, 120, 0}, {55, 140, 0}, {55,
160, 0}, {55, 180, 0}, {55, 200, 0}, {55, 220, 0}, {55, 240,
0}, {55, 260, 0}, {55, 280, 0}, {55, 300, 0}, {55, 320, 0}, {55,
340, 0}, {55, 360, 0}, {55, 400, 0}, {55, 380, 0}, {55, 420,
0}, {55, 440, 0}, {55, 460, 0}, {55, 480, 0}, {55, 500, 0}, {60, 0,
62,3125}, {60, 20, 0,22022}, {60, 40, 0}, {60, 60, 0}, {60, 80,
0}, {60, 100, 0}, {60, 120, 0}, {60, 140, 0}, {60, 160, 0}, {60
180, 0}, {60, 200, 0}, {60, 220, 0}, {60, 240, 0}, {60, 260,
0}, {60, 280, 0}, {60, 300, 0}, {60, 320, 0}, {60, 340, 0}, {60
360, 0}, {60, 380, 0}, {60, 400, 0}, {60, 420, 0}, {60, 460,
0}, {60, 440, 0}, {60, 480, 0}, {60, 500, 0}, {65, 0, 74.2594}, {65,
20, 0,26026}, {65, 40, 0,020016}, {65, 60, 0}, {65, 80, 0}, {65
100, 0}, {65, 120, 0}, {65, 140, 0}, {65, 160, 0}, {65, 180,
0}, {65, 200, 0}, {65, 220, 0}, {65, 240, 0}, {65, 260, 0}, {65,
280, 0}, {65, 300, 0}, {65, 320, 0}, {65, 340, 0}, {65, 360,
0}, {65, 380, 0}, {65, 400, 0}, {65, 420, 0}, {65, 440, 0}, {65,
460, 0}, {65, 480, 0}, {65, 500, 0}, {70, 0, 79, 4559}, {70, 20,
1.60128}, {70, 40, 0.0800641}, {70, 60, 0.020004}, {70, 80, 0}, {70,
100, 0}, {70, 140, 0}, {70, 120, 0}, {70, 160, 0}, {70, 200,
0}, {70, 180, 0}, {70, 220, 0}, {70, 240, 0}, {70, 260, 0}, {70,
280, 0}, {70, 320, 0}, {70, 300, 0}, {70, 340, 0}, {70, 360,
0}, {70, 380, 0}, {70, 400, 0}, {70, 420, 0}, {70, 440, 0}, {70,
460, 0}, {70, 480, 0}, {70, 500, 0}, {75, 0, 86, 9348}, {75, 20,
7,30146}, {75, 40, 1,96196}, {75, 60, 0,720144}, {75, 80,
0.46046}, {75, 100, 0.160096}, {75, 120, 0.080016}, {75, 140,
0.020008}, {75, 160, 0.020008}, {75, 180, 0.020012}, {75, 200,
0,020012}, {75, 220, 0,020012}, {75, 240, 0}, {75, 260, 0}, {75,
300, 0}, {75, 280, 0}, {75, 320, 0}, {75, 340, 0}, {75, 360,
0}, {75, 380, 0}, {75, 400, 0}, {75, 420, 0}, {75, 440, 0}, {75,
460, 0}, {75, 480, 0}, {75, 500, 0}, {80, 0, 91, 4783}, {80, 20,
13, 1653}, {80, 40, 7, 70308}, {80, 80, 4.0208}, {80, 60,
5, 48439}, {80, 120, 2,84114}, {80, 100, 3,22064}, {80, 140,
2.60104}, {80, 160, 1.80216}, {80, 180, 1.86037}, {80, 200,
1,36054}, {80, 220, 1,24149}, {80, 240, 1,08065}, {80, 260
1,04021}, {80, 280, 0,960,384}, {80, 300, 0,860,861}, {80, 320,
1,0004}, {80, 340, 0,80016}, {80, 360, 0,720432}, {80, 380
0.540432}, {80, 400, 0.480673}, {80, 420, 0.40032}, {80, 440,
0.20008}, {80, 480, 0.380076}, {80, 460, 0.460184}, {80, 500
0,460,276}, {85, 0, 94,2188}, {85, 20, 22.0332}, {85, 40
12,2649}, {85, 60, 9,26371}, {85, 80, 7,78156}, {85, 100
7,14572}, {85, 120, 5,84117}, {85, 140, 5, 58447}, {85, 180
4,90,196}, {85, 160, 5,32106}, {85, 200, 4,5209}, {85, 220
4,5209}, {85, 240, 4,74095}, {85, 260, 4,18167}, {85, 280,
3.80076}, {85, 300, 3.92392}, {85, 320, 3.72223}, {85, 340,
3,64073}, {85, 360, 3,38068}, {85, 380, 3.5007}, {85, 400,
3.36336}, {85, 420, 3.14126}, {85, 440, 3.02181}, {85, 460,
2,70054}, {85, 480, 3,02242}, {85, 500, 2,90174}, {90, 0,
95, 7592}, {90, 20, 33, 13333}, {90, 60, 18, 1709}, {90, 40,
22.1689}, {90, 80, 15.8358}, {90, 100, 13.9856}, {90, 120,
12,7826}, {90, 140, 12,0272}, {90, 160, 10,024}, {90, 180
10,8643}, {90, 200, 9,60192}, {90, 220, 8,80528}, {90, 240
8.30332}, {90, 260, 8.64173}, {90, 280, 7.74465}, {90, 300
7,40148}, {90, 320, 7,92317}, {90, 340, 7,48899}, {90, 360,
6,7427}, {90, 380, 6,82546}, {90, 400, 6,2425}, {90, 420
6,76135}, {90, 440, 6,40512}, {90, 460, 6,84137}, {90, 480
5, 54222}, {90, 500, 6, 16246}, {95, 0, 97, 4795}, {95, 20,
42.9972}, {95, 40, 31.8191}, {95, 60, 28.6657}, {95, 80,
25,6903}, {95, 100, 22,8337}, {95, 120, 21,733}, {95, 140,
20, 1201}, {95, 160, 18, 6074}, {95, 180, 18, 6875}, {95, 200,
17.3635}, {95, 220, 17.1869}, {95, 240, 16.6433}, {95, 260,
15,6062}, {95, 280, 15,3954}, {95, 300, 14,8118}, {95, 320
15.3985}, {95, 340, 14.1657}, {95, 360, 14.9439}, {95, 380,
14,5229}, {95, 400, 14 8684}, {95, 420, 13, 56681}, {95, 440,
13,4454}, {95, 460, 12.7051}, {95, 480, 13.5227}, {100, 0,
98,3397}, {95, 500, 13,2653}, {100, 20, 52.0416}, {100, 40
43, 1773}, {100, 60, 38, 2153}, {100, 80, 34, 9079}, {100, 100
32,0328}, {100, 120, 30,5506}, {100, 140, 29,3729}, {100, 160
29,0407}, {100, 180, 27,0908}, {100, 200, 26,4853}, {100, 220
25,8252}, {100, 240, 25,245}, {100, 280, 24,1697}, {100, 260
25,4152}, {100, 300, 25,2752}, {100, 320, 22,8646}, {100, 340
23,0246}, {100, 360, 22,0888}, {100, 380, 22,2467}, {100, 400
23,3247}, {100, 420, 22,9892}, {100, 440, 21,0242}, {100, 460,
20.9284}, {100, 480, 21.8775}, {100, 500, 19.6035}}
``````

Which has dimensions

``````Dimensions[xyzValues]

{546, 3}
``````

At first I tried to show this point in a contour diagram:

``````ListContourPlot[xyzValues, PlotLegends -> Automatic,
ColorFunction -> "Rainbow", PlotRange -> {{0, 100}, {0, 150}}]
``````

However, this result does not reflect the data points (see, for example, data in the empty area of ​​the diagram). I'm probably missing something, but the plot should be different.
Draw these points with a different mathematical framework:

If I observe these two graphs, I do not know how to calculate a good mathematical function to match these data points. I have made an approach

``````Model = a + bx + cx ^ 2 + d Exp[-x] + ey + fy ^ 2 + gxy + exp[-y] H;

fit
FindFit[xyzValues, model, {a, b, c, d, e, f, g, h}, {x, y}]

{a -> -2.75705, b -> -0.196263, c -> 0.00570384,
d -> -4.9015, e -> 0.01131326, f -> 0.0000346097, g -> -0.000773403,
h -> 38,7327}
``````

and plot this feature:

``````show[{Plot3D[Evaluate[model /. fit], {x, 0, 100}, {y, 0, 150},
PlotStyle -> Opacity[0.8]],
Graphics3D[{Red, PointSize[.025], Map[Point, xyzValues]}]}]
``````

However, there seems to be a rapprochement with many mistakes. I want to get a function with fewer errors, if possible an expression that interpolates the data points.

greetings

## Solving a system of differential equations and plotting

I'm new to Mathematica and struggle with this exercise of the seed problem:
Two equations with conditions

• $$x_1$$# = -2$$x_1$$-3$$x_2$$+ cos (5 t)
• $$x_2$$& # 39; = –$$x_1$$-5$$x_2$$+ sin (10 t)
• $$x_1$$(0) = 1
• $$x_2$$(0) = -1

Then I have to create the graph of R (t) = √ ($$x_1$$^ 2 +$$x_2$$^ 2)
For 0 ≤ t ≤ 10
So far I have this code, but the graph appears blank.

``````Solution = NDSolve[
{x1'
x2 & # 39;
x1[0] == 1, x2[0] == -1},
{x1, x2},
{t, 0, 10}
]X = x1
Y = x2
z[t_] : = Sqrt[X[X[X[X
plot[z[z[z[z
``````

Thank you for any help.

## Plotting – Can not get a NonlinearModelFit

So I have to adjust certain data like this:

``````Data = {{0, -0,079}, {0,02, -0,083}, ..., {43,94, -0,025}, {43,96, -0,014}}
``````

However, when I try to use NonlinearModelfit, I get the following results:

``````nlm = nonlinearModelFit[datatorisione, a + b*Sin[x*c + d]{a, b, c, d}, x]FittedModel[-0.00197022-0.00100633 Sin[1.77963 +0.993503 x]]show[ListPlot[datatorisione],Plot[nlm[x], {x, 0,44}], Frame-> True]
``````

However, if I try to limit the amount of data to a single period $$x in [0,0.9]$$, the fit works well:

Someone can figure out why I do not get a good fit in the first case?

## Plotting – The gradient method in the vector field on the surface table does not work, the module is slow

For teaching purposes, I would like to create a vector field on a surface and visualize the path of the gradient method.

The surface and the gradient are generated with

``````f[x_, y_] : = Sin[x] cos[y];
GR[x_, y_] : = D[f[xx, yy], {{xx, yy}, 1}]/. {xx -> x, yy -> y};
a = 5;
xmin = -a; xmax = a;
ymin = -a; ymax = a;
nmax = 10;
mmax = 10;
dx = (xmax - xmin) / nmax;
dy = (ymax-ymin) / mmax;
grf = table[xi = xmin + i*dx; yj = ymin + j*dy;
v = {xi, yj};
w = v + Evaluate@gr[xi, yj];
arrow[{v, w}],
{i, 0, nmax}, {j, 0, mmax}];
pp = plot3D[f[x, y], {x, xmin, xmax}, {y, ymin, ymax}, Mesh -> None,
PlotStyle -> {Orange, Opacity[0.75]}]graphic[grf]
``````

The gradient field is also converted into a tangent vector field

``````pp = plot3D[f[x, y], {x, xmin, xmax}, {y, ymin, ymax}, Mesh -> None,
PlotStyle -> {Orange, Opacity[0.75]}];
grfplt = table[xi = xmin + i*dx; yj = ymin + j*dy;
v = {xi, yj, f[xi, yj]};
gg = gr[xi, yj];
w = v + {gg[[1]]gg[[2]]f[Xi+gg[Xi+gg[xi+gg[xi+gg[[1]], yy + gg[[2]]]};
{i, 0, nmax}, {j, 0, mmax}];
show[pp,grfplt]
``````

The paths of the gradient method should be generated with

``````gradmeth[f_, x0_, y0_] : =
table[xa = x0; ya = y0; gg = gr[xa, ya]; xb = xa + gg[[1]];
yb = ya + gg[[2]]; v = {xa, ya, f[xa, ya]};
w = {xb, yb, f[xb, yb]};
xa = xb; ya = yb;
{i, 0, 15}
];
show[pp, grfplt, gr1, gr2]
``````

But obviously the statement xa = xb; ya = yb; overwrite w every time.

That's why I used a module

``````gradmeth[f_, x0_, y0_, col_] : = Module[{xa, xb, ya, yb, gg, v, w, ll}
xa = x0; ya = y0; ll = {};
To the[i = 0, i <= 10, i ++,
gg = gr[xa, ya]; xb = xa + gg[[1]]; yb = ya + gg[[2]];
v = {xa, ya, f[xa, ya]};
w = {xb, yb, f[xb, yb]};
w}]}]]; *)
attach[ll, {col, Thick, Arrowheads[.05], Arrow[{v, w}]}];
xa = xb; ya = yb;
];
ll
]gr1 = Graphics3D[gradmeth[f, 2, 2, Red]];
gr2 = Graphics3D[gradmeth[f, -2, -1, Blue]];
show[pp, grfplt, gr1, gr2]
``````

This is very slow!

Can I repair the table approach?

Can I speed up the module approach?