1

我正在尝试绘制函数图Fh_1,但看起来 ezunits 正在引起问题。当我输入 x 值时,我可以从中得到结果。但是绘图不起作用,即使使用 Dimensionly() 也不行。我怎样才能让它工作?

(%i2)   kill(all); load(ezunits); g2r(x):= x*%pi/180;
(%o0)   done

(%o1)   "C:/maxima-5.44.0/share/maxima/5.44.0/share/ezunits/ezunits.mac"

(%o2)   g2r(x):=(x*%pi)/180
  1 variables
(%i3)   rho: atan(rat(0.35));
rat: replaced 0.35 by 7/20 = 0.35

(rho)   atan(7/20)
(%i4)   L_FPzuLH: 110`mm;
(L_FPzuLH)  110 ` mm
(%i5)   L_Backe: 33`mm;
(L_Backe)   33 ` mm
(%i6)   L_HebelLinks: 81`mm;
(L_HebelLinks)  81 ` mm
  2 function
(%i7)   Fh_1(D_Platte):= L_HebelLinks*sin(g2r(90)-(g2r(90)-(acos((L_FPzuLH-D_Platte-L_Backe)/L_HebelLinks)))-rho);
(%o7)   Fh_1(D_Platte):=L_HebelLinks*
sin(g2r(90)-(g2r(90)-acos((L_FPzuLH-D_Platte-L_Backe)/L_HebelLinks))-rho)
  3 this works
(%i9)   Fh_1(31`mm); float(%);
(%o8)   81*sin(acos(46/81)-atan(7/20)) ` mm

(%o9)   47.73170350716926 ` mm
  4 but not this
(%i10)  dimensionally(plot2d(Fh_1(x), [x,5`mm,55`mm]));
plotting: range must be of the form [variable, min, max]; found: 

 [x,5*g1498,55*g1498]

 -- an error. To debug this try: debugmode(true);

为千里马粘贴:

/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/
/* [ Created with wxMaxima version 21.02.0 ] */
/* [wxMaxima: input   start ] */
kill(all); load(ezunits); g2r(x):= x*%pi/180;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: section start ]
variables
   [wxMaxima: section end   ] */


/* [wxMaxima: input   start ] */
rho: atan(rat(0.35));
/* [wxMaxima: input   end   ] */


/* [wxMaxima: input   start ] */
L_FPzuLH: 110`mm;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: input   start ] */
L_Backe: 33`mm;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: input   start ] */
L_HebelLinks: 81`mm;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: section start ]
function
   [wxMaxima: section end   ] */


/* [wxMaxima: input   start ] */
Fh_1(D_Platte):= L_HebelLinks*sin(g2r(90)-(g2r(90)-(acos((L_FPzuLH-D_Platte-L_Backe)/L_HebelLinks)))-rho);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: section start ]
this works
   [wxMaxima: section end   ] */


/* [wxMaxima: input   start ] */
Fh_1(31`mm); float(%);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: section start ]
but not this
   [wxMaxima: section end   ] */


/* [wxMaxima: input   start ] */
dimensionally(plot2d(Fh_1(x), [x,5`mm,55`mm]));
/* [wxMaxima: input   end   ] */



/* Old versions of Maxima abort on loading files that end in a comment. */
"Created with wxMaxima 21.02.0"$
4

1 回答 1

0

因此,正如我在上面的评论中所说,调用qty以获取维度表达式的数量。请注意,我正在为Fh_1as编写参数x ` mm,其中x是我们正在绘制的无量纲变量。

plot2d (qty (Fh_1 (x ` mm)), [x, 5, 55]);

当我尝试使用 Maxima 5.44 时,这很有效。你可能有兴趣看看

(%i11) qty(Fh_1(x ` mm));
                                    77 - x         7
(%o11)                  81 sin(acos(------) - atan(--))
                                      81           20

当我尝试plot2d使用当前(大约 5.45)版本时,我遇到了堆栈溢出(与试图确定某个表达式是否无量纲有关),我现在正在调查。

这是该错误的解决方法,当我使用当前接近 5.45 的版本进行尝试时,它成功了。我生成一个点列表,然后绘制这些点。

(%i11) qty(Fh_1(x ` mm));
                                    77 - x         7
(%o11)                  81 sin(acos(------) - atan(--))
                                      81           20
(%i12) ev(makelist([y,ev(%,x = y)],y,5,55),numer);
(%o12) [[5, 11.23941870984706], [6, 13.34349300482042], 
[7, 15.34276468157134], [8, 17.25033934972067], [9, 19.07666307706286], 
[10, 20.83022404590423], [11, 22.51803233322337], [12, 24.14595804280109], 
[13, 25.71897581938176], [14, 27.24134562928132], [15, 28.71674902665171], 
[16, 30.14839362529976], [17, 31.53909440876992], [18, 32.89133786911122], 
[19, 34.20733321424233], [20, 35.48905369852528], [21, 36.73827031267255], 
[22, 37.95657949382723], [23, 39.14542610575446], [24, 40.30612264125835], 
[25, 41.43986538015634], [26, 42.54774807342751], [27, 43.63077360174984], 
[28, 44.68986396358886], [29, 45.72586887656475], [30, 46.73957322048246], 
[31, 47.73170350716926], [32, 48.70293352820919], [33, 49.65388930464281], 
[34, 50.58515344111066], [35, 51.49726896955291], [36, 52.39074275352331], 
[37, 53.26604851273431], [38, 54.12362951808341], [39, 54.96390099970309], 
[40, 55.7872523042014], [41, 56.5940488319625], [42, 57.38463378095388], 
[43, 58.15932971977946], [44, 58.91844000959603], [45, 59.6622500918724], 
[46, 60.39102865673311], [47, 61.1050287047217], [48, 61.80448851319165], 
[49, 62.48963251713631], [50, 63.16067211306913], [51, 63.81780639352923], 
[52, 64.46122281889194], [53, 65.09109783238475], [54, 65.70759742353295], 
[55, 66.31087764466791]]
(%i13) plot2d([discrete,%]);
于 2021-05-30T20:40:21.197 回答