Closed dwarning closed 3 months ago
I guess you want to do something like the following:
vt(Temp):=Temp*.07;
eq1:Isat = Is*(Temp/T_Nom)^(X_T/N)*exp(-E_G/(N*'vt(Temp))*(1-Temp/T_Nom));
eq2:Isat_dT=diff(rhs(eq1),Temp);
vals:[
T_Nom=40,
E_G=1.4,
N=2,
Is=1e-4,
X_T=3
];
subst(vals,eq1);
wxdraw2d(
explicit(rhs(subst(vals,eq1)),Temp,1,10)
);
wxanimate_autoplay:true;
with_slider_draw2d(
E,makelist(i/10,i,1,10),
title=sconcat("E_G=",E),
xlabel="Temp [°C]",ylabel="I_{Sat}",
grid=[5,5],
explicit(subst(vals,subst(E_G=E,rhs(eq1))),Temp,1,10)
)$
Yes, I think this will solve the original problem. I recognize the principle. I just build a new wxMaxima on my Ubuntu 22.04 from github latest source.
Then I installed maxima (found no lisp exec on SF): sudo alien -i maxima-5.47.0-1.x86_64.rpm maxima-exec-gcl-5.47.0-1.x86_64.rpm
With your example I got now in the plotting part:
Message from maxima's stderr stream: Unrelocated non-local symbol: __stack_chk_fail
loadfile: failed to load /usr/share/maxima/5.47.0/share/draw/draw.lisp
-- an error. To debug this try: debugmode(true);
Sorry for mixing the problems and thanks.
Seems like the rpm of Maxima depends on libraries that you haven't installed in the right version.
But Maxima is not hard to compile by yourself, neither: cd into the source and type in:
./bootstrap.sh
./configure
make
sudo make install
Yes - after installing clisp I could build from maxima git a working executable. Thank you for your help - I will close.
Sorry for Re-open.
Two things seems not to work in the attached script:
Isat_sp3(Temp):=1.010^-15%e^(arg22(Temp)+arg21(Temp)) draw2d (explicit): non defined variable in term: errexp1 -- an error. To debug this try: debugmode(true);
Can the wxdraw2d feed with two equations? ... explicit(rhs(subst(vals,eq1)),Temp,-50,150), explicit(rhs(subst(vals,eq7)),Temp,-50,150) );
The attached script removes the temperature shift functions and works in Kelvin what is a bit unusual.
Perhaps someone find a way that the plotted equations can also use the preprocessed temperature in Celsius.
The celsius problem sounds like wxMaxima should include a 2D plotting tutorial:
wxdraw2d(
grid=[5,5],
xrange_secondary=[0,100]+273.25,
xtics_secondary=true,
xlabel_secondary="T [K]",
xlabel="T [°C]",
xrange=[0,100],
explicit(subst(T=Celsius+273.25,T^4),Celsius,0,100)
);
...and perhaps it would make sense to create several lists of numeric values, not only "vals". I believe if that doesn't work out for you the mechanism that gives constants like "%pi" their value while telling maxima to keep the symbol as long as possible can be accessed from the user-side, as well, but I've never needed to find out.
If wxdraw
or similar gives an "undefined variable" error and you cannot find out where just rename the wxdraw
into something maxima doesn't know (dwxdraw
or similar) and it will show you what equation it tried to plot - and the variable that is attached to the slider sometimes needs to be substituted into the equation using subst() due to a bug-like feature in maxima's makelist...
Yes - to make the shift in diagram is another solution. Will try it later. But I have the impression that pre-defined functions (here vt(Temp) and Eg(Temp) will not substituted in the following equation eq9 which should plotted. The substitution goes only to eq9 and not to the equations before.
KoverQ : 8.617330337217213e-5;
vt(Temp) := KoverQ * Temp;
Eg(Temp) := EG2 - GAP1 * Temp^2 / (Temp + GAP2);
eq9:Isat_hsp2(Temp) := IS*exp(Eg(TNOM)/(N*vt(TNOM)) - Eg(Temp)/(N*vt(Temp)) + XTI/N*log(Temp/TNOM));
vals:[
TNOM = 300,
EG = 1.11,
N = 1.2,
XTI = 3.0,
IS = 1e-15,
GAP1 = 7.02e-4,
GAP2 = 1108.0,
EG2 = 1.16
];
subst(vals,eq9);
wxdraw2d(logy=true,
xlabel="Temp [°C]",ylabel="I_{Sat}",
grid=[5,5],
color = blue,
key="Isat_{hsp2}",
explicit(rhs(subst(vals,eq9)),Temp,250,450)
);
That's why I almost never use functions, but use named equations, lhs()
, rhs()
and subst()
instead: Functions work, but more or less only in the case that you don't intend to use Maxima as a computer algebra system.
Yes, this is the problem of my issue. I think we can stop here.
Closing this issue according to previous comment.
I am using wxMaxima for model evaluations, particularly calculation and plotting of equations and symbolic differentiation. The problem I have is that I have to comment out numeric constants and plot function to see the results of symbolic differentiation variable and parameter names:
Contrary if I want see numerical results and plotting I remove the comments for the constants and plot function then the differentiations are calculated but the results of the former symbolic differentiation disappears :
The question is: Are there specific evaluations possible for numeric and symbolic?
My test case is attached.
Test_sym_num.wxm.txt