enter image description here
I'm inexperienced because it's my first time learning it. I really appreciate your help.
The problem are missing brackets in the second line. It is
plt.plot(x, 3+math.exp-x*math.sin(6*x))
while it probably should be
plt.plot(x, 3+math.exp(-x)*math.sin(6*x))
The error could help you with this as you tried to substract x (an integer) from math.exp (a builtin_function_or_method)
Related
I have a quick question. I am using tables::tabular() and have some summary statistics which are displayed in scientific e notation.
I found out that using Format(scientific=FALSE) * mean() in this context helps me to get rid of the scientific e notation in the means, and other summary statistics i present.
Now, I also want to round this number with the format 0.123456789 (most of the means are means of ratios between 0 and 1 but not all) to show the digits left and maximum 4 to the right of the comma i.e. 0.1234. I tried simply putting the digits=4 option into the Format and while it seems to work when alone in the Format() function, it doesn't somehow when I also have scientific=FALSE in there. Rather, with Format(scientific=FALSE, digit=1), I still get 5 digits to the right of the comma.
Do you know what is happening and how i can fix it?
Highly appreciate your help,
cork
Have you already tried to use a global statement at the beginning like this: options("digits" = 4)?
All the best,
Patrick
I have this code:
(%i3)depends([y,x],t)$
eqsp: [y=2*x,
v=diff(y,t,1)+y];
eliminate(eqsp,[y]);
(eqsp) [y=2*x,v='diff(y,t,1)+y]
(%o3) [-'diff(y,t,1)-2*x+v]
And this is a picture for better visualization:
PNG of code in wxMaxima
I was expecting that Maxima would perform a substitution of "y" in the second equation, and then differentiate to get "[-2*diff(x,t,1)-2*x+v]".
This is of course not the real problem (which has many more equations), it's just that I think I'm missing some concept here for Maxima to do what I want.
Thanks in advance for your comments. I'm a newbie in Stackoverflow and in Maxima, sorry if I made some mistake.
This is a discrete math problem, and i was hoping that someone will guide me in the right direction on how to go about solving it...
I have the following set of sequences:
a_(2n) = 8^n
This will give me the values of all the even terms
a_(2n+1) = (-3)8^n
This will give me the values of all the odd terms
I would like to know if there's a way for me to express the values of all terms (both even and odd) using only one formula! Would you please help me!
Thank you,
You can define it as follows:
a_k=[-1+2*(-1)^k]*8^(floor(k/2))
I want to make a program where it will ask the user to enter a function, for example, cos(x) + 2. My problem is that, I do not know the syntax or the code on how to make the entered function become a real function where I can manipulate it, like get the derivative of it, plot it, something like that. Can anyone please teach me on how to do that? Thank you!
To create a "real" function, you can use 2 different syntaxes:
function [x]=myfct(a,b)
x=a+b;
endfunction
or
deff("[x]=myfct(a,b)","x=a+b");
Note: if you have only one return varaible, you can omit the square brackets.
The latter form is more straightforward here, because you only need to ask 2 or 3 strings from the user:
function_statement: the answer should be "x=a+b"
input_varaible_list (separated by comas): the answer should be "a,b"
output_varaible_list (separated by comas): the answer should be "x"
Then put it together in a deff:
deff("["+output_varaible_list+"]=myfct("+input_varaible_list+")",function_statement);
If you fix the output variable name as x, then you don't have to ask for it, and the user have to enter only the right hand side of the function statement (after the =). So it becomes:
deff("[x]=myfct("+input_varaible_list+")","x="+function_statement);
For the derivative see the derivative and numdiff functions in the Scilab help.
I have a simple loop
for(z in 1:length(x)){
country=region_names[z]
//paste("xyz",country)//
....
}
Now, after the loop is finished, z will have the value equal to the length of x.
Now, I need to find a way to add an iterator.
Supposedly, when it is at the second loop, iterator=2, it will show "xyzUSA".
Supposedly, when it is at the third loop, iterator=3, it will show "xyzFrance"
My problem is, I don't need to show them all at once, but when the iterator is triggered, the program knows what the value of iterator is, and shows the corresponding country.
Now, how can I build an iterator like this?
Any help is appreciated
To all people who cannot understand my question, I myself figured it out.
It was an issue of lazy evaluation. It can be solved by using
force()
Sorry about the confusion, your help is appreciated.