Mathematica Asked on July 11, 2021
delFunc[funcform_, lstofparams_,lstoferrs_] := √Total[Table[(D[funcform, lstofparams[[i]]]*lstoferrs[[i]])^2, {i,Length[lstofparams]}]]
funcanderr[funcform_, lstofparams_,lstofvals_] := {funcform,delFunc[funcform, lstofparams, #[[2]] & /@ lstofvals]} /.Table[lstofparams[[i]] -> lstofvals[[i, 1]],{i,Length[lstofparams]}]
I want to evaluate the numerical value of "funcanderr" with some region of variables.
Suppose
funcform[x_,y_]:=(A*Sin[x y])+B
lst={{A,5,0.05},{B,8,0.08}
x = 45 Degree
y = 135 Degree
N[funcanderr[A*Sin[x y] + B, #[[1]] & /@ lst, #[[2 ;; 3]] & /@ lst]]
Result is
{12.8056, 0.0933241}
Now, how to evaluate "funcanderr" with the exclusion limit Pi/3<x<2Pi/3
; Pi/3<y<2Pi/3
within the range {{x,0,Pi},{y,0,Pi}}
Clear["Global`*"]
delFunc[funcform_, lstofparams_, lstoferrs_] := √Total[
Table[(D[funcform, lstofparams[[i]]]*lstoferrs[[i]])^2, {i, Length[lstofparams]}]]
funcanderr[funcform_, lstofparams_, lstofvals_] := {funcform,
delFunc[funcform, lstofparams, #[[2]] & /@ lstofvals]} /.
Table[lstofparams[[i]] -> lstofvals[[i, 1]], {i, Length[lstofparams]}]
cons = (0 <= x <= Pi/3 || 2 Pi/3 <= x <= Pi) && (0 <= y <= Pi/3 || 2 Pi/3 <= y <= Pi);
f[x_, y_] = ConditionalExpression[A*Sin[x y] + B, cons];
lst = {{A, 5, 0.05}, {B, 8, 0.08}};
g[x_, y_] = funcanderr[f[x, y], #[[1]] & /@ lst, #[[2 ;; 3]] & /@ lst]
Plot3D[Evaluate@g[x, y], {x, 0, Pi}, {y, 0, Pi},
PlotLegends -> Automatic]
Since the scales are significantly different, plotting the second function separately:
Plot3D[g[x, y][[2]], {x, 0, Pi}, {y, 0, Pi}]
Answered by Bob Hanlon on July 11, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP