This is my first post, and I am looking for some help in using Matlab or any easy way to solve the following equation.
This shows how the equation would look like:
Below is my code in Matlab:
Delta_T=5;
T_b=373;
rho_l=958;
rho_g=0.05956;
C_l=4217;
C_g=2029;
k=0.680;
L=2257E3;
R(:,:)=zeros;
pi=3.1415;
beta_0=1;
beta=fsolve((rho_l*C_l*Delta_T)/(rho_g(L+(C_l-C_g)*Delta_T))*
(1/integral((#ksi)exp(-beta_g^2*((1-ksi)^(-2)-2*(1-(rho_g/rho_l))*ksi-
1),0,1))),beta_0);
beta_g=sqrt(beta/2);
Related
I am quite new to sympy. I need to work with Function Series, something of the kind,
Sum(f_i(x), (i,0,n))
Of course this could be written like Sum(f(x,i),(i,0,n)) having defined i and n as integer.
Anyway, I am not finding any online resource to learn how to work with this conveniently, write the series, and then make operations like derivatives,...
Could anybody recommend a resource, or explain how she/he is writing it in sympy.
Thanks in advance!
I can solve an equation using Maxima by using the commands below.
kill(all);
A:A; phase:phase; solve(A*cos(2*pi*f*t+phase)=y,phase);
And it gives me the correct answer.
phase=acos(y/A)-2*f*pi*t
But when I try and solve for just the top portion of an equation the x(n+1) portion. Here's the equation.
See website Clifford Attractor.
It's not what I expected. The equation I use is below:
kill(all);
x:x; a:a; c:c; n:n; solve(sin(a*y(n))+c*cos(a*x(n))=x*(n+1),x);
What I get is :
x=(sin(a*y(n))+c*cos(a*x(n)))/(n+1)
I expected it to be something like:
x[n] = sin(a*y[n-1])+c*cos(a*x[n-1]);
Any idea what I'm doing wrong?
I'm using wxMaxima 18.02.0 in ubuntu 18.04 64bit
Does anybody know the octave equivalent function to Matlab's pretty. I have tried the following
symbols
x = sym('x')
diff(sin(x)*cos(x),x)
pretty (ans)
I tried pretty(ans) in octave and it did not throw an error. Also, the answer output was not enhanced. I think the function pretty is automaticly called on the output in Octave.
I'm trying to build a program in Pascal to differentiate mathematical functions. It's working very well (calculate min/max, symmetry, drawing the graph, etc.) but I have to put the functions (i.e. x^3+3x+2) into the source code like this:
function f(x : real): real;
begin
f := x * x * x + 3 * x + 2;
end;
Though, I want the user to define the function to differentiate. Obviosly the readln function does not help.
Somebody told me the only solution would be a specific parser. But it's very difficult, and I don't know how to do it.
My idea would be to extract the function into a *.txt file for example so that it could be changed easily. Is that possible?
Can somebody show me a parser which could solve this problem or have anybody some other great solution?
I would really appreciate your help!
Thanks in advance ;)
Free Pascal ships with the symbolic package, which has both a parser and evaluator for mathematical expressions. You can probably use this as a starting point. See the documentation for usage.
There are also a number of parsers/evalutaors on SWAG:
EQUATE.PAS (short, clean evaluator)
PARSMATH.PAS (very short example code)
Math Parsing Unit (undocumented, kind of messy)
Math Evaluations (Somewhat cryptic.)
Nice Expression Parser (Small, seems well done.)
Expression Evaluator (Messier, includes trig functions.)
Math Expression Evaluator (not well documented)
Equation Parser (converts equations to arrays of coefficients)
Text Formula Parser (fairly complete parser/evaluator unit)
I bolded the ones I thought were the most useful. I don't think any of them are as complete as the symbolic package in my other answer, but they might be worth reading if you need help.
(All of this is fairly old code. Unless otherwise stated, the rule with SWAG is to treat this stuff as having a new-style BSD license)
I've searched extensively, and thought I wouldn't be the only one having this problem, but it seems to look like I am.
I am solving an ode via ode15s (my problem can be stiff) and I use the 'Events' option to find my point of interest.
The problem is: the equation that I use in 'value' is depending (among other things) on the specific time (so value = f(t,y,y'), and I cannot find a way of passing the current time to this function, only the y vector is available.
Anyone has any ideas?
Thanks in advance and all the enjoy the rest of your holidays!
Sorry, made a really stupid error (used , instead of ;)...
You can just use the t argument as long as you set it in your #odefunction(t,y) as well as your #events(t,y).