Mathematica

Mathematica

  • All Sites
  • All Meta Sites

1 answer

Mathematica Fit to Polynomial does not work correctly

I am trying to fit data from a simulation to a polynomial. Luckily I do know the exact data and I know that my values are not bad at all! However, when trying to fit the data to a polynomial function ...

1 answer

Coloring a curve in the 3D space with CSV data

I've been struggling with this situation for days already and I would really appreciate a piece of advice. I have a simulation running in C++ and in the end I get a .csv file with 4 columns: t, ...

0 answers

Function returns right value and then adds null

Pell[0] = 0; Pell[1] = 1; Pell[n_] := Pell[n] = If[n >= 1, Return[2*Pell[n - 1] + Pell[n - 2]]; ]; This is my n-th pell's number finding function. It works fine, but it always returns ...

0 answers

How to code FOR within Interval correctly?

Help me please to write For correctly.. I've the 1-st step of algorithm and finally it outputs two intervals : 1)Interval[{1.25677,3.25203},{5.511,5.58272}] My problem is in the 2-nd step, because ...

0 answers

How to define procedures in Wolfram correctly?

Here is my algorithm for finding trailing zeros in n! Variables n = Number and zeros = 0 While n >= 1, Do n = Floor[n/5.] and zeros += n Print out zeros Most probably I am doing something wrong ...

1 answer

Mathematica Do/For loop with “Delete” or “Drop” does not work

initlNum453 = List[]; num1 = 2; (*Pt1, initial work to make initlNum full of good variables*) algorithmicNum = 1; For[i7 = 1, i7 <= (num1 + 1)^2, i7++, AppendTo[initlNum453, algorithmicNum]; ...

1 answers | Mar 28 at 14:51 by MicroClue on Stack Overflow stackoverflow.com
2 answers

How to define a function for later use in Mathematica

I'm just getting started on Mathematica and trying to define a function for later use. The function is: test[x_]:=x^2 While I don't close Mathematica, I can use the function on my notebooks but ...

1 answer

Tikz surface plot

Does anyone know how to replicate this Mathematica plot in tikz? (If possible: I'd like to use "pattern=crosshatched dots" to fill in the shaded region.) Below is the Mathematica code: ...

1 answer

Dual curve of the lemniscate of Bernoulli?

Does anybody happen to know the homogeneous equation $F(u,v,w) = 0$ for the algebraic curve dual to the lemniscate of Bernoullli: $$ F(x,y,x) = (x^2 + y^2)^2 - A (x^2 -y^2)z^2 = 0?$$ I looked at the ...

3 answers

Fanciest way to include Mathematica code in LaTeX

I am trying to include a Mathematica code in LaTeX. To obtain the Mathematica code I just exported notebook as PDF. I didn't like the way it was included in my TEX code so I just thought of adding a ...

3 answers | Mar 27 at 17:00 by Thanos on TeX - LaTeX tex.stackexchange.com
0 answers

What is $\int (1-e^{-x})^n dx$?

For my purposes, $n$ is a non-negative integer, and $x > 0$. I didn't know how to evaluate this integral, so I plugged it into Mathematica. It told me the solution is $(-1)^n B(e^x; -n, n+1)$ I ...

1 answer

mathematica Sum of functions

I want to build a function in the following way: f[x_] := 0; For[i = 1, i <= n, i++, g[x_] := 0; For[k = 1, k <= i, k++, g ^:= g[#]*(# - X[[k]]) &; g[x_] = ...

1 answers | Mar 27 at 14:13 by Botulus on Stack Overflow stackoverflow.com
1 answer

Matlab and Mathematica : Finding the density function

The pdf of a standard Gamma distribution is $f(x) = \frac{x^{\gamma-1} \exp(-x)}{\Gamma(\gamma)}$. How do I find the pdf of of the random variable Z = X + Y where Y is the Normal distribution? There ...

2 answers

Wolfram Mathematica: How can I copy list without only one element?

E.g. I have list A = {a,b,c,d} How can I get list B = A without {b} element in one command?

0 answers

Precision of starting values in FindMinimum

I am currently working on an optimization of chemical kinetic model. Starting points for FindMinimum is defined as: k10 = 2.45*10^-1 and k20 = 8.65*10^-11. The step monitor is used to show calculated ...

1 answer

Solve 4 A (L^(3/4)) - wL (((24 - L) w)^(-3/4)) = -(((24 - L) w)^(1/4)) for L? Using Mathematica

I'm trying to solve $$4 A (L^{3/4}) - wL (((24 - L) w)^{-3/4}) = -(((24 - L) w)^{1/4})$$ for $L$ using Mathematica, and it spits the following out: Solve[4 A (L^(3/4)) - wL (((24 - L) ...

1 answer

What sorting algorithm is this, and how does it work? (If there isn't a name or well-known resource for it.)

It's been nearly ten years since I took my DSA class. I've looked through Wikipedia's list of sorting algorithms but none stand out as being this one. It's part of a priority queue implementation, and ...

5 answers

Sprintf equivalent in Mathematica?

I don't know why Wikipedia lists Mathematica as a programming language with printf. I just couldn't find the equivalent in Mathematica. My specific task is to process a list of data files with ...

5 answers | Mar 25 at 15:52 by jxy on Stack Overflow stackoverflow.com
2 answers

Solving differential equations with Wolfram Mathematica

So i saw this differential equations in my textbook $\frac{{{d^4}\omega }}{{d{x^4}}} + 4{\lambda ^4}\omega = 0$ and i figured why not solve it with majestic Wolfram Mathematica, so i write this ...

0 answers

HMAC SHA384 in Mathematica

Here is a great example of the implementation of HMAC MD5 and SHA in Mathematica: HMAC (hash-based message authentication code, aka data signing) in Mathematica Can anybody explain how to modify that ...

1 answer

How to use values computed with NDSolve in Mathematica?

I'm trying to solve one differential equation and use 2 computed values (at specific points) as boundary conditions for a new differential equation. An example: sys1 = {p''[x] + p'[x] + p[x] == ...

1 answers | Mar 25 at 6:23 by Eng.Technion on Stack Overflow stackoverflow.com
0 answers

how to find intervals (where roots exist)

Tell me please, how on the 2-nd step of algorithm to find intervals (where roots exist) separately in the 1-st found interval {2.11731,3.3125} and in the second {5.5,5.75}, using myintervals1 ???? I ...

2 answers

How to unite intervals?

Help me please to unite resulted intervals! The line "For..." outputs the intervals where the roots exist (roots: 2.94 and 5,52). I have to consider a remark: If in the intervals {x*[i],x[i+1]} ...

2 answers | Mar 24 at 17:28 by Julka on Stack Overflow stackoverflow.com
1 answer

Draw a square wave using Mathematica for a long range

I want to get a continuous square wave use the software mathematica. Plot[SquareWave[{0, 10}, x], {x, 0, 10}, ExclusionsStyle -> Directive[Dotted, Red]] However, if I set the xmax to be ...

1 answers | Mar 24 at 16:58 by ycagelulu on Stack Overflow stackoverflow.com
1 answer

HMAC (hash-based message authentication code, aka data signing) in Mathematica

It seems there's an implementation of HMAC in every language under the sun. (See below.) And the algorithm is quite straightforward: http://en.wikipedia.org/wiki/HMAC Has anyone implemented it in ...

1 answer

How to delete duplicate based on a portion of list item only in Mathematica

I have the following data set (showing just the snapshot) data = {{0.1, 0.2, 5}, {0.1, 0.3, 7}, {0.2, 0.2, 1}, {0.1, 0.2, 9}} In other words, the data is in the format of {A, B, C}. I want to ...

1 answers | Mar 24 at 9:22 by Lawrence Teo on Stack Overflow stackoverflow.com
1 answer

Nested if conditional in Mathematica

Do you know if and how I can rewrite the code below in a better form for different values of m, k, and l? It is a nested if conditional construct that I want to check b for all m, k, and l, but the ...

1 answer

Calculating area of a function using Riemann's Sum

f[x_] := 2/(2x+2) Limit[ Sum[ deltaX = 1/n; xk = 0 + k * deltaX; f[xk]*deltaX, {k, 1, n} ], n-> \[Infinity] ] I have the following code however, It ...

1 answer

Roots in the intervals

Help me please to fix the line! The line "For.." works and prints intervals which don't contain roots. And I have to output the remaining intervals which include roots. (I know that these intervals ...

1 answers | Mar 23 at 20:25 by Julka on Stack Overflow stackoverflow.com
0 answers

Mathematica PDF Error

I want to create a pdf document of my mathematica codes, when I press save as>PDF, it creates only one page. But I have fifteen pages totally. Is there any solution for the true printing?

15 30 50 per page
1 2 3