1 страниц (7 вхождений)
symbolic vs numeric optimisation - Ioan - Сообщения
#1 Опубликовано: 16.09.2012 16:32:13
#2 Опубликовано: 17.09.2012 11:34:42
Hello
The function norme(v) is buggy (known issue in the forum). Use [MATH]sqrt(v^2)[/MATH] instead if v is a single column as in your example. Works with both numeric and symbolic optimization.
Best regards, Martin Kraska
The function norme(v) is buggy (known issue in the forum). Use [MATH]sqrt(v^2)[/MATH] instead if v is a single column as in your example. Works with both numeric and symbolic optimization.
Best regards, Martin Kraska
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Опубликовано: 17.09.2012 13:18:38
Hello Martin,
Thanks for your answer.
I replaced all norme(v) as you suggest (see attached file) and for case of symbolic optimisation the results are still wrongs (?).
Best regards,
Ioan
rotsys2.sm (27 КиБ) скачан 39 раз(а).
Thanks for your answer.
I replaced all norme(v) as you suggest (see attached file) and for case of symbolic optimisation the results are still wrongs (?).
Best regards,
Ioan
rotsys2.sm (27 КиБ) скачан 39 раз(а).
#4 Опубликовано: 17.09.2012 19:29:32
Wrote
Thanks for your answer.
I replaced all norme(v) as you suggest (see attached file) and for case of symbolic optimisation the results are still wrongs (?).
Hello Ioan,
ok, you are right. Replacing enorm is not sufficient to solve the problem. There is another one with trig operations. The problem is that [MATH]sin(θ)[/MATH] is symbolically evaluated to zero, whereas the correct value is [MATH]sqrt(2)/sqrt(3)[/MATH]. If you ask SMath to simplify [MATH]sin(acos(a))[/MATH] you get [MATH]sin(acos(a))=sqrt(1-a^2)[/MATH]. If you use that instead of [MATH]sin(θ)[/MATH] :
[MATH lang=ENG]R

then you get the correct symbolic result.
[MATH lang=ENG]R=mat(-{1-sqrt(3)}/{2*sqrt(3)},{1+sqrt(3)}/{2*sqrt(3)},1/sqrt(3),{1+sqrt(3)}/{2*sqrt(3)},-{1-sqrt(3)}/{2*sqrt(3)},-1/sqrt(3),-1/sqrt(3),1/sqrt(3),-1/sqrt(3),3,3)[/MATH]
Symbolic evaluation seems to be not really reliable. Simplifications are not done even if SMath is well aware of that they could be done.
An example is
[MATH lang=ENG]cos(θ)={mat(0,0,-1,3,1)*mat(1/sqrt(3),-1/sqrt(3),1/sqrt(3),3,1)}/{sqrt(mat(0,0,-1,3,1)^2)*sqrt(mat(1/sqrt(3),-1/sqrt(3),1/sqrt(3),3,1)^2)}[/MATH]
which is not simplified although the following works:
[MATH lang=ENG]{mat(0,0,-1,3,1)*mat(1/sqrt(3),-1/sqrt(3),1/sqrt(3),3,1)}/{sqrt(mat(0,0,-1,3,1)^2)*sqrt(mat(1/sqrt(3),-1/sqrt(3),1/sqrt(3),3,1)^2)}=-1/sqrt(3)[/MATH]
Also, if [MATH]sin(acos(a))=sqrt(1-a^2)[/MATH] then the following cannot be correct:
[MATH lang=ENG]sin(θ)=sqrt({sqrt(mat(0,0,-1,3,1)^2)^2*sqrt(mat(1/sqrt(3),-1/sqrt(3),1/sqrt(3),3,1)^2)^2-1}/{sqrt(mat(0,0,-1,3,1)^2)^2*sqrt(mat(1/sqrt(3),-1/sqrt(3),1/sqrt(3),3,1)^2)^2})[/MATH]
Here, perhaps the symbolic engine tries to apply the square to the dot product by applying the square to the factors individually. This yields 1 because both vectors are unit vectors. It might be correct for scalars but definitely not for vectors. BTW it does not help to use matrix formulation of the dot product [MATH lang=ENG]el(transpose(v)*v,1)[/MATH]. We had such issues already with SMath assuming matrix multiplication to be commutative.
By the way, instead of your special function you could write [MATH lang=ENG]v.i†v.f=mat(1/sqrt(3),1/sqrt(3),0,3,1)[/MATH].
Best regards, Martin Kraska
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Опубликовано: 18.09.2012 02:29:56
Hello Martin,
Thanks a lot for your useful analysis.
Best regards,
Ioan
Thanks a lot for your useful analysis.
Best regards,
Ioan
#6 Опубликовано: 20.10.2012 05:27:08
Hi,
here is one more example for incomplete symbolic simplification in trig context. SMath knows that sin(30° ) equals 1/2 but can't find out symbolically that cosec(30° )=1/sin(30° ) is 2.
Best regards, Martin Kraska
trig.sm (9 КиБ) скачан 37 раз(а).
here is one more example for incomplete symbolic simplification in trig context. SMath knows that sin(30° ) equals 1/2 but can't find out symbolically that cosec(30° )=1/sin(30° ) is 2.
Best regards, Martin Kraska
trig.sm (9 КиБ) скачан 37 раз(а).
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Опубликовано: 22.10.2012 01:42:00
WroteHi,
here is one more example for incomplete symbolic simplification in trig context. SMath knows that sin(30° ) equals 1/2 but can't find out symbolically that cosec(30° )=1/sin(30° ) is 2.
Best regards, Martin Kraska
Wow, so difficult to me

1 страниц (7 вхождений)
-
Новые сообщения
-
Нет новых сообщений