Category Archives: Mathematica

Tooltip does not Label plotted variables

lmax=5.8;a=.804;
NDSolve[{PH'[l]==X[l]^2/a^3,PH[0]==0.,AR'[l]==Y[l] Cos[PH[l]],Y'[l]==Sin[PH[l]],Y[0]==0.,X'[l]==Cos[PH[l]],X[0]==0.,AR[0]==0},{PH,X,Y,AR},{l,0,lmax}];
{ph[u_],x[u_],y[u_],ar[u_]}={PH[u],X[u],Y[u],AR[u]}/.First[%];
ParametricPlot[{x[l],y[l]},{l,0,lmax}];
Plot[Tooltip[{ph[l],ar[l],  x  [l],y[l] }],{l,0,lmax}]

I prefer the Tootip to read labels ph,ar, x,y as named but not again echo the same “Interpolating Function” […]

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Tooltip does not Label plotted variables

lmax=5.8;a=.804;
NDSolve[{PH'[l]==X[l]^2/a^3,PH[0]==0.,AR'[l]==Y[l] Cos[PH[l]],Y'[l]==Sin[PH[l]],Y[0]==0.,X'[l]==Cos[PH[l]],X[0]==0.,AR[0]==0},{PH,X,Y,AR},{l,0,lmax}];
{ph[u_],x[u_],y[u_],ar[u_]}={PH[u],X[u],Y[u],AR[u]}/.First[%];
ParametricPlot[{x[l],y[l]},{l,0,lmax}];
Plot[Tooltip[{ph[l],ar[l],  x  [l],y[l] }],{l,0,lmax}]

I prefer the Tootip to read labels ph,ar, x,y as named but not again echo the same “Interpolating Function” […]

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Exclude elements from mapping

I have had this problem way too often and still have not found a solution, yet. The example is as follows:

numbers = Range[1, 50];
(numbers = Delete[numbers, 50 - #];
   #) & /@ numbers

Of course, this does not work as intended. The idea would be to get only the numbers from 1 to 25 as an output. But one cannot modify the part behind the /@. I am very aware of that. This shall only serve as an illustration of what I was hoping to find. Usually, the codes are more complex. But the problem remains the same: I want to exclude some elements from the mapping. But what elements I want to exclude is unclear during the initialization of the mapping.

So, my question is whether there is a known optimized solution to this problem. I have searched it but did not find anything.

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Exclude elements from mapping

I have had this problem way too often and still have not found a solution, yet. The example is as follows:

numbers = Range[1, 50];
(numbers = Delete[numbers, 50 - #];
   #) & /@ numbers

Of course, this does not work as intended. The idea would be to get only the numbers from 1 to 25 as an output. But one cannot modify the part behind the /@. I am very aware of that. This shall only serve as an illustration of what I was hoping to find. Usually, the codes are more complex. But the problem remains the same: I want to exclude some elements from the mapping. But what elements I want to exclude is unclear during the initialization of the mapping.

So, my question is whether there is a known optimized solution to this problem. I have searched it but did not find anything.

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Methods for producting alternating TickLabels in a Plot?

I am producing a plot which has alternating TickLabels. The ugly code I wrote to produce this was:

Ticks -> Table[{i, If[EvenQ[i], a, b]}, {i, Ceiling[#1], Floor[#2]}] &

Is there a shorter way to achieve this effect, perhaps using keywords like Automatic?

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Find the exact value of x-intercept [on hold]

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • “This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation.” – belisarius, Szabolcs, Leonid Shifrin, Michael E2, Mike Honeychurch

If this question can be reworded to fit the rules in the help center, please edit the question.

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Probability of multivariate normal being positive on each coordinate

How can I find the probability that each coordinate of a specified multivariate normal distribution is positive? I tried the following, which I believed should work

mu = {0, 0, 0};
sigma = {{2, 1, 1}, {1, 2, 1}, {1, 1, 2}};
Probability[
 x > 0 && y > 0 && z > 0, {x, y, z} \[Distributed] 
 MultinormalDistribution[mu, sigma]]

Unfortunately, for the output I just get the last line from the input (with mu and sigma replaced by their actual values). I don’t see where the problem could possibly be since the matrix is positive definite. If I replace it by the identity matrix everything works fine.

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Updating a GUI with ComboBox using GUIKit

Dear Mathematica users,

does anyone know how I can update my existing Gui window (made with GUIKit) by choosing different values of a ComboBox so that different and multiple TextFields etc appear depending on the current value of the ComboBox. The created TextFields should appear in the same window below the ComboBox and they should update once the value of the ComboBox is changed.

I appreciate any help

Thanks, Dennis

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

Simplify power of KroneckerDelta

Don’t employ the simplification rule suggested in another proposed answer, since it will yield incorrect answers in many cases:

FullSimplify[KroneckerDelta[x, y]^2 f[x, y]/KroneckerDelta[x, y]]

(* f[x, y] KroneckerDelta[x, y] *)

Correct.

But if you apply the above rule:

rule = KroneckerDelta[x_, y_]^n_ /; n > 0 -> KroneckerDelta[x, y];

to the numerator and denomiator:

myg[x, y] = KroneckerDelta[x, y]^2 f[x, y];
myh[x, y] = KroneckerDelta[x, y];

as here,

mynewg[x, y] = myg[x, y] /. rule;
mynewh[x, y] = myh[x, y] /. rule;

then the original term becomes

FullSimplify[mynewg[x, y]/mynewh[x, y]]

(* f[x, y] *)

Incorrect.

In short: leave the powers of the KroneckerDelta unaltered.

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

Recent Questions – Mathematica Stack Exchange

VectorPlot3D – vectors starting at points

[unable to retrieve full-text content]

Normally the vectors in VectorPlot3D ar attached the middle. How to get them attached at the beginning (what is typical conventions in most textbooks) by use of VectorPlot3D ?

Recent Questions – Mathematica Stack Exchange