Error multiplying functions

۴ بازدید
رفتن به اولین پیام خوانده‌نشده

Martin Jones

خوانده‌نشده،
۲۸ اردیبهشت ۱۴۰۲، ۷:۲۸:۴۱۱۴۰۲/۲/۲۸
به Numbas Users
I have been using the expression command to create randomised algebraic expressions. But it doesn't behave correctly in the way I expect expressions to work.

For example f is defined expression(2+"t+"+5) then it shows as 2t+5 as expected.

But if I try to evaluate t*{f} or t*({f}) then the answer is 2t^2+5 instead of 2t^2+5t.


Thanks.

Timur Zaripov

خوانده‌نشده،
۲۹ اردیبهشت ۱۴۰۲، ۱۰:۱۹:۵۵۱۴۰۲/۲/۲۹
به numbas...@googlegroups.com
Dear Martin,

Not sure is by design, but what happens is more like a string substitution, where {f} is replaced by expression f, rather then algebraic substitutions, where {f} is replaced by expression (f).

As a workaround you could use t*({f}) which will do what you expect.

With best regards,
Timur Zaripov.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/06853777-2991-449e-95df-b5afe8974eedn%40googlegroups.com.

Martin Jones

خوانده‌نشده،
۲۹ اردیبهشت ۱۴۰۲، ۱۰:۲۶:۰۰۱۴۰۲/۲/۲۹
به Numbas Users
Hi Timur,
I did try using t*({f}) and the result is the same.
Martin

Timur Zaripov

خوانده‌نشده،
۲۹ اردیبهشت ۱۴۰۲، ۱۰:۳۵:۱۵۱۴۰۲/۲/۲۹
به numbas...@googlegroups.com
Dear Martin,

I get the result shown in screenshot below:
SCR-20230519-ntea-2.png

I have given you access to my test question to see if we do anything differently.

With best regards,
Timur Zaripov.

Christian Lawson-Perfect

خوانده‌نشده،
۱ خرداد ۱۴۰۲، ۴:۲۹:۲۵۱۴۰۲/۳/۱
به numbas...@googlegroups.com
I think this is a bug, sorry! I'll see try to fix it now.

Timur: Martin put "t*({f})" in the expected answer field for a mathematical expression part. Fortunately, it looks like your method of defining another variable would do as a work-around for now.

And I need to find out why there seem to be two different methods of substituting into expressions!

Martin Jones

خوانده‌نشده،
۱ خرداد ۱۴۰۲، ۴:۳۹:۲۱۱۴۰۲/۳/۱
به Numbas Users
Christian,
We have a few tests in https://numbas.mathcentre.ac.uk/question/142579/substitution-test/ some of which work and some don't. May help with your diagnosis.
Martin

Christian Lawson-Perfect

خوانده‌نشده،
۱ خرداد ۱۴۰۲، ۶:۰۵:۱۱۱۴۰۲/۳/۱
به numbas...@googlegroups.com
I think I've now fixed this. Thanks for the useful test cases!

Martin Jones

خوانده‌نشده،
۱ خرداد ۱۴۰۲، ۶:۱۲:۳۴۱۴۰۲/۳/۱
به Numbas Users
Thanks, that is indeed looking better.

There is just perhaps the puzzling preview that appears in the marking settings:
Screenshot 2023-05-22 111123.png

Christian Lawson-Perfect

خوانده‌نشده،
۱ خرداد ۱۴۰۲، ۶:۱۳:۴۱۱۴۰۲/۳/۱
به numbas...@googlegroups.com
Can you try reloading the page? I think MathJax has failed to load for you. It looks OK on my PC.

پاسخ به همه
پاسخ به نویسنده
فرستادن
0 پیام جدید