How can this integral be solved? - wolfram-mathematica

In the maple:
In the WolframAlpha:
What it is wrong? Could you explain me?

In WolframAlpha testing the two results to see if they are the same or not
Simplify[-1/2 x(cos(log(34 x))-sin(log(34 x)))==
(x tan(log(34 x)/2)-x/2+x tan(log(34 x)/2)^2/2)/(1+tan(log(34 x)/2)^2)]
(all done on a single line) returns
True
Link to WolframAlpha result
so the result from WolframAlpha and from Maple are equivalent, they are just expressed in different forms.
Ah, a simpler way to get the same result, doesn't even need the Simplify
-1/2 x(cos(log(34 x))-sin(log(34 x)))==
(x tan(log(34 x)/2)-x/2+x tan(log(34 x)/2)^2/2)/(1+tan(log(34 x)/2)^2)
returns
True
Another link to WolframAlpha

They are different representations of the same thing.
It is quite straightforward to demonstrate this in Maple itself.
restart;
A1 := int(sin(ln(34*x)),x):
lprint(A1);
(x*tan(1/2*ln(34*x))-1/2*x+1/2*x*tan(1/2*ln(34*x))^2)
/(1+tan(1/2*ln(34*x))^2)
A2 := combine(combine(simplify(A1))):
lprint(A2);
1/2*x*sin(ln(34*x))-1/2*x*cos(ln(34*x))
simplify(A1 - A2);
0

Related

Summation Elixir

I am trying to recreate this equation in Elixir:
For now I am working on an easy example and I have something like this:
Enum.each(1..2, fn x -> :math.pow(1 + 1/1, -x) end)
However, while using Enum.each I am getting an :ok output, and therefore I can't inject it later to Enum.sum()
I will be grateful for help.
While the answer by #sabiwara is perfectly correct, one’d better either use Stream.map/2 to avoid building the intermediate list that might be huge, or directly Enum.reduce/3 to the answer.
# ⇓ initial value
Enum.reduce(1..2, 0, &:math.pow(1 + 1/1, -&1) + &2)
Enum.each/2 is for side effects, but does not return a transformed list.
You are looking for Enum.map/2.
Alternatively, you could use a for comprehension:
for x <- 1..2, do: :math.pow(1 + 1/1, -x)

Taking Derivative of a Matrix with functions in Maple. Want to leave functions as prime (f' or f'') and not evaluate

I want to evaluate a matrix that has a function named alpha. When I take the derivative of alpha, I would like the result to give me an alpha'
Example: if I have sin(alpha) I want to get cos(alpha)alpha' but throughout the matrix.
It is quite unclear what you mean by stating that you have a "function" in Maple, of which you intend to take the derivative.
That could mean some expression depending upon a name such as t, with respect to which you intend on differentiating using Maple's diff command. And such an expression may be assigned to alpha, or it may contain the function call alpha(t).
Or perhaps you wish to treat alpha as an operator name, and differentiate functionally with Maple's D command.
I shall make a guess as to what you meant.
restart;
Typesetting:-Suppress(alpha(t));
Typesetting:-Settings(prime=t):
Typesetting:-Settings(typesetprime=true):
M := Matrix([[ sin(alpha(t)), exp(p*alpha(t)) ]]);
map(diff, M, t);
If that's not the kind of thing that you're after then you should explain your purpose and needs in greater detail.
Your question's title mentions a desire to have something not "evaluate". What did you mean by that? Have you perhaps assigned something to the name f?
Thank you for answering. I found the solution after a lot of guess and checking and reading. Here is my code with my solution.
with(Typesetting) :
Settings(typesetdot = true);
a:= alpha(t)
Rna:= [ cos(alpha), -sin(alpha), 0; sin(alpha), cos(alpha), 0; 0, 0, 1 ]
b := beta(t)
Rab:= [ cos(beta), -sin(beta), 0; sin(beta), cos(beta), 0; 0, 0, 1 ]
Rnab:= Rna . Rab
Rnab:= map(diff, Rnab, t)
Sorry for the multiple answers, I am getting use to the website.

Why Simplify[1/Sqrt[a] == Sqrt[1/a] doesn't give a "true" output in Mathematica?

In Mathematica, Simplify[1/Sqrt[a] == Sqrt[1/a]] gives Sqrt[1/a] == 1/Sqrt[a]. I don't really see why this doesn't give a true output when, FullSimplify gives the desired result.
This probably is a very dumb question, but I just don't see it.
Because if a<0 then sqrt can have complex output values.
For example
sqrt(1/-1)=i
while
1/sqrt(-1)=-i
See wiki.
You can specify assumptions to Simplify.
Simplify[1/Sqrt[a] == Sqrt[1/a], a >= 0]
(* True *)

Evaluating a table of functions at a point in mathematica

I would like to know if it is possible to evaluate a table of functions at a point in mathematica.
Right now I am given a table of 10 functions and would like to evaluate them at x = 0.
I tried this :
Evaluate[myTable, {x, 0}]
And it does not evaluate anything, it just gives this output:
Sequence[ {term1, term2, term3, term4, term5, term6, term7, term8, term9, term10}, {x,0}]
Replacing term1 ... term10 with the actual terms.
How would I be able to do this?
Thanks,
Bucco
Through[{f1,f2,f3,f4,f5,f6,f7,f8,f9,10}[0]]

Mathematica: Redefine multiplication so that 0*(-Inf) = 0

In my Mathematica program, I do some entropy calculations and I want to use this convention: Log[0]*0 = 0. Is there a clean way to do it or I have to write my own function?
Inspired by http://tinyurl.com/9d8r4rt I tried things like this:
Unprotect[Times];
Times[0, -Infinity] := 0;
Protect[Times];
But it doesn't seem to work in my case. Is there an elegant way to do this?
I support High Performance Mark's statement above. Nevertheless this is an interesting question because the answer is nontrivial.
You would need:
Unprotect[DirectedInfinity];
DirectedInfinity /: Log[0] 0 := 0
You need DirectedInfinity because:
Log[0] // FullForm
DirectedInfinity[-1]
And you need an UpValue, made using TagSet, to override the default reaction to -∞ * 0, because UpValues are tried before other definitions.

Resources