I have been recently using Maxima (instead of Maple) and I obtained a weird symbol for which I didn't manage to get information.
Here is the code :
gx(t):=p0x*(1-t)^3+p1x*t*(1-t)^2+p2x*(1-t)*t^2+p3x*t^3;
dgx:diff(gx(t),t);
gy(t):=p0y*(1-t)^3+p1y*t*(1-t)^2+p2y*(1-t)*t^2+p3y*t^3;
dgy:diff(gy(t),t);
det(ax,ay,bx,by):=ax*by-ay*bx;
v(x,y):=-1/(R-sqrt(x**2+y**2))*[x,y];
f(t) := det(subst(N*t-j+1,t,dgx),subst(N*t-j+1,t,dgy),v(gx(N*t-j+1),gy(N*t-j+1))[1],v(gx(N*t-j+1),gy(N*t-j+1))[2])^2;
Now for the output corresponding to f(t), the "expt(...)" symbol appears.
If anyone has got any idea, I would greatly appreciate. Thank you.
From the manual:
If an exponential expression is too wide to be displayed as a^b it appears as expt (a, b)
Related
In Maxima, I am trying to simplify the expression
sqrt(1 - sin(x)) * sqrt(1 + sin(x))
to yield
cos(x)
I properly restricted the definition of x
declare(x, real) $
assume(x > 0, x < %pi/2) $
and tried several simplification commands including radcan, trigsimp, trigreduce and trigexpand, but without any success. How can this be done?
Try trigsimp(rootscontract(expr))
The restrictions you assert do not uniquely determine the simplified result you request.
It would seem both harmless and obviously unnecessary to declare or assume the following:
declare(9, real)
assume(9>0)
and yet, sqrt(9) is still the set {-3, +3}, mathematically speaking, as opposed to "what I learned in 6th grade".
Stavros' suggestion give |cos(x)|, which is not quite what the original questioner wanted.
Another way of getting the same result, one which may more explicitly exhibit the -in general falseness - of the result, is to square and then use the semi-bogus sqrt, that attempts to pick the positive answer.
trigsimp (sqrt(expand(expr^2)));
If you think this is a way of simplifying expr, note that it changes -3 to 3.
When I input:
integrate((sqrt(x+sqrt(x+1))),x);
It results in:
integrate(sqrt(sqrt(x+1)+x),x)
The result is displayed in a more organized manner. However, it does not give me the integral. Why?
Because it doesn't know how to solve it. You can use changevar to help maxima solve it. For example:
exp: sqrt(sqrt(x+1)+x)$
assume(u>0)$
changevar('integrate(exp,x), sqrt(x+1)-u,u,x)$
ev(%,nouns);
and substitute back for x:
ratsubst(sqrt(x+1),u,%)
Can anyone help me with conversion of the following code to vectorized form ??
z=X*theta;
g=sigmoid(z);
for i=1:m
J=J+((-y(i)*log(g(i)))-((1-y(i))*log(1-g(i))));
end
I have tried the following
z=X*theta;
g=sigmoid(z);
J=J+((-y).*log(g)-((1-y).*log(1-g)));
but this prints a particular value m times. and also wrong answer.
the answer for J is 0.693 which i get right using for loop but for the vectorized implementation i get 0.00693.
What's wrong?
Thanks in advance.
You are taking J, and adding all the -y(i)*log(g(i))-(1-y(i))*log(1-g(i)) to it.
So you need to take J and add (sum) all those things.
J=J+sum( (-y).*log(g)-(1-y).*log(1-g) );
I want to give variables a specific order in an equation in Maxima. This is display purposes only.
For example:
(%i1) E=(h*c)/%lambda;
c h
(%o1) E = -------
%lambda
I want the h and c variables to be in that order when displayed. I looked at ratvars() and ordergreat() but they don't appear to be relevant here.
Thanks for your help.
It appears that declare(<var>, mainvar) was what I was looking for. When mainvar attribute is declared for a variable it "succeeds all other constants and variables".
I was trying this using the STACK plugin for Moodle. I needed to remove the mainvar keyword from the forbidden list in the file casstring.class.php.
Actually, I think ordergreat() is the function you need, maybe you did a sorting before that needed unorder() first ro reset things.
Try
unorder()$ ordergreat (h, c)$ E=(h*c)/%lambda;
and
unorder()$ ordergreat (c, h)$ E=(h*c)/%lambda;
simple multiplication is failling in my script-fu.
the folowing code
(print "hello")
(print (/ 4 3))
(print (* 3 4))
(print "world")
Gives :
"hello"
1,333333333.0
Error: ( : 1) not enough arguments
Any idea ?
Thanks
I ran into a similar problem when trying to add new functionality to someone else's script. I wanted to provide my solution in case anyone else runs into a similar issue.
In this case, there was a '(let* (...))' statement that was being used to initialize some variables. The original author of the script wrote '(let * (...))' - with a space between let and star - which means every vector in the 'let' statement becomes the expected arguments for the '*' statement.
More info: http://docs.racket-lang.org/reference/let.html
Please excuse (and correct if necessary) any incorrect nomenclature regarding Scheme. I have barely just been exposed to it.