Tag Info

Hot answers tagged

39

I dug up some simple analog circuit design definitions that I sometimes use to make diagrams for classes or problem sets. Mathematica is obviously very useful when you have to create iterative copies of circuit elements, as in this example (a chain of resistor-capacitor elements): Since this is for teaching purposes and not professional, you may forgive ...


28

Rather than answering your question as posed, let me instead save you the effort of writing such a function and at the same time demonstrate how it can be done by posting some code that I've already written for this purpose: BeginPackage["CovariancePropagation`"]; Unprotect[var, cov]; ClearAll[var, cov]; SetAttributes[var, HoldAll]; SetAttributes[cov, ...


19

You asked for alternative approaches to what you did, so here is one: A completely different approach to the one-dimensional time-independent Schrödinger equation would be to use matrix techniques. The idea is to eliminate the need for NDSolve entirely. For bound-state problems, you can do this by choosing a basis satisfying the condition of vanishing wave ...


15

I just had a look at the colours as they are produced on my screen. I have been working with lasers for many (30+) years and can assure you that a 591nm laser line is fairly yellow, around 635nm is fairly red and 488nm appears as cyan, which resembles the colours of the disks well. Are you sure you are not confusing the wavelength of the maximum of black ...


14

It is probably a common student misconception that it is "such a complex function". In actuality, it is quite simple. You should read: A pedagogical example: the Mexican hat potential. Very roughly you get the Mexican hat from interplay between two power functions: a x^4 and b x^2. If parabola b x^2 is inverted you get a bump in the center of your a x^4 ...


14

SystemModeler is one of the Wolfram products that allows building and simulating complex electric circuits - stand alone or as coupled to other systems, like thermodynamic or mechanical ones. Also did you see the following Mathematica based application: Analog Insydes? It is compatible with Mathematica 8. They I think not only visualize but also analyze ...


14

(too long for a comment) Plot[{ColorData["VisibleSpectrum"][x][[1]], ColorData["VisibleSpectrum"][x][[2]], ColorData["VisibleSpectrum"][x][[3]]}, {x, 380, 750}, PlotStyle -> {Red, Green, Blue}] It doesn't seem that you'll be able to obtain Yellow (RGBColor[1, 1, 0]) from ColorData["VisibleSpectrum"]; unfortunately, the docs say nothing ...


13

That's a good question. There does seem to be a considerable discrepancy versus the 1931 CIE diagram: GraphicsGrid @ List @ Table[ Graphics @ {ColorData["VisibleSpectrum"][i], Disk[], White, Text[i]}, {i, 380, 700, 10} ] Perhaps there was a miscalculation made in reducing the very large CIE color space values to sRGB triplets? sRGB, the ...


13

It took me quite a while, but finally, here's a visualization of the perigee of Flamsteed's comet: I should first note two things: first, some of the needed data for computing the orbit of comet C/1683 O1 was missing in AstronomicalData["CometC1683O1", "Properties"], and I had to pull information from external sources to supplement the information ...


12

By default, Mathematica assumes symbols to be complex. However the elements on the main diagonal of a Hermitian matrix are necessarily real. To force Mathematica to interpret the elements on diagonal of m to be real you could replace them by their real part, i.e. m = {{Re[n], a, b, b}, {Conjugate[a], Re[n], b, b}, {Conjugate[b], Conjugate[b], Re[c], ...


12

noeckel’s answer on StackOverflow is spot on. This is not a Mathematica issue, this is a mathematical issue. Namely, Mathematica is giving you the correct solution to the system of differential equation and boundary conditions given. The conditions given (and in particular the derivative imposed at the origin) are incompatible with the expected decay. Bear ...


12

Perhaps what you're looking for is something like this: Module[{x, a, b}, x[1] = 1; x[2] = 10; a + b/x[2] + x[1] ] $\text{a$\$$3026}+\frac{\text{b$\$$3026}}{10}+1$ Here I defined a single additional local variable x but then refer to "indexed" variables sharing the same name and differing only in the index x[1] and x[2] etc. These indices are ...


12

One way is to set up a DAE: See tutorial/DSolveExamplesOfDAEs and example/ModelConstrainedSystemsAsDAEs. The constraint that the driver (bottom rotating link) has a fixed length is taken care of by initial conditions and the DE. There are two possible starting positions for the driven link. One might have to inspect the result of Solve to determine which ...


11

Here is the Mathematica proof. I'll leave out the prefactor $\hbar/i$ for simplicity. Also, in case this is a homework problem, I decided not to add too many comments to the code. Instead I'll let you figure it out. The basic idea is to do cross products and gradients in spherical coordinates. The calculation shown here actually gives you a way to calculate ...


11

A reasonable alternative, is to construct an explicitly Hermitian matrix by exploiting the fact that any matrix, $M$, can be written as the sum of a Hermitian matrix, $H$, and a skew-Hermitian (or anti-Hermitian, if your in physics) matrix, $S$. This implies that a matrix can be made Hermitian simply by $$H = \frac{1}{2}(M + M^\dagger)$$ or skew-Hermitian ...


11

This is a bug (or an imperfection) of ColorData["VisibleSpectrum"]. Others have delved into its root, but in my answer I simply will make it clear by a comparison with an experimental, known single wavelength color[1]: sodium’s D-line at 589.0 nm. Here is Mathematica’s idea of the color of this wavelength, using default settings (no color profile ...


11

A convenient resource for the Miller Indices can be found here. This ref provides sufficient information for us to draw the (111) and (110) planes. First, reproduce the graphic from the demonstration. I just made the necessary changes to make it run outside of a Manipulate and did not try to optimize it. tet = PolyhedronData["Tetrahedron", "Faces"]; tetv ...


10

So you guys know - quasicrystals are cool structures that can consist of finite number of parts which can be arranged in never repeating - aperiodic - pattern. Thing here is called projection method from a regular lattice. http://www.nature.com/nmat/journal/v3/n11/fig_tab/nmat1244_F3.html Interestingly if you know Fibonacci rabbits problem - that is also ...


9

If the potential is $(\tanh (x)+1) (\tanh (x)-1)$ you can obtain the analytic solution using Mathematica as follows: [I have omitted some of the detail - e.g. the asymptotic expansions - because the details are analogous to the simple harmonic oscillator case in my previous answer (see above).] Define the potential. u[x_] = (1 + Tanh[x]) (-1 + Tanh[x]) ...


9

First take a sample of the real image to get the right color mix: ii = Import@"http://tsgphysics.mit.edu/pics/Q%20Diffraction/Q2-Single-Slit-Diffraction.jpg"; h = ImageTake[ii, {366, 402}, {373, 543}] hd = Transpose[(ImageData@h)[[IntegerPart[ImageDimensions[h][[2]]/2]]]]; Let's see the color curves. It's easy to see that the Red channel is the triple ...


9

I did a solution with contour tracing on the distance function. It gets pretty unstable sometimes, but it's a fun question to experiment with interactivity. DynamicModule[{p1 = {0, 2}, p2 = {1, 3}, angles = {0, 0}, distance, grad, tangent}, distance[a1_, a2_] := Norm[{Cos@a1, Sin@a1} - (Norm[p2 - p1] {Cos@a2, Sin@a2} + p1)]; grad = ...


8

The code in the article linked by Alexey produces something similar to this (gradient plot inspired by J.M.'s comment) : Note though that the description of the code does not seem consistent too me, so I had to change it in some places to get this result. Still I hope that I transcribed it more or less correctly. (I wouldn't use this for scientific ...


8

In the recent version of Mathematica (version 9), An "approximate" solution to the graph realization problem can be obtained by tuning the repulsive/attractive force in the SpringElectricalEmbedding via EdgeWeight: In[41]:= elength = {2, 4, 2, 4, 3, 4}; In[42]:= g = CompleteGraph[4, EdgeWeight -> elength, EdgeLabels -> "EdgeWeight", ...


8

Wolfram|Alpha is integrated in Mathematica. Integration based on function WolframAlpha. To learn basic interactive and programmatic usage see this question. In your case you can get formatted objects in Mathematica like: WolframAlpha["steam 135C", {{"PhaseDiagramTPPlot:ChemicalData", 1}, "Content"}, PodStates ...


8

You can still use box count, but doing it smarter :) Counting boxes with at least 1 white pixel from ImagePartition can be done more efficiently using Integral Image, a technique used by Viola-Jones (2004) in their now popular face recognition framework. For a mathematical motivation (and proof), Viola and Jones point to this source. Actually, someone ...


8

Here is a symbolic solution of your eigenvalue problem. Define the differential equation (setting $\hbar = \omega = m_0 = 1$). diffeq = -(1/2) \[Psi]''[x] + 1/2 x^2 \[Psi][x] == e \[Psi][x] Symbolically solve the differential equation. soln = DSolve[diffeq, \[Psi], x][[1, 1]] (* \[Psi] -> Function[{x}, C[2] ParabolicCylinderD[1/2 (-1 - 2 e), I ...


7

Please take a look at the new Symbolic Tensors functionality introduced in version 9. Specifically: Symbolic Tensors - guide Tensors - guide Symbolic Tensors - tutorial Tensor Symmetries - tutorial Symmetrized Arrays - tutorial To get started with basic examples read through this page: TensorProduct


6

As far as I know there's no reference book available yet that is using the new reliability functionality in Mathematica. Two other resources are: Reliability calculations for complex systems, academic thesis Reliability Mathematics, Wolfram Blog Those two focus on RBDs, Fault trees and system structures.


6

You can do this without a NDSolve by calculating the distance from the follower cranks joint to the end of the driving cranks end. Then use this distance with law of cosines to calculate the deviation angle. This is also pretty easy to implement on ANY hardware capable of doing a ArcCos and Atan2 operation (note that in c atan2 parameters are swapped). ...


5

A Hermitian matrix of dimension $N$ has $N^2$ real parameters. However, in the answer by rcollyer I see a larger number of parameters in the form of complex numbers (which means the representation isn't unique). In Heike's solution (which is from the documentation for HermitianMatrixQ) we have to write Re[n] on the diagonal which is OK in principle but ...



Only top voted, non community-wiki answers of a minimum length are eligible