Tag Archives: Mathematica

Arithmetic on lists within lists

I want to take a nested list and replace each sub-list with an arithmetic operation on its elements. For example: a={{1,3},{2,2},{2,3}}. I want to get {4,4,5}. I can do it by: f{x_,y_}=x+y and then Map[f,a] but I suspect that there has to be an easier way by applying rules or similar.

How do we show reduction steps?

This produces 3 equivalent Diophantine equations. How can we show the reduction steps? I need to do this for a paper. Clear[x, y, z, n]; lexp = n >= 2 && x == (3^n – y)/(2^n) == (3^n – 1 – z)/(2^n – 1) && 0 < z < 2^n - 1 && 0 <… Read More »

Does this function exits?

I am trying to create a list of special functions defined in MA. Is there an undocumented function in Mathematica that returns a list of all special functions defined (ex: Gamma, BaselJ, PolyLog, etc.). Because copying and pasting all of them would take while.

Integration of linked PDFs over probability simplex

I’m trying to integrate the following expression: f[a1,p1+p2+p3+p4]*f[a2,p2+p3+p4]*f[a3,p3+p4]*f[a4,p4] Where f[x_, u_] := E^(-(x – u)/2)/(2*(1 + E^(-(x – u)/2))^2) i.e. the PDF of the logistic distribution with s=2. Also, the a’s are positive integers. The tricky part is that I want to integrate over all values of the p values that result in them forming… Read More »

How can I check if a function remains unevaluated?

I am trying to check if a function remains unevaluated. For example $$int ln ^5(3 x) sec (3 x) , dx$$ remains unevaluated in Mathematica, instead $$int sec (3 x) , dx$$ doesn’t. What I tried is func = Log[3 x]^5*Sec[3 x]; IntFunc = With[{function = func}, HoldForm[Integrate[function, x]]]; SameQ[IntFunc,ReleaseHold[IntFunc]] which returns False. I also… Read More »

Mathematica function which formats Physics calculation

one small step toward automating homework 🙂 My lecturer doesn’t accept calculations done in Mathematica code as homework. I have 30 pages of small calculations such as the one below. I don’t want to write them out by hand. Surely there is a way to automate the process using TraditionalForm[] and macro coding? Below is… Read More »

Show steps to integral computation?

I’m not sure if this is a duplicate question; I don’t think it is. How would I have Mathematica display the steps that it took in evaluating an integral (or derivative for that matter), let’s say, $$int_0^2 (1-e^{sin^2 (x^{5})})dx$$ I want to achieve something similar to this website, if that’s possible. Thank you for any… Read More »

Define a distributive function?

Here is a related question, but not quite what I’m after. I would like to define a function f[x_] that has the distributive attribute, such that: f[a+b+c] f[a]+f[b]+f[c] Of course I could do f[Plus[x_,y___]]:=f[x]+f[Plus[y]] but I suspect that this would be much slower than an actual Attribute. Unfortunately, I cannot find Distributive in the list… Read More »